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
e1b8b932
Commit
e1b8b932
authored
Aug 23, 2019
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace double quotes with single quotes
parent
d40b7ea3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
rubocop/cop/rspec/be_success_matcher.rb
rubocop/cop/rspec/be_success_matcher.rb
+2
-2
spec/rubocop/cop/rspec/be_success_matcher_spec.rb
spec/rubocop/cop/rspec/be_success_matcher_spec.rb
+9
-9
No files found.
rubocop/cop/rspec/be_success_matcher.rb
View file @
e1b8b932
...
...
@@ -26,7 +26,7 @@ module RuboCop
class
BeSuccessMatcher
<
RuboCop
::
Cop
::
Cop
include
SpecHelpers
MESSAGE
=
"Don't use deprecated `success?` method, use `successful?` instead."
.
freeze
MESSAGE
=
'Do not 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 @@ module RuboCop
def
autocorrect
(
node
)
lambda
do
|
corrector
|
corrector
.
insert_after
(
node
.
loc
.
expression
,
"ful"
)
corrector
.
insert_after
(
node
.
loc
.
expression
,
'ful'
)
end
end
end
...
...
spec/rubocop/cop/rspec/be_success_matcher_spec.rb
View file @
e1b8b932
...
...
@@ -42,17 +42,17 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do
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 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do
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 @@ describe RuboCop::Cop::RSpec::BeSuccessMatcher do
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
)
...
...
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