Hi all,
i am new to ruby and rails and i am following the tutorial in
http://railstutorial.org/chapters/static-pages#sec:autotest
railstutorial.org to setup the rspec and autotest in my Ubuntu 10.04
i have the following gems installed
rspec (2.0.1)
rspec-core (2.0.1)
rspec-expectations (2.0.1)
rspec-mocks (2.0.1)
rspec-rails (2.0.1)
test-unit (2.1.1)
redgreen (1.2.2)
ZenTest (4.4.0)
autotest-rails-pure (4.1.0)
autotest (4.4.2)
i also have libnotify-bin installed in my Ubuntu 10.04. as well as
adding
“require ‘test/unit/ui/console/testrunner’” in my .autotest file.
i have tested the notify-send command and it works well and i run the
test
case with “rspec spec” without any problem.
but when i run autotest. there is not popup in my ubuntu gnome. and when
i
quit the autotest by ^C^C. the following error is shown.
ykyuen@ykyuen-laptop:~/Documents/RailsApplications/sample_app$ autotest
loading autotest/rails
Waiting since 2010-11-05 00:05:52
^CInterrupt a second time to quit
^C/home/ykyuen/.rvm/gems/ruby-1.9.2-p0/gems/test-unit-2.1.1/lib/test/unit/ui/console/testrunner.rb:29:in
initialize’: wrong number of arguments (3 for 2) (ArgumentError) from /home/ykyuen/.rvm/gems/ruby-1.9.2-p0/gems/redgreen-1.2.2/lib/redgreen.rb:17:in
initialize’
from
/home/ykyuen/.rvm/gems/ruby-1.9.2-p0/gems/test-unit-2.1.1/lib/test/unit/ui/testrunnerutilities.rb:24:in
new’ from /home/ykyuen/.rvm/gems/ruby-1.9.2-p0/gems/test-unit-2.1.1/lib/test/unit/ui/testrunnerutilities.rb:24:in
run’
from
/home/ykyuen/.rvm/gems/ruby-1.9.2-p0/gems/test-unit-2.1.1/lib/test/unit/autorunner.rb:307:in
run’ from /home/ykyuen/.rvm/gems/ruby-1.9.2-p0/gems/test-unit-2.1.1/lib/test/unit/autorunner.rb:52:in
run’
…
and this is my .autotest.
#!/bin/ruby
require ‘test/unit/ui/console/testrunner’
require ‘redgreen’
#require ‘test_notifier/runner/autotest’
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
Have i missed anything? Thanks.
–
View this message in context:
http://old.nabble.com/rspec-and-autotest-integration-problem-tp30163015p30163015.html
Sent from the rspec-users mailing list archive at Nabble.com.