Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b752ee4a
Commit
b752ee4a
authored
Apr 17, 2018
by
Jacopo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates after 4th review
parent
2c86a0f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
spec/rubocop/cop/avoid_return_from_blocks_spec.rb
spec/rubocop/cop/avoid_return_from_blocks_spec.rb
+21
-1
No files found.
spec/rubocop/cop/avoid_return_from_blocks_spec.rb
View file @
b752ee4a
...
...
@@ -39,6 +39,26 @@ describe RuboCop::Cop::AvoidReturnFromBlocks do
inspect_source
(
source
)
end
it
'flags violation for return inside included > def > block'
do
source
=
<<~
RUBY
included do
def a_method
return if something
call do
return if something_else
end
end
end
RUBY
inspect_source
(
source
)
expect
(
cop
.
offenses
.
size
).
to
eq
(
1
)
offense
=
cop
.
offenses
.
first
expect
(
offense
.
line
).
to
eq
(
6
)
end
shared_examples
'examples with whitelisted method'
do
|
whitelisted_method
|
it
"doesn't flag violation for return inside
#{
whitelisted_method
}
"
do
source
=
<<~
RUBY
...
...
@@ -64,7 +84,7 @@ describe RuboCop::Cop::AvoidReturnFromBlocks do
#{
def_method
}
do
return if something
do_something_mo
d
e
do_something_mo
r
e
end
end
RUBY
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment