aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/enum_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-05-11 04:20:53 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-05-31 17:16:11 +0900
commit67a4a9feb9d31747db8a9ce5fcfe61d6067dd625 (patch)
treef9617483d55b26143da444205509173241b605b0 /activerecord/test/cases/enum_test.rb
parent7c800fe5e338540ef195f071a7f3604ed4197f3f (diff)
downloadrails-67a4a9feb9d31747db8a9ce5fcfe61d6067dd625.tar.gz
rails-67a4a9feb9d31747db8a9ce5fcfe61d6067dd625.tar.bz2
rails-67a4a9feb9d31747db8a9ce5fcfe61d6067dd625.zip
Prevent making bind param if casted value is nil
If casted value is nil, generated SQL should be `IS NULL`. But currently it is generated as `= NULL`. To prevent this behavior, avoid making bind param if casted value is nil. Fixes #28945.
Diffstat (limited to 'activerecord/test/cases/enum_test.rb')
-rw-r--r--activerecord/test/cases/enum_test.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb
index db3da53487..4ef9a125e6 100644
--- a/activerecord/test/cases/enum_test.rb
+++ b/activerecord/test/cases/enum_test.rb
@@ -60,6 +60,7 @@ class EnumTest < ActiveRecord::TestCase
assert_not_equal @book, Book.where(status: [:written]).first
assert_not_equal @book, Book.where.not(status: :published).first
assert_equal @book, Book.where.not(status: :written).first
+ assert_equal books(:ddd), Book.where(read_status: :forgotten).first
end
test "find via where with strings" do
@@ -69,6 +70,7 @@ class EnumTest < ActiveRecord::TestCase
assert_not_equal @book, Book.where(status: ["written"]).first
assert_not_equal @book, Book.where.not(status: "published").first
assert_equal @book, Book.where.not(status: "written").first
+ assert_equal books(:ddd), Book.where(read_status: "forgotten").first
end
test "build from scope" do