diff options
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/enum_test.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index ed568413a2..ed1585da1a 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -32,9 +32,22 @@ class EnumTest < ActiveRecord::TestCase assert Book.where(status: Book.statuses[:proposed]).build.proposed? end - test "find via where" do + test "find via where with symbols" do + assert_equal @book, Book.where(format: :paperback).first + refute_equal @book, Book.where(format: :ebook).first + assert_equal @book, Book.where(format: [:paperback]).first + refute_equal @book, Book.where(format: [:ebook]).first + refute_equal @book, Book.where("format <> ?", :paperback).first + assert_equal @book, Book.where("format <> ?", :ebook).first + end + + test "find via where with strings" do assert_equal @book, Book.where(status: "proposed").first refute_equal @book, Book.where(status: "written").first + assert_equal @book, Book.where(status: ["proposed"]).first + refute_equal @book, Book.where(status: ["written"]).first + refute_equal @book, Book.where("format <> ?", "paperback").first + assert_equal @book, Book.where("format <> ?", "ebook").first end test "update by declaration" do |