Sha256: c113abd6385baaaa01378681999275bcecb2a8d2d2a8f64beba6a7c8de0536f1

Contents?: true

Size: 895 Bytes

Versions: 2

Compression:

Stored size: 895 Bytes

Contents

require 'yard'

require 'rubocop/rspec/description_extractor'

RSpec.describe RuboCop::RSpec::DescriptionExtractor do
  let(:yardocs) do
    [
      instance_double(
        YARD::CodeObjects::MethodObject,
        docstring: "Checks foo\n\nLong description",
        to_s: 'RuboCop::Cop::RSpec::Foo',
        type: :class,
        name: 'Foo'
      ),
      instance_double(
        YARD::CodeObjects::MethodObject,
        docstring: 'Hi',
        to_s: 'RuboCop::Cop::RSpec::Foo#bar',
        type: :method,
        name: 'Foo#bar'
      ),
      instance_double(
        YARD::CodeObjects::MethodObject,
        docstring: 'This is not a cop',
        to_s: 'RuboCop::Cop::Mixin::Sneaky',
        type: :class
      )
    ]
  end

  it 'builds a hash of descriptions' do
    expect(described_class.new(yardocs).to_h)
      .to eql('RSpec/Foo' => { 'Description' => 'Checks foo' })
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-rspec-1.8.0 spec/rubocop/rspec/description_extractor_spec.rb
rubocop-rspec-1.7.0 spec/rubocop/rspec/description_extractor_spec.rb