Sha256: 8b6d319acd86947bfecd1e25e528870a9dc11b87033596479ea671c6769483bc

Contents?: true

Size: 577 Bytes

Versions: 3

Compression:

Stored size: 577 Bytes

Contents

# encoding: utf-8

# `cop_config` must be declared with #let.
shared_context 'config', :config do
  let(:config) do
    # Module#<
    unless described_class < Rubocop::Cop::Cop
      fail '`config` must be used in `describe SomeCopClass do .. end`'
    end

    unless cop_config.is_a?(Hash)
      fail '`cop_config` must be declared with #let'
    end

    cop_name = described_class.cop_name
    hash = {
      cop_name =>
      Rubocop::ConfigLoader.default_configuration[cop_name].merge(cop_config)
    }
    Rubocop::Config.new(hash, "#{Dir.pwd}/.rubocop.yml")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.21.0 spec/support/shared_context.rb
rubocop-0.20.1 spec/support/shared_context.rb
rubocop-0.20.0 spec/support/shared_context.rb