Browse Source

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

Thorsten Eckel 6 years ago
parent
commit
10110e03cb

+ 2 - 0
.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.'

+ 1 - 4
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
 

+ 1 - 1
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