diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-08-20 02:57:02 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-20 02:57:02 +0900 |
commit | f0f74a76db7f0785c0ba69fd57e2b68dd8c0ad34 (patch) | |
tree | c6fc0b153652d8132b18078d17c79a4102fa0ea4 /activerecord/test/cases/associations | |
parent | cc14bf77ca31b6873756fad5b4c1324fb6663fe1 (diff) | |
parent | d510295b31dd6311f88e2eb2c76b12b1b0ab960a (diff) | |
download | rails-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/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_one_associations_test.rb | 3 |
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 |