Refactoring: Rails/SkipsModelValidations cop is unnecessarily active for RSpec files.

This commit is contained in:
Thorsten Eckel 2019-01-15 13:17:13 +01:00
parent 6870c11103
commit 10110e03cb
3 changed files with 4 additions and 5 deletions

View file

@ -175,6 +175,8 @@ Rails/SkipsModelValidations:
Enabled: true Enabled: true
Exclude: Exclude:
- test/**/* - test/**/*
- "**/*_spec.rb"
- "**/*_examples.rb"
Style/ClassAndModuleChildren: Style/ClassAndModuleChildren:
Description: 'Checks style of children classes and modules.' Description: 'Checks style of children classes and modules.'

View file

@ -102,11 +102,8 @@ RSpec.describe CheckForObjectAttributes, type: :db_migration do
type: 'text', # to trigger a #save in the migration. type: 'text', # to trigger a #save in the migration.
maxlength: 255, maxlength: 255,
} }
# rubocop:disable Rails/SkipsModelValidations
create(:object_manager_attribute_text) create(:object_manager_attribute_text)
.update_columns(data_option: wrong) .update_columns(data_option: wrong)
# rubocop:enable Rails/SkipsModelValidations
expect { migrate }.not_to raise_error expect { migrate }.not_to raise_error
end end
@ -117,7 +114,7 @@ RSpec.describe CheckForObjectAttributes, type: :db_migration do
context 'for interger attributes' do context 'for interger attributes' do
it 'missing :min and :max' do it 'missing :min and :max' do
attribute = create(:object_manager_attribute_integer) attribute = create(:object_manager_attribute_integer)
attribute.update_columns(data_option: {}) # rubocop:disable Rails/SkipsModelValidations attribute.update_columns(data_option: {})
expect { migrate }.not_to raise_error expect { migrate }.not_to raise_error

View file

@ -2120,7 +2120,7 @@ RSpec.describe 'Ticket', type: :request do
travel 2.minutes travel 2.minutes
ticket3 ticket3
travel 2.minutes travel 2.minutes
ticket2.touch # rubocop:disable Rails/SkipsModelValidations ticket2.touch
end end
# https://github.com/zammad/zammad/issues/2296 # https://github.com/zammad/zammad/issues/2296