Autotest compatiable?

8 views
Skip to first unread message

Nicholas Henry

unread,
Nov 6, 2007, 11:33:41 AM11/6/07
to shoulda
I was wondering if the plugin was compatible with autotest, I
constantly get an error when autotest detects a change in file and
tries to execute a specific context/test.

Any ideas would be much appreciated!

Thanks,
Nicholas

Here is the error trace:

/usr/local/bin/ruby -I.:lib:test
test/functional/cart_items_controller_test.rb -n "/^(test:\ on\
DELETE\ to\ :destroy\ should\ destroy\ record\.\ |test:\ on\ DELETE\
to\ :destroy\ should\ redirect\ to\ "cart_url"\.\ |test:\ on\ DELETE\
to\ :destroy\ should\ respond\ with\ redirect\.\ |test:\ on\ POST\ to\
:create\ with\ nil\ should\ assign\ @cart_item\.\ |test:\ on\ POST\
to\ :create\ with\ nil\ should\ not\ have\ errors\ on\ @cart_item\.\
|test:\ on\ POST\ to\ :create\ with\ nil\ should\ redirect\ to\
"cart_url"\.\ |test:\ on\ POST\ to\ :create\ with\ nil\ should\
respond\ with\ redirect\.\ )$/" | unit_diff -u
/usr/local/lib/ruby/1.8/test/unit/autorunner.rb:138:in `=~': can't
convert Symbol into String (TypeError)
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:138:in
`options'
from /usr/local/lib/ruby/1.8/test/unit/collector.rb:26:in
`include?'
from /usr/local/lib/ruby/1.8/test/unit/collector.rb:25:in
`include?'
from /usr/local/lib/ruby/1.8/test/unit/collector.rb:18:in
`add_suite'
from /Users/nicholas/Sites/shop.david-goliath.ca/web/vendor/
rails/activerecord/lib/../../activesupport/lib/active_support/
inflector.rb:257:in
`find_all'
from /usr/local/lib/ruby/1.8/test/unit/collector.rb:18:in
`add_suite'
from /usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:
25:in
`collect'
from /usr/local/lib/ruby/1.8/test/unit/collector/objectspace.rb:
23:in
`collect'
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:59
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:198:in
`run'
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:13:in
`run'
from /usr/local/lib/ruby/1.8/test/unit.rb:285
from test/functional/cart_items_controller_test.rb:38

Tammer Saleh

unread,
Nov 8, 2007, 2:02:51 PM11/8/07
to sho...@googlegroups.com
Hi Nicholas,

Should and autotest should play together just fine (I've been using
autotest almost since I've started developing it). Maybe if you
upload the test file itself someone here can help with diagnosing the
issue.

Cheers,
Tammer

Dan Croak

unread,
Nov 9, 2007, 9:06:32 AM11/9/07
to shoulda
Hi Nicholas,

I also use autotest with Shoulda and haven't had any problems. Any
errors that autotest has thrown for me have been application, not tool
errors. Have you checked line 38 of your cart_items_controller_test.rb
to see if you are trying to compare or match a string to a symbol?

Good luck!

Dan

Nicholas Henry

unread,
Nov 9, 2007, 2:23:23 PM11/9/07
to shoulda
Thank you for your replies, Tammer and Dan,

It appears the issue is with the latest edge Rails (REVISION_8118) and
not anything to do with shoulda or autotest. The error even occurs
running classic unit tests even from the command line.

For those that are interested....

At the command line this fails:
ruby test/functional/world_controller_test.rb -n "/^(test_truth)$/"

See error trace below. Autotest generates this type of command line
after a previous failing test. Anyway a explicit string conversion in
autorunner fixes it until it's fixed in edge.

/usr/local/lib/ruby/1.8/test/unit/autorunner.rb:138:in `=~': can't
convert Symbol into String (TypeError)
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:138:in
`options'
from /usr/local/lib/ruby/1.8/test/unit/collector.rb:26:in
`include?'
from /usr/local/lib/ruby/1.8/test/unit/collector.rb:25:in
`include?'
from /usr/local/lib/ruby/1.8/test/unit/collector.rb:18:in
`add_suite'

from /Users/nicholas/Sites/test_shoulda/vendor/rails/
activerecord/lib/../../activesupport/lib/active_support/inflector.rb:


257:in `find_all'
from /usr/local/lib/ruby/1.8/test/unit/collector.rb:18:in
`add_suite'

from /usr/local/lib/ruby/1.8/test/unit/collector/
objectspace.rb:25:in `collect'
from /usr/local/lib/ruby/1.8/test/unit/collector/

objectspace.rb:23:in `collect'


from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:59
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:198:in
`run'
from /usr/local/lib/ruby/1.8/test/unit/autorunner.rb:13:in
`run'
from /usr/local/lib/ruby/1.8/test/unit.rb:285

from test/functional/world_controller_test.rb:7

ed_ruder

unread,
Dec 10, 2007, 2:50:05 PM12/10/07
to shoulda
Nicholas' suggestion worked for me--specifically, changing line 138 of
autorunner.rb to the following:

@filters << proc{|t| n =~ t.method_name.to_s ? true :
nil}

Ed
Reply all
Reply to author
Forward
0 new messages