aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-04-13 16:17:28 +0100
committerJon Leighton <j@jonathanleighton.com>2012-04-13 16:17:52 +0100
commit60ac540053d5b5d32d7b349bae03f4d874a9826e (patch)
tree79cd22e0090a29077ec72b109c57053e2580232a /activerecord/test/cases/relation_test.rb
parent6311975fb3c02f50730fd1e11b8dba8dd9c05306 (diff)
downloadrails-60ac540053d5b5d32d7b349bae03f4d874a9826e.tar.gz
rails-60ac540053d5b5d32d7b349bae03f4d874a9826e.tar.bz2
rails-60ac540053d5b5d32d7b349bae03f4d874a9826e.zip
now we can just manipulate the values hash in #only and #except
Diffstat (limited to 'activerecord/test/cases/relation_test.rb')
-rw-r--r--activerecord/test/cases/relation_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb
index c636284b8f..719b96fa0f 100644
--- a/activerecord/test/cases/relation_test.rb
+++ b/activerecord/test/cases/relation_test.rb
@@ -149,6 +149,19 @@ module ActiveRecord
test 'merging a hash with unknown keys raises' do
assert_raises(ArgumentError) { Relation::HashMerger.new(nil, omg: 'lol') }
end
+
+ test '#values returns a dup of the values' do
+ relation = Relation.new(:a, :b).where! :foo
+ values = relation.values
+
+ values[:where] = nil
+ assert_not_nil relation.where_values
+ end
+
+ test 'relations can be created with a values hash' do
+ relation = Relation.new(:a, :b, where: [:foo])
+ assert_equal [:foo], relation.where_values
+ end
end
class RelationMutationTest < ActiveSupport::TestCase