When I:
rake test_units
my tests pass.
When I
ruby test/unit/kits_test.rb
my tests pass.
When I
rake
my test results look like a ride at Six Flags (..EE.E.EE..)
or someone hit their thumb with a hammer (..F.FF.FFF..)
Why the difference?
Some failure messages are attached at the end of this message, as well
as the test module.
Any help greatly appreciated!
Regards,
JJ
1) Error:
test_aaa_cutfiles_directories(KitsTest):
TypeError: cannot convert nil into String
./test/unit/kits_test.rb:24:in `exist?''
./test/unit/kits_test.rb:24:in `test_aaa_cutfiles_directories''
2) Error:
test_part(KitsTest):
NoMethodError: undefined method `part_number'' for nil:NilClass
./test/unit/kits_test.rb:101:in `test_part''
3) Error:
test_rawma(KitsTest):
NoMethodError: undefined method `description'' for nil:NilClass
./test/unit/kits_test.rb:97:in `test_rawma''
4) Error:
test_status_out_of_date(KitsTest):
NoMethodError: undefined method `+'' for nil:NilClass
./test/unit/kits_test.rb:48:in `test_status_out_of_date''
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails
On 21-Feb-2005, at 12:34, John Johnson wrote:> When I: > rake test_units > my tests pass. > When I > ruby test/unit/kits_test.rb > my tests pass. > When I > rake > my test results look like a ride at Six Flags (..EE.E.EE..) > or someone hit their thumb with a hammer (..F.FF.FFF..) > > Why the difference? >Well, JJ, here''s why :-) At the top of my test file I had: class KitsTest < Test::Unit::TestCase fixtures :kits fixtures :preferences This apparently fails when running tests in the default target of the Rakefile, but passes in the other scenarios listed above. After changing it to: class KitsTest < Test::Unit::TestCase fixtures :kits, :preferences Everything works as it should. Regards, JJ
* John Johnson <johnatl-ee4meeAH724@public.gmane.org> [0235 17:35]:> rake test_units > > ruby test/unit/kits_test.rb > > my tests pass.> rake > > my test results look like a ride at Six Flags (..EE.E.EE..) > or someone hit their thumb with a hammer (..F.FF.FFF..)> Why the difference?The only difference I can think of is that the default task runs the :clone_structure_to_test task before running the unit and functional tests. It''s not listed as a dependency, so that task doesn''t run if you just run ''rake test_units'' (:clone_structure_to_test destroys the test: database and copies its schema from the development: db, so without it the test db is ''stale'' - maybe your tests rely on something being there that isn''t added by the fixtures, hence the nil references in your error output?). (Next Rails release will have clone_structure_to_test as a dependency on both the unit and functional tests, so while you might get the same error at least it will be more consistent :) )> test_aaa_cutfiles_directories(KitsTest): > TypeError: cannot convert nil into String...> test_part(KitsTest): > NoMethodError: undefined method `part_number'' for nil:NilClass...> test_rawma(KitsTest): > NoMethodError: undefined method `description'' for nil:NilClass...> test_status_out_of_date(KitsTest): > NoMethodError: undefined method `+'' for nil:NilClass-- ''Interesting. No, wait, the other thing - Tedious.'' -- Bender Rasputin :: Jack of All Trades - Master of Nuns