diff options
author | Jon Moss <me@jonathanmoss.me> | 2017-05-02 15:37:06 -0400 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2017-05-02 17:25:38 -0400 |
commit | 8d64cd86db1bc5e1ad119d13eb14f94726a0765f (patch) | |
tree | 8e3c6148597402a3dd17f098481ef8631b1c72f0 /activerecord/test/cases | |
parent | 39a2e1465e15d1da56ba1f4ed14fd38740bd86d4 (diff) | |
download | rails-8d64cd86db1bc5e1ad119d13eb14f94726a0765f.tar.gz rails-8d64cd86db1bc5e1ad119d13eb14f94726a0765f.tar.bz2 rails-8d64cd86db1bc5e1ad119d13eb14f94726a0765f.zip |
Add type caster to `RuntimeReflection#alias_name`
Since we have been using this `Arel::Table` since 111ccc832bc977b15af12c14e7ca078dad2d4373,
in order to properly handle queries, it's important that we properly type cast arguments.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/enum_test.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index b7641fcf32..7f63bb2473 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -1,10 +1,12 @@ require "cases/helper" +require "models/author" require "models/book" class EnumTest < ActiveRecord::TestCase - fixtures :books + fixtures :books, :authors setup do + @author = authors(:david) @book = books(:awdr) end @@ -55,6 +57,7 @@ class EnumTest < ActiveRecord::TestCase assert_not_equal @book, Book.where(status: :written).first assert_equal @book, Book.where(status: [:published]).first assert_not_equal @book, Book.where(status: [:written]).first + assert_not @author.unpublished_books.include?(@book) assert_not_equal @book, Book.where.not(status: :published).first assert_equal @book, Book.where.not(status: :written).first end |