Sha256: 66a521ed7858568ff5651d7957a6830ed96008396d87200aa71268dfce328570

Contents?: true

Size: 682 Bytes

Versions: 15

Compression:

Stored size: 682 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module RSpec
    # Wrapper for RSpec examples
    class Example < Concept
      def_node_matcher :extract_doc_string,     '(send _ _ $_ ...)'
      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

15 entries across 15 versions & 1 rubygems

Version Path
rubocop-rspec-2.2.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.1.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.0.1 lib/rubocop/rspec/example.rb
rubocop-rspec-2.0.0 lib/rubocop/rspec/example.rb
rubocop-rspec-2.0.0.pre lib/rubocop/rspec/example.rb
rubocop-rspec-1.44.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.44.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.43.2 lib/rubocop/rspec/example.rb
rubocop-rspec-1.43.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.43.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.42.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.41.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.40.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.39.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.38.1 lib/rubocop/rspec/example.rb