Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab FOSS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab FOSS
Commits
e1b8b932
Commit
e1b8b932
authored
5 years ago
by
Vitali Tatarintev
Browse files
Options
Downloads
Patches
Plain Diff
Replace double quotes with single quotes
parent
d40b7ea3
No related branches found
No related tags found
1 merge request
!32091
Add rubocop check for be success
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
rubocop/cop/rspec/be_success_matcher.rb
+2
-2
2 additions, 2 deletions
rubocop/cop/rspec/be_success_matcher.rb
spec/rubocop/cop/rspec/be_success_matcher_spec.rb
+9
-9
9 additions, 9 deletions
spec/rubocop/cop/rspec/be_success_matcher_spec.rb
with
11 additions
and
11 deletions
rubocop/cop/rspec/be_success_matcher.rb
+
2
−
2
View file @
e1b8b932
...
...
@@ -26,7 +26,7 @@ module RSpec
class
BeSuccessMatcher
<
RuboCop
::
Cop
::
Cop
include
SpecHelpers
MESSAGE
=
"
Do
n'
t use deprecated `success?` method, use `successful?` instead.
"
.
freeze
MESSAGE
=
'
Do
no
t use deprecated `success?` method, use `successful?` instead.
'
.
freeze
def_node_search
:expect_to_be_success?
,
<<~
PATTERN
(send (send nil? :expect (send nil? ...)) :to (send nil? :be_success))
...
...
@@ -49,7 +49,7 @@ def on_send(node)
def
autocorrect
(
node
)
lambda
do
|
corrector
|
corrector
.
insert_after
(
node
.
loc
.
expression
,
"
ful
"
)
corrector
.
insert_after
(
node
.
loc
.
expression
,
'
ful
'
)
end
end
end
...
...
This diff is collapsed.
Click to expand it.
spec/rubocop/cop/rspec/be_success_matcher_spec.rb
+
9
−
9
View file @
e1b8b932
...
...
@@ -42,17 +42,17 @@
allow
(
cop
).
to
receive
(
:in_controller_spec?
).
and_return
(
true
)
end
context
"
using expect(response).to be_success call
"
do
context
'
using expect(response).to be_success call
'
do
it_behaves_like
'an offensive be_success call'
,
OFFENSE_CALL_EXPECT_TO_BE_SUCCESS
it_behaves_like
'an autocorrected be_success call'
,
OFFENSE_CALL_EXPECT_TO_BE_SUCCESS
,
CALL_EXPECT_TO_BE_SUCCESSFUL
end
context
"
using is_expected.to be_success call
"
do
context
'
using is_expected.to be_success call
'
do
it_behaves_like
'an offensive be_success call'
,
OFFENSE_CALL_IS_EXPECTED_TO_BE_SUCCESS
it_behaves_like
'an autocorrected be_success call'
,
OFFENSE_CALL_IS_EXPECTED_TO_BE_SUCCESS
,
CALL_IS_EXPECTED_TO_BE_SUCCESSFUL
end
context
"
using expect(response).to be_successful
"
do
context
'
using expect(response).to be_successful
'
do
it
"does not register an offense"
do
inspect_source
(
CALL_EXPECT_TO_BE_SUCCESSFUL
)
...
...
@@ -60,8 +60,8 @@
end
end
context
"
using is_expected.to be_successful
"
do
it
"
does not register an offense
"
do
context
'
using is_expected.to be_successful
'
do
it
'
does not register an offense
'
do
inspect_source
(
CALL_IS_EXPECTED_TO_BE_SUCCESSFUL
)
expect
(
cop
.
offenses
.
size
).
to
eq
(
0
)
...
...
@@ -70,16 +70,16 @@
end
context
'outside of a controller spec file'
do
context
"
using expect(response).to be_success call
"
do
it
"
does not register an offense
"
do
context
'
using expect(response).to be_success call
'
do
it
'
does not register an offense
'
do
inspect_source
(
OFFENSE_CALL_EXPECT_TO_BE_SUCCESS
)
expect
(
cop
.
offenses
.
size
).
to
eq
(
0
)
end
end
context
"
using is_expected.to be_success call
"
do
it
"
does not register an offense
"
do
context
'
using is_expected.to be_success call
'
do
it
'
does not register an offense
'
do
inspect_source
(
OFFENSE_CALL_IS_EXPECTED_TO_BE_SUCCESS
)
expect
(
cop
.
offenses
.
size
).
to
eq
(
0
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment