diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-08-16 17:48:44 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 17:48:44 +0900 |
commit | 0789d093f3473dd9bc95e387cc519072760a6759 (patch) | |
tree | 5b045858fd93dde549de0564f5f32face0ea2084 /activerecord | |
parent | 11fd246d8f6406aa5165ebf45ca8f17c67716f7e (diff) | |
download | rails-0789d093f3473dd9bc95e387cc519072760a6759.tar.gz rails-0789d093f3473dd9bc95e387cc519072760a6759.tar.bz2 rails-0789d093f3473dd9bc95e387cc519072760a6759.zip |
Fix test "_before_type_cast" for enum (#29004)
Since c51f9b61 changed the "_before_type_cast" expectation for enum.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/enum_test.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index abbc011b34..68a1190d68 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -255,12 +255,14 @@ class EnumTest < ActiveRecord::TestCase assert Book.illustrator_visibility_invisible.create.illustrator_visibility_invisible? end - test "_before_type_cast returns the enum label (required for form fields)" do - if @book.status_came_from_user? - assert_equal "published", @book.status_before_type_cast - else - assert_equal "published", @book.status - end + test "_before_type_cast" do + assert_equal 2, @book.status_before_type_cast + assert_equal "published", @book.status + + @book.status = "published" + + assert_equal "published", @book.status_before_type_cast + assert_equal "published", @book.status end test "reserved enum names" do |