Sha256: 9c49b92be9454ab74f278df7de73bace284d496b33c5b039be3c4d6698dcf7e1

Contents?: true

Size: 684 Bytes

Versions: 19

Compression:

Stored size: 684 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module RSpec
    # Wrapper for RSpec examples
    class Example < Concept
      def_node_matcher :extract_doc_string,     '(send _ _ $str ...)'
      def_node_matcher :extract_metadata,       '(send _ _ _ $...)'
      def_node_matcher :extract_implementation, '(block send args $_)'

      def doc_string
        extract_doc_string(definition)
      end

      def metadata
        extract_metadata(definition)
      end

      def implementation
        extract_implementation(node)
      end

      def definition
        if node.send_type?
          node
        else
          node.send_node
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rubocop-rspec-1.38.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.37.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.37.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.36.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.35.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.34.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.34.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.33.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.32.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.31.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.30.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.30.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.29.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.29.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.28.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.27.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.26.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.25.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.25.0 lib/rubocop/rspec/example.rb