lib/rubocop/cop/rspec/rails/http_status.rb in rubocop-rspec-1.41.0 vs lib/rubocop/cop/rspec/rails/http_status.rb in rubocop-rspec-1.42.0

- old
+ new

@@ -29,10 +29,11 @@ # it { is_expected.to have_http_status 404 } # it { is_expected.to have_http_status :success } # it { is_expected.to have_http_status :error } # class HttpStatus < Cop + extend AutoCorrector include ConfigurableEnforcedStyle def_node_matcher :http_status, <<-PATTERN (send nil? :have_http_status ${int sym}) PATTERN @@ -40,17 +41,12 @@ def on_send(node) http_status(node) do |ast_node| checker = checker_class.new(ast_node) return unless checker.offensive? - add_offense(checker.node, message: checker.message) - end - end - - def autocorrect(node) - lambda do |corrector| - checker = checker_class.new(node) - corrector.replace(node.loc.expression, checker.preferred_style) + add_offense(checker.node, message: checker.message) do |corrector| + corrector.replace(checker.node, checker.preferred_style) + end end end private