aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-08-20 02:57:02 +0900
committerGitHub <noreply@github.com>2018-08-20 02:57:02 +0900
commitf0f74a76db7f0785c0ba69fd57e2b68dd8c0ad34 (patch)
treec6fc0b153652d8132b18078d17c79a4102fa0ea4 /activerecord
parentcc14bf77ca31b6873756fad5b4c1324fb6663fe1 (diff)
parentd510295b31dd6311f88e2eb2c76b12b1b0ab960a (diff)
downloadrails-f0f74a76db7f0785c0ba69fd57e2b68dd8c0ad34.tar.gz
rails-f0f74a76db7f0785c0ba69fd57e2b68dd8c0ad34.tar.bz2
rails-f0f74a76db7f0785c0ba69fd57e2b68dd8c0ad34.zip
Merge pull request #33657 from jychen7/fix-test-association-enum
Improve test case to test enum correctly
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/associations/has_one_associations_test.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb
index d7e898a1c0..9eea34d2b9 100644
--- a/activerecord/test/cases/associations/has_one_associations_test.rb
+++ b/activerecord/test/cases/associations/has_one_associations_test.rb
@@ -661,6 +661,8 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
self.table_name = "books"
belongs_to :author, class_name: "SpecialAuthor"
has_one :subscription, class_name: "SpecialSupscription", foreign_key: "subscriber_id"
+
+ enum status: [:proposed, :written, :published]
end
class SpecialAuthor < ActiveRecord::Base
@@ -678,6 +680,7 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
book = SpecialBook.create!(status: "published")
author.book = book
+ assert_equal "published", book.status
assert_not_equal 0, SpecialAuthor.joins(:book).where(books: { status: "published" }).count
end