Sha256: 531606fcad65ac55a45bc8f04086b3683270e7f2edea1fac4d7ad31800f52afd

Contents?: true

Size: 689 Bytes

Versions: 20

Compression:

Stored size: 689 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.children.first
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rubocop-rspec-1.24.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.23.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.22.2 lib/rubocop/rspec/example.rb
rubocop-rspec-1.22.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.22.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.21.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.20.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.20.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.19.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.18.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.17.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.17.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.16.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.15.1 lib/rubocop/rspec/example.rb
rubocop-rspec-1.15.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.14.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.13.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.12.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.11.0 lib/rubocop/rspec/example.rb
rubocop-rspec-1.10.0 lib/rubocop/rspec/example.rb