diff options
author | Alfred Dominic <mailme@alfiemax.com> | 2018-12-03 15:22:59 +0530 |
---|---|---|
committer | Alfred Dominic <mailme@alfiemax.com> | 2018-12-04 15:56:31 +0530 |
commit | c4d157aafe05dde4a19dff2d95165e4022627608 (patch) | |
tree | a7f1276b62d77eb62956fc8aaf1bcfd0a8d1a97b /activerecord/test | |
parent | 609c58bfa6df58b88e3eadebb1f1d49354541d24 (diff) | |
download | rails-c4d157aafe05dde4a19dff2d95165e4022627608.tar.gz rails-c4d157aafe05dde4a19dff2d95165e4022627608.tar.bz2 rails-c4d157aafe05dde4a19dff2d95165e4022627608.zip |
option to disable scopes that `ActiveRecord.enum` generates by default
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/enum_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index fef06e6edd..8a0f6f6df1 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -551,4 +551,13 @@ class EnumTest < ActiveRecord::TestCase test "data type of Enum type" do assert_equal :integer, Book.type_for_attribute("status").type end + + test "scopes can be disabled" do + klass = Class.new(ActiveRecord::Base) do + self.table_name = "books" + enum status: [:proposed, :written], _scopes: false + end + + assert_raises(NoMethodError) { klass.proposed } + end end |