From 0789d093f3473dd9bc95e387cc519072760a6759 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 16 Aug 2017 17:48:44 +0900 Subject: Fix test "_before_type_cast" for enum (#29004) Since c51f9b61 changed the "_before_type_cast" expectation for enum. --- activerecord/test/cases/enum_test.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'activerecord') 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 -- cgit v1.2.3