1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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.
This commit is contained in:
eileencodes 2020-04-03 14:33:14 -04:00
parent f1a2c021e3
commit c34d147767
No known key found for this signature in database
GPG key ID: BA5C575120BBE8DF

View file

@ -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