Sha256: b563fd2178a156f4abd19ee593aa80269904083f020bd9baa993069737b0866e

Contents?: true

Size: 809 Bytes

Versions: 14

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module CUL
      # Do not commit specs that call `page.save_screenshot`
      class CapybaraScreenshots < RuboCop::Cop::Cop
        MSG = 'Remove debugging/instrumentation such as `page#save_screenshot` before committing.'
        # This cop uses a node matcher for matching node pattern.
        # See https://github.com/rubocop/rubocop-ast/blob/master/docs/modules/ROOT/pages/node_pattern.adoc
        #
        # For example
        def_node_matcher :called_forbidden_method?, <<-PATTERN
          (send (send nil? :page) :save_screenshot)
        PATTERN

        def on_send(node)
          return unless called_forbidden_method?(node)
          add_offense(node, location: :expression, message: MSG)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rubocul-4.0.12 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.11 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.10 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.9 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.8 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.6 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.5 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.4 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.3 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.2 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.1 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-4.0.0 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-3.0.0 lib/rubocop/cop/cul/capybara_screenshots.rb
rubocul-2.0.2 lib/rubocop/cop/cul/capybara_screenshots.rb