Created
November 18, 2008 19:40
-
-
Save macournoyer/26234 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
has_many :cats | |
end | |
class UserTest < Test::Unit::TestCase | |
# Useless | |
should_have_many :cats | |
# Useful | |
def test_should_add_a_cat | |
user = User.create | |
cat = user.cats.create(:name => "Bob") | |
assert_valid cat | |
assert_equal user, cat.reload.user | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment