Support clearer layout of '.and change(...).to(...)' in RSpec files
This commit is contained in:
parent
0e6a6ff1fd
commit
f84408dfc3
4 changed files with 10 additions and 8 deletions
12
.rubocop.yml
12
.rubocop.yml
|
@ -234,8 +234,8 @@ Style/NumericPredicate:
|
||||||
|
|
||||||
Lint/AmbiguousBlockAssociation:
|
Lint/AmbiguousBlockAssociation:
|
||||||
Description: >-
|
Description: >-
|
||||||
Checks for ambiguous block association with method when param passed without
|
Checks for ambiguous block association with method when param
|
||||||
parentheses.
|
passed without parentheses.
|
||||||
StyleGuide: '#syntax'
|
StyleGuide: '#syntax'
|
||||||
Enabled: true
|
Enabled: true
|
||||||
Exclude:
|
Exclude:
|
||||||
|
@ -243,6 +243,14 @@ Lint/AmbiguousBlockAssociation:
|
||||||
- "**/*_spec.rb"
|
- "**/*_spec.rb"
|
||||||
- "**/*_examples.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
|
# Special exceptions
|
||||||
|
|
||||||
Style/HashSyntax:
|
Style/HashSyntax:
|
||||||
|
|
|
@ -77,11 +77,9 @@ RSpec.describe Cache do
|
||||||
Cache.write('123', 'some value')
|
Cache.write('123', 'some value')
|
||||||
Cache.write('456', 'some value')
|
Cache.write('456', 'some value')
|
||||||
|
|
||||||
# rubocop:disable Layout/MultilineMethodCallIndentation
|
|
||||||
expect { Cache.clear }
|
expect { Cache.clear }
|
||||||
.to change { Cache.get('123') }.to(nil)
|
.to change { Cache.get('123') }.to(nil)
|
||||||
.and change { Cache.get('456') }.to(nil)
|
.and change { Cache.get('456') }.to(nil)
|
||||||
# rubocop:enable Layout/MultilineMethodCallIndentation
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is idempotent' do
|
it 'is idempotent' do
|
||||||
|
|
|
@ -9,11 +9,9 @@ RSpec.describe HttpLog do
|
||||||
subject.request[:content] = 'foo'.force_encoding('ascii-8bit')
|
subject.request[:content] = 'foo'.force_encoding('ascii-8bit')
|
||||||
subject.response[:content] = 'bar'.force_encoding('ascii-8bit')
|
subject.response[:content] = 'bar'.force_encoding('ascii-8bit')
|
||||||
|
|
||||||
# rubocop:disable Layout/MultilineMethodCallIndentation
|
|
||||||
expect { subject.save }
|
expect { subject.save }
|
||||||
.to change { subject.request[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
|
.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')
|
.and change { subject.response[:content].encoding.name }.from('ASCII-8BIT').to('UTF-8')
|
||||||
# rubocop:enable Layout/MultilineMethodCallIndentation
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -111,11 +111,9 @@ RSpec.describe User do
|
||||||
before { user } # create user
|
before { user } # create user
|
||||||
|
|
||||||
it 'replaces CallerId record' do
|
it 'replaces CallerId record' do
|
||||||
# rubocop:disable Layout/MultilineMethodCallIndentation
|
|
||||||
expect { user.update(phone: new_number) }
|
expect { user.update(phone: new_number) }
|
||||||
.to change { Cti::CallerId.where(caller_id: orig_number).count }.by(-1)
|
.to change { Cti::CallerId.where(caller_id: orig_number).count }.by(-1)
|
||||||
.and change { Cti::CallerId.where(caller_id: new_number).count }.by(1)
|
.and change { Cti::CallerId.where(caller_id: new_number).count }.by(1)
|
||||||
# rubocop:enable Layout/MultilineMethodCallIndentation
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue