diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-05 03:47:02 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-06-05 03:47:02 +0000 |
commit | 673daeabca18a3d96171c86bcdd03fd3d0091a73 (patch) | |
tree | 4c1c1a0e8a100716192be6a74679baff743651a5 /activerecord/test | |
parent | d6785e967433470cfe5eba72a72f6f01682282c0 (diff) | |
download | rails-673daeabca18a3d96171c86bcdd03fd3d0091a73.tar.gz rails-673daeabca18a3d96171c86bcdd03fd3d0091a73.tar.bz2 rails-673daeabca18a3d96171c86bcdd03fd3d0091a73.zip |
Fixtures: people(:technomancy, :josh) returns both fixtures. Closes #7880.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6940 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/associations_test.rb | 4 | ||||
-rwxr-xr-x | activerecord/test/fixtures_test.rb | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index fe2a720c32..9dec102e7c 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -743,9 +743,9 @@ class HasManyAssociationsTest < Test::Unit::TestCase def test_find_or_create number_of_clients = companies(:first_firm).clients.size the_client = companies(:first_firm).clients.find_or_create_by_name("Yet another client") - assert_equal number_of_clients + 1, companies(:first_firm, :refresh).clients.size + assert_equal number_of_clients + 1, companies(:first_firm, :reload).clients.size assert_equal the_client, companies(:first_firm).clients.find_or_create_by_name("Yet another client") - assert_equal number_of_clients + 1, companies(:first_firm, :refresh).clients.size + assert_equal number_of_clients + 1, companies(:first_firm, :reload).clients.size end def test_deleting diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb index d9973683cc..3e61c7b465 100755 --- a/activerecord/test/fixtures_test.rb +++ b/activerecord/test/fixtures_test.rb @@ -259,6 +259,19 @@ class FixturesWithoutInstantiationTest < Test::Unit::TestCase assert_equal "Jamis", developers(:jamis).name assert_equal 50, accounts(:signals37).credit_limit end + + def test_accessor_methods_with_multiple_args + assert_equal 2, topics(:first, :second).size + assert_raise(StandardError) { topics([:first, :second]) } + end + + uses_mocha 'reloading_fixtures_through_accessor_methods' do + def test_reloading_fixtures_through_accessor_methods + assert_equal "The First Topic", topics(:first).title + @loaded_fixtures['topics']['first'].expects(:find).returns(stub(:title => "Fresh Topic!")) + assert_equal "Fresh Topic!", topics(:first, true).title + end + end end |