diff options
-rw-r--r-- | activerecord/test/cases/relation_test.rb | 14 |
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 |