Sha256: a4e7c399543eab71018821492994974b046d197d33d1bc1be8264b54e9ad241b

Contents?: true

Size: 1.08 KB

Versions: 24

Compression:

Stored size: 1.08 KB

Contents

require 'rubocop/rspec/config_formatter'

RSpec.describe RuboCop::RSpec::ConfigFormatter do
  let(:config) do
    {
      'AllCops' => {
        'Setting' => 'fourty two'
      },
      'RSpec/Foo' => {
        'Config'      => 2,
        'Enabled'     => true
      },
      'RSpec/Bar' => {
        'Enabled'     => true
      }
    }
  end

  let(:descriptions) do
    {
      'RSpec/Foo' => {
        'Description' => 'Blah'
      },
      'RSpec/Bar' => {
        'Description' => 'Wow'
      }
    }
  end

  it 'builds a YAML dump with spacing between cops' do
    formatter = described_class.new(config, descriptions)

    expect(formatter.dump).to eql(<<-YAML.gsub(/^\s+\|/, ''))
      |---
      |AllCops:
      |  Setting: fourty two
      |
      |RSpec/Foo:
      |  Config: 2
      |  Enabled: true
      |  Description: Blah
      |  StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Foo
      |
      |RSpec/Bar:
      |  Enabled: true
      |  Description: Wow
      |  StyleGuide: http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Bar
    YAML
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rubocop-rspec-1.18.0 spec/rubocop/rspec/config_formatter_spec.rb
rubocop-rspec-1.17.1 spec/rubocop/rspec/config_formatter_spec.rb
rubocop-rspec-1.17.0 spec/rubocop/rspec/config_formatter_spec.rb
rubocop-rspec-1.16.0 spec/rubocop/rspec/config_formatter_spec.rb