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:
parent
f1a2c021e3
commit
c34d147767
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue