diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-09-06 10:45:11 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-09-06 10:45:11 +0300 |
commit | 3ff54a959d631740f9ad31727048cb175f700c8b (patch) | |
tree | d075af854e4d6089c158ff3012098b8bebab0a0a /spec | |
parent | 772e482b3b2f7cd8d04177d36c7603ef4439ebb3 (diff) | |
parent | 24fc23771029eeb0d5822619c26bea47ea5aaed8 (diff) |
Merge branch 'rs-line-break-around-conditional-cop' into 'master'
Fix LineBreakAroundConditionalBlock cop for a conditional after rescue
See merge request gitlab-org/gitlab-ce!21535
Diffstat (limited to 'spec')
-rw-r--r-- | spec/rubocop/cop/line_break_around_conditional_block_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/rubocop/cop/line_break_around_conditional_block_spec.rb b/spec/rubocop/cop/line_break_around_conditional_block_spec.rb index 03eeffe6483..892b393c307 100644 --- a/spec/rubocop/cop/line_break_around_conditional_block_spec.rb +++ b/spec/rubocop/cop/line_break_around_conditional_block_spec.rb @@ -328,6 +328,22 @@ describe RuboCop::Cop::LineBreakAroundConditionalBlock do expect(cop.offenses).to be_empty end + it "doesn't flag violation for #{conditional} preceded by a rescue" do + source = <<~RUBY + def a_method + do_something + rescue + #{conditional} condition + do_something + end + end + RUBY + + inspect_source(source) + + expect(cop.offenses).to be_empty + end + it "doesn't flag violation for #{conditional} followed by a rescue" do source = <<~RUBY def a_method |