I have a few test cases, using unit test, I am new to testing but I don't 
understand why, if fixtures are loaded and validations are in place (in my 
case, I am testing that identical objects should not be saved to the 
database) -- and I know that it works, because doing the test through the UI 
gives the right behavious, but the test does not behave as the actual 
application does, and should...

TEST REPORT:

  2) Failure:
test_should_have_loaded_this_fixture_item_into_the_test_database_already(CollectionTest)
 
[test/unit/collection_test.rb:16]:
Should not be valid

  
3) Failure:
test_should_not_save_with_duplicate_name_property(CollectionTest) 
[test/unit/collection_test.rb:11]:
Saved a collection with a duplicate name

TEST CODE:

  test "should not save with duplicate name property" do
    c = collections(:one)
    assert !c.save, 'Saved a collection with a duplicate name'
  end

  test "should have loaded this fixture item into the test database already" 
do
    c = collections(:one)
    assert !c.valid?, 'Should not be valid'
    assert c.save, 'Did not save first item'
    c2 = collections(:one)
    assert_equal c, c2, "Two items are not equal"
    assert !c2.save, 'Saved duplicate item as well'
  end

-- 
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