diff options
author | Amr Tamimi <amrnt0@gmail.com> | 2013-12-20 14:12:59 +0200 |
---|---|---|
committer | Amr Tamimi <amrnt0@gmail.com> | 2014-01-01 01:48:15 +0200 |
commit | e0ad9ae27e9b6dc5460d91761ce6fbd7a92b08f0 (patch) | |
tree | 9e8cefb5be21412de34e786dba59e48721c9f4ff /activerecord/test/cases | |
parent | ec466998387453203444f4c6a24eb92eb204d27a (diff) | |
download | rails-e0ad9ae27e9b6dc5460d91761ce6fbd7a92b08f0.tar.gz rails-e0ad9ae27e9b6dc5460d91761ce6fbd7a92b08f0.tar.bz2 rails-e0ad9ae27e9b6dc5460d91761ce6fbd7a92b08f0.zip |
Add the ability to nullify the `enum` column
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/enum_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index 35e8a98156..017edcb194 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -58,6 +58,21 @@ class EnumTest < ActiveRecord::TestCase assert_equal "'unknown' is not a valid status", e.message end + test "assign nil value" do + @book.status = nil + assert @book.status.nil? + end + + test "assign empty string value" do + @book.status = '' + assert @book.status.nil? + end + + test "assign long empty string value" do + @book.status = ' ' + assert @book.status.nil? + end + test "constant to access the mapping" do assert_equal 0, Book::STATUS[:proposed] assert_equal 1, Book::STATUS["written"] |