I'm using autotest with ruby on rails. I have passing 2 passing tests when I run. rspec spec/
; however, when I try to use autotest this is the output:
matt@matt-laptop:~/sample_app$ autotest
loading autotest/rails_rspec2
style: RailsRspec2
matt@matt-laptop:~/sample_app$
I get no output about the results of the tests. The same thing works with bundle exec autotest
. I saw a post recommending autospec
but that command is deprecated with rspec2. My Gemfile is
source 'http://rubygems.org'
gem 'rails', '3.0.5'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.5.0'
gem 'autotest','4.4.4'
end
group :test do
gem 'rspec', '2.5.0'
gem 'webrat', '0.7.1'
gem 'autotest', '4.4.4'
gem 'redgreen', '1.2.2'
end
I have tried putting the .autotest config file in the root directory of my project as well as the home directory and neither makes a difference on the output. My .autotest file looks like this
#!/bin/ruby
require 'autotest/timestamp'
module Autotest::GnomeNotify
def self.notify title, msg, img
system "notify-send '#{title}' '#{msg}' -i #{img} -t 3000"
end
Autotest.add_hook :ran_command do |at|
image_root = "~/.autotest_images"
results = [at.results].flatten.join("\n")
results.gsub!(/\\e\[\d+m/,'')
output = results.slice(/(\d+)\sexamples?,\s(\d+)\sfailures?(,\s(\d+)\spending?|)/)
full_sentence, green, failures, garbage, pending = $~.to_a.map(&:to_i)
if output
if failures > 0
notify "FAIL", "#{output}", "#{image_root}/fail.png"
elsif pending > 0
notify "Pending", "#{output}", "#{image_root}/pending.png"
else
notify "Pass", "#{output}", "#{image_root}/pass.png"
end
end
end
end
I've also checked that libnotify-bin is installed and functioning.
To get verbose results from rspec, create a .rspec file in your root project folder and write :
If i may, allow me to suggest watchr instead of autotest (with spork as well). Very easy to set up and very effective.
Take a look at
http://www.rubyinside.com/how-to-rails-3-and-rspec-2-4336.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+RubyInside+%28Ruby+Inside%29
if you like.