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 'rubocop/cop/rspec/web_mock_enable.rb')
-rw-r--r--rubocop/cop/rspec/web_mock_enable.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/rubocop/cop/rspec/web_mock_enable.rb b/rubocop/cop/rspec/web_mock_enable.rb
index bcf7f95dbbd..0bef16a16b0 100644
--- a/rubocop/cop/rspec/web_mock_enable.rb
+++ b/rubocop/cop/rspec/web_mock_enable.rb
@@ -3,7 +3,9 @@
module RuboCop
module Cop
module RSpec
- class WebMockEnable < RuboCop::Cop::Cop
+ class WebMockEnable < RuboCop::Cop::Base
+ extend RuboCop::Cop::AutoCorrector
+
# This cop checks for `WebMock.disable_net_connect!` usage in specs and
# replaces it with `webmock_enable!`
#
@@ -24,13 +26,9 @@ module RuboCop
def on_send(node)
if webmock_disable_net_connect?(node)
- add_offense(node, location: :expression, message: MESSAGE)
- end
- end
-
- def autocorrect(node)
- lambda do |corrector|
- corrector.replace(node, 'webmock_enable!')
+ add_offense(node, message: MESSAGE) do |corrector|
+ corrector.replace(node, 'webmock_enable!')
+ end
end
end
end