Sha256: 8a728788f2208959e37acb8d109e8e2ab62eb6b8ddecfbdceae94ac7c48dc3b3

Contents?: true

Size: 812 Bytes

Versions: 69

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module RSpec
    # Wrapper for RSpec examples
    class Example < Concept
      # @!method extract_doc_string(node)
      def_node_matcher :extract_doc_string,     '(send _ _ $_ ...)'

      # @!method extract_metadata(node)
      def_node_matcher :extract_metadata,       '(send _ _ _ $...)'

      # @!method extract_implementation(node)
      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

69 entries across 63 versions & 7 rubygems

Version Path
rubocop-rspec-2.11.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.10.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.9.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.8.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.7.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.6.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.5.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.4.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.3.0 lib/rubocop/rspec/example.rb