aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/enum_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases/enum_test.rb')
-rw-r--r--activerecord/test/cases/enum_test.rb14
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