Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-09-05 19:34:11 +0300
committerRobert Speicher <rspeicher@gmail.com>2018-09-05 19:34:11 +0300
commit24fc23771029eeb0d5822619c26bea47ea5aaed8 (patch)
treed0be249e38608cb2c6c6e764b283df49af7a01d9 /spec/rubocop
parentba99dfcde262c91e33b5bf7f86ba7c0e3b6f7e52 (diff)
Fix LineBreakAroundConditionalBlock cop for a conditional after rescue
Previously this would violate on the `if`: def a_method do_something rescue if condition do_something end end
Diffstat (limited to 'spec/rubocop')
-rw-r--r--spec/rubocop/cop/line_break_around_conditional_block_spec.rb16
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