1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

oops, 'format' is not a real enum

This commit is contained in:
Godfrey Chan 2015-02-13 16:40:43 -08:00
parent 91f431972b
commit 3dfd1bab6a

View file

@ -33,12 +33,12 @@ class EnumTest < ActiveRecord::TestCase
end
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
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("status <> ?", :proposed).first
assert_equal @book, Book.where("status <> ?", :written).first
end
test "find via where with strings" do
@ -46,8 +46,8 @@ class EnumTest < ActiveRecord::TestCase
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
refute_equal @book, Book.where("status <> ?", "proposed").first
assert_equal @book, Book.where("status <> ?", "written").first
end
test "update by declaration" do