aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2017-05-28 23:38:09 +0930
committerGitHub <noreply@github.com>2017-05-28 23:38:09 +0930
commit7eb66b1617d9bda33860ce9869b07ff1a98fbef3 (patch)
treeb7e6a91777d633b9e9809733e5ce1b4997b0dfe1 /activerecord/test/cases
parentaa3f4036c144ba2ab46d0ebac7a41bf18c8b6f47 (diff)
parent76e34405abc072d778f716ce97991e91ad336030 (diff)
downloadrails-7eb66b1617d9bda33860ce9869b07ff1a98fbef3.tar.gz
rails-7eb66b1617d9bda33860ce9869b07ff1a98fbef3.tar.bz2
rails-7eb66b1617d9bda33860ce9869b07ff1a98fbef3.zip
Merge pull request #28969 from kamipo/refactor_enum_to_use_value_instead_of_label
Refactor enum to use `value` instead of `label` in the scope
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/enum_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb
index 7f63bb2473..db3da53487 100644
--- a/activerecord/test/cases/enum_test.rb
+++ b/activerecord/test/cases/enum_test.rb
@@ -6,7 +6,6 @@ class EnumTest < ActiveRecord::TestCase
fixtures :books, :authors
setup do
- @author = authors(:david)
@book = books(:awdr)
end
@@ -39,6 +38,8 @@ class EnumTest < ActiveRecord::TestCase
assert_equal @book, Book.author_visibility_visible.first
assert_equal @book, Book.illustrator_visibility_visible.first
assert_equal @book, Book.medium_to_read.first
+ assert_equal books(:ddd), Book.forgotten.first
+ assert_equal books(:rfr), authors(:david).unpublished_books.first
end
test "find via where with values" do
@@ -57,7 +58,6 @@ 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