aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_one_associations_test.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-11-10 05:41:58 -0800
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-11-10 05:41:58 -0800
commite803f3a521d34cdefa1d248beba34e2a9060603d (patch)
treed6a2504deb525cf8f4cac8deca8cfa801b58e849 /activerecord/test/cases/associations/has_one_associations_test.rb
parenta002442fbce098ce5ae9597784ab2755bdad111a (diff)
parent3cb0f3feed7130225cc169c2b1476acf0b11e066 (diff)
downloadrails-e803f3a521d34cdefa1d248beba34e2a9060603d.tar.gz
rails-e803f3a521d34cdefa1d248beba34e2a9060603d.tar.bz2
rails-e803f3a521d34cdefa1d248beba34e2a9060603d.zip
Merge pull request #8154 from bogdan/has_one_association_performance
Remove unwanted transaction when has one association is built
Diffstat (limited to 'activerecord/test/cases/associations/has_one_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_one_associations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb
index 2d3cb654df..ea1cfa0805 100644
--- a/activerecord/test/cases/associations/has_one_associations_test.rb
+++ b/activerecord/test/cases/associations/has_one_associations_test.rb
@@ -206,6 +206,12 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
assert_equal account, firm.account
end
+ def test_build_association_dont_create_transaction
+ assert_no_queries {
+ Firm.new.build_account
+ }
+ end
+
def test_build_and_create_should_not_happen_within_scope
pirate = pirates(:blackbeard)
scoped_count = pirate.association(:foo_bulb).scope.where_values.count