From c34d14776719fc8c77277efa31c90f92c8b69a14 Mon Sep 17 00:00:00 2001 From: eileencodes Date: Fri, 3 Apr 2020 14:33:14 -0400 Subject: [PATCH] Add regression test for enum getter/setter behavior Testing that when you set a symbol for an enum type, you get a string back and that when you set a string you also get a string back. --- activerecord/test/cases/enum_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index d5ef77330d..b545a406f6 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -133,6 +133,16 @@ class EnumTest < ActiveRecord::TestCase assert_equal old_language, @book.changed_attributes[:language] end + test "enum value after write symbol" do + @book.status = :proposed + assert_equal "proposed", @book.status + end + + test "enum value after write string" do + @book.status = "proposed" + assert_equal "proposed", @book.status + end + test "enum changes" do old_status = @book.status old_language = @book.language