On 20 November 2010 16:07, Neil Bye <[email protected]> wrote:
> Colin Law wrote in post #962795:
>
>> class AnnnetteTest < ActiveSupport::TestCase
>>  def test_should_be_valid_with_story
>> a = Annnette.new(:story => 'Neil')
>> assert_nil a.errors.on(:story)
>> end
>>
>> Colin
>
> OK that worked so I changed the test in my other app (the one that
> matters) to
>
> class StoryTest < ActiveSupport::TestCase
>  def test_should_be_valid_with_author
>    s = Story.create(:author => 'neil', :title => 'Story', :body =>
> 'test')

What is that create doing there?

>    assert s.errors.on(:author)

That should be assert_nil if you expect no errors.

>  end
>
> When I run the test I still get
>
> n...@baby6:~/********$ rake test:units
> (in /home/neil/********)
> /usr/bin/ruby1.8 -I"lib:test"
> "/usr/lib/ruby/1.8/rake/rake_test_loader.rb" "test/unit/comment_test.rb"
> "test/unit/user_mailer_test.rb" "test/unit/friendship_test.rb"
> "test/unit/helpers/friendship_helper_test.rb"
> "test/unit/helpers/profile_helper_test.rb"
> "test/unit/helpers/community_helper_test.rb" "test/unit/user_test.rb"
> "test/unit/story_test.rb"
> ruby index.rb <data dir> <index dir>
> rake aborted!
> Command failed with status (1): [/usr/bin/ruby1.8 -I"lib:test"
> "/usr/lib/ru...]

That is a completely different error, it is rake that is aborting, not
the test that is failing (that is why it says 'rake aborted').  It has
not got as far as running the tests, so the content of the tests is
immaterial.  Show us the rest of the message - but first look through
it yourself and see if you can see what is the problem, or at least
some hint as to the problem.  The next bit that you have not showed us
may well be the key.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to