diff options
author | keepcosmos <keepcosmos@gmail.com> | 2015-03-05 21:39:03 +0900 |
---|---|---|
committer | keepcosmos <keepcosmos@gmail.com> | 2015-03-05 21:39:03 +0900 |
commit | 392470004c97c5eca27924250de47cad34730d22 (patch) | |
tree | a67de506fbea1bfa49909760d5add7c78aac8ce4 /activerecord/test | |
parent | 5d8090e74db76b77e8ea9216d02274b6ff4aec9f (diff) | |
download | rails-392470004c97c5eca27924250de47cad34730d22.tar.gz rails-392470004c97c5eca27924250de47cad34730d22.tar.bz2 rails-392470004c97c5eca27924250de47cad34730d22.zip |
add ActiveRecord::Enum testcase about multiple enums declaring at a time
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/enum_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index 3b7bbcf47a..eea184e530 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -341,4 +341,18 @@ class EnumTest < ActiveRecord::TestCase book2.status = :uploaded assert_equal ['drafted', 'uploaded'], book2.status_change end + + test "declare multiple enums at a time" do + klass = Class.new(ActiveRecord::Base) do + self.table_name = "books" + enum status: [:proposed, :written, :published], + nullable_status: [:single, :married] + end + + book1 = klass.proposed.create! + assert book1.proposed? + + book2 = klass.single.create! + assert book2.single? + end end |