Browse Source

Support clearer layout of '.and change(...).to(...)' in RSpec files

Ryan Lue 6 years ago
parent
commit
f84408dfc3
4 changed files with 10 additions and 8 deletions
  1. 10 2
      .rubocop.yml
  2. 0 2
      spec/lib/cache_spec.rb
  3. 0 2
      spec/models/http_log_spec.rb
  4. 0 2
      spec/models/user_spec.rb

+ 10 - 2
.rubocop.yml

@@ -234,8 +234,8 @@ Style/NumericPredicate:
 
 Lint/AmbiguousBlockAssociation:
   Description: >-
-                 Checks for ambiguous block association with method when param passed without
-                 parentheses.
+                 Checks for ambiguous block association with method when param
+                 passed without parentheses.
   StyleGuide: '#syntax'
   Enabled: true
   Exclude:
@@ -243,6 +243,14 @@ Lint/AmbiguousBlockAssociation:
     - "**/*_spec.rb"
     - "**/*_examples.rb"
 
+Layout/MultilineMethodCallIndentation:
+  Description: >-
+                 Checks the indentation of the method name part in method calls
+                 that span more than one line.
+  EnforcedStyle: indented
+  Include:
+    - "**/*_spec.rb"
+
 # Special exceptions
 
 Style/HashSyntax:

+ 0 - 2
spec/lib/cache_spec.rb

@@ -77,11 +77,9 @@ RSpec.describe Cache do
       Cache.write('123', 'some value')
       Cache.write('456', 'some value')
 
-      # rubocop:disable Layout/MultilineMethodCallIndentation
       expect { Cache.clear }
         .to change { Cache.get('123') }.to(nil)
         .and change { Cache.get('456') }.to(nil)
-      # rubocop:enable Layout/MultilineMethodCallIndentation
     end
 
     it 'is idempotent' do

+ 0 - 2
spec/models/http_log_spec.rb

@@ -9,11 +9,9 @@ RSpec.describe HttpLog do
       subject.request[:content]  = 'foo'.force_encoding('ascii-8bit')
       subject.response[:content] = 'bar'.force_encoding('ascii-8bit')
 
-      # rubocop:disable Layout/MultilineMethodCallIndentation
       expect { subject.save }
         .to change { subject.request[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
         .and change { subject.response[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
-      # rubocop:enable Layout/MultilineMethodCallIndentation
     end
   end
 end

+ 0 - 2
spec/models/user_spec.rb

@@ -111,11 +111,9 @@ RSpec.describe User do
         before { user } # create user
 
         it 'replaces CallerId record' do
-          # rubocop:disable Layout/MultilineMethodCallIndentation
           expect { user.update(phone: new_number) }
             .to change { Cti::CallerId.where(caller_id: orig_number).count }.by(-1)
             .and change { Cti::CallerId.where(caller_id: new_number).count }.by(1)
-          # rubocop:enable Layout/MultilineMethodCallIndentation
         end
       end
     end