diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-29 13:57:13 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-29 13:57:47 -0700 |
commit | 38dd7939e67c127ebbd6cfbb81107b41474d744a (patch) | |
tree | 67b63ddadaceaae00f4fde7c3d15a8cd83576804 /activerecord/test | |
parent | 6296c09e5b915c522c4127844c623afb44c62e1a (diff) | |
download | rails-38dd7939e67c127ebbd6cfbb81107b41474d744a.tar.gz rails-38dd7939e67c127ebbd6cfbb81107b41474d744a.tar.bz2 rails-38dd7939e67c127ebbd6cfbb81107b41474d744a.zip |
Post.all.or(anything) == Post.all
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation/or_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/relation/where_clause_test.rb | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/test/cases/relation/or_test.rb b/activerecord/test/cases/relation/or_test.rb index 1515b9c454..2006fc9611 100644 --- a/activerecord/test/cases/relation/or_test.rb +++ b/activerecord/test/cases/relation/or_test.rb @@ -35,12 +35,12 @@ module ActiveRecord end def test_or_without_left_where - expected = Post.where('id = 1') + expected = Post.all assert_equal expected, Post.or(Post.where('id = 1')).to_a end def test_or_without_right_where - expected = Post.where('id = 1') + expected = Post.all assert_equal expected, Post.where('id = 1').or(Post.all).to_a end diff --git a/activerecord/test/cases/relation/where_clause_test.rb b/activerecord/test/cases/relation/where_clause_test.rb index 7325aec0a9..c20ed94d90 100644 --- a/activerecord/test/cases/relation/where_clause_test.rb +++ b/activerecord/test/cases/relation/where_clause_test.rb @@ -158,11 +158,11 @@ class ActiveRecord::Relation assert_equal expected_binds, where_clause.or(other_clause).binds end - test "or does nothing with an empty where clause" do + test "or returns an empty where clause when either side is empty" do where_clause = WhereClause.new([table["id"].eq(bind_param)], [attribute("id", 1)]) - assert_equal where_clause, where_clause.or(WhereClause.empty) - assert_equal where_clause, WhereClause.empty.or(where_clause) + assert_equal WhereClause.empty, where_clause.or(WhereClause.empty) + assert_equal WhereClause.empty, WhereClause.empty.or(where_clause) end private |