aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-11-30 15:44:30 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-11-30 15:44:30 -0800
commitb2e7d1e41ec1d40c35aeb201720dfec413c8f95a (patch)
tree40ee3a8af7f5f4b01df1f6a811aa8c8f3507318b /activerecord/test/cases
parent7ff980031bc49fe332d3b9ea8fbc6c2aae935db5 (diff)
downloadrails-b2e7d1e41ec1d40c35aeb201720dfec413c8f95a.tar.gz
rails-b2e7d1e41ec1d40c35aeb201720dfec413c8f95a.tar.bz2
rails-b2e7d1e41ec1d40c35aeb201720dfec413c8f95a.zip
surrounding scope_for_create behavior
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/relation_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb
index 02de0398aa..31d2020acd 100644
--- a/activerecord/test/cases/relation_test.rb
+++ b/activerecord/test/cases/relation_test.rb
@@ -98,5 +98,19 @@ module ActiveRecord
relation = Relation.new :a, :b
assert_equal({}, relation.scope_for_create)
end
+
+ def test_create_with_value
+ relation = Relation.new Post, Post.arel_table
+ hash = { :hello => 'world' }
+ relation.create_with_value = hash
+ assert_equal hash, relation.scope_for_create
+ end
+
+ def test_create_with_value_with_wheres
+ relation = Relation.new Post, Post.arel_table
+ relation.where_values << relation.table[:id].eq(10)
+ relation.create_with_value = {:hello => 'world'}
+ assert_equal({:hello => 'world', :id => 10}, relation.scope_for_create)
+ end
end
end