From 10110e03cb2de1f8cdfb192a8f46090e5b19ef08 Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 15 Jan 2019 13:17:13 +0100 Subject: [PATCH] Refactoring: Rails/SkipsModelValidations cop is unnecessarily active for RSpec files. --- .rubocop.yml | 2 ++ spec/db/migrate/check_for_object_attributes_spec.rb | 5 +---- spec/requests/ticket_spec.rb | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index cc625b5b5..ae1736c76 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -175,6 +175,8 @@ Rails/SkipsModelValidations: Enabled: true Exclude: - test/**/* + - "**/*_spec.rb" + - "**/*_examples.rb" Style/ClassAndModuleChildren: Description: 'Checks style of children classes and modules.' diff --git a/spec/db/migrate/check_for_object_attributes_spec.rb b/spec/db/migrate/check_for_object_attributes_spec.rb index a4bb3c433..6dd8ba0be 100644 --- a/spec/db/migrate/check_for_object_attributes_spec.rb +++ b/spec/db/migrate/check_for_object_attributes_spec.rb @@ -102,11 +102,8 @@ RSpec.describe CheckForObjectAttributes, type: :db_migration do type: 'text', # to trigger a #save in the migration. maxlength: 255, } - - # rubocop:disable Rails/SkipsModelValidations create(:object_manager_attribute_text) .update_columns(data_option: wrong) - # rubocop:enable Rails/SkipsModelValidations expect { migrate }.not_to raise_error end @@ -117,7 +114,7 @@ RSpec.describe CheckForObjectAttributes, type: :db_migration do context 'for interger attributes' do it 'missing :min and :max' do 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 diff --git a/spec/requests/ticket_spec.rb b/spec/requests/ticket_spec.rb index 79eebf696..a9fecc5db 100644 --- a/spec/requests/ticket_spec.rb +++ b/spec/requests/ticket_spec.rb @@ -2120,7 +2120,7 @@ RSpec.describe 'Ticket', type: :request do travel 2.minutes ticket3 travel 2.minutes - ticket2.touch # rubocop:disable Rails/SkipsModelValidations + ticket2.touch end # https://github.com/zammad/zammad/issues/2296