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:
Diffstat (limited to 'spec/rubocop/cop/avoid_return_from_blocks_spec.rb')
-rw-r--r--spec/rubocop/cop/avoid_return_from_blocks_spec.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/spec/rubocop/cop/avoid_return_from_blocks_spec.rb b/spec/rubocop/cop/avoid_return_from_blocks_spec.rb
index 71311b9df7f..526a362447f 100644
--- a/spec/rubocop/cop/avoid_return_from_blocks_spec.rb
+++ b/spec/rubocop/cop/avoid_return_from_blocks_spec.rb
@@ -5,8 +5,6 @@ require 'rubocop'
require_relative '../../../rubocop/cop/avoid_return_from_blocks'
RSpec.describe RuboCop::Cop::AvoidReturnFromBlocks do
- include CopHelper
-
subject(:cop) { described_class.new }
it 'flags violation for return inside a block' do
@@ -19,20 +17,16 @@ RSpec.describe RuboCop::Cop::AvoidReturnFromBlocks do
RUBY
end
- it "doesn't call add_offense twice for nested blocks" do
- source = <<~RUBY
+ it "doesn't create more than one offense for nested blocks" do
+ expect_offense(<<~RUBY)
call do
call do
something
return if something_else
+ ^^^^^^ Do not return from a block, use next or break instead.
end
end
RUBY
- expect_any_instance_of(described_class) do |instance|
- expect(instance).to receive(:add_offense).once
- end
-
- inspect_source(source)
end
it 'flags violation for return inside included > def > block' do