aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-11-30 15:45:32 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-11-30 15:45:32 -0800
commitb293ab7c618f65e06371e9ae7b00fe2a65082209 (patch)
tree9fb9c3b087e1fcf9e7dff089f0d80293f97af109 /activerecord/test
parentb2e7d1e41ec1d40c35aeb201720dfec413c8f95a (diff)
downloadrails-b293ab7c618f65e06371e9ae7b00fe2a65082209.tar.gz
rails-b293ab7c618f65e06371e9ae7b00fe2a65082209.tar.bz2
rails-b293ab7c618f65e06371e9ae7b00fe2a65082209.zip
making sure scope_for_create value is cached
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relation_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb
index 31d2020acd..3cc31b3db0 100644
--- a/activerecord/test/cases/relation_test.rb
+++ b/activerecord/test/cases/relation_test.rb
@@ -112,5 +112,17 @@ module ActiveRecord
relation.create_with_value = {:hello => 'world'}
assert_equal({:hello => 'world', :id => 10}, relation.scope_for_create)
end
+
+ # FIXME: is this really wanted or expected behavior?
+ def test_scope_for_create_is_cached
+ relation = Relation.new Post, Post.arel_table
+ assert_equal({}, relation.scope_for_create)
+
+ relation.where_values << relation.table[:id].eq(10)
+ assert_equal({}, relation.scope_for_create)
+
+ relation.create_with_value = {:hello => 'world'}
+ assert_equal({}, relation.scope_for_create)
+ end
end
end