Sha256: 58e0037e5496558966dad784ac8576fff6e7d02f1bf08863369fe936ab030ec2

Contents?: true

Size: 791 Bytes

Versions: 32

Compression:

Stored size: 791 Bytes

Contents

# frozen_string_literal: true

RSpec.shared_context 'with default RSpec/Language config' do
  include_context 'config'

  # Deep duplication is needed to prevent config leakage between examples
  let(:other_cops) do
    default_language = RuboCop::ConfigLoader
      .default_configuration['RSpec']['Language']
    default_include = RuboCop::ConfigLoader
      .default_configuration['RSpec']['Include']
    { 'RSpec' =>
      {
        'Include' => default_include,
        'Language' => deep_dup(default_language)
      } }
  end

  def deep_dup(object)
    case object
    when Array
      object.map { |item| deep_dup(item) }
    when Hash
      object.transform_values(&method(:deep_dup))
    else
      object # only collections undergo modifications and need duping
    end
  end
end

Version data entries

32 entries across 32 versions & 4 rubygems

Version Path
rubocop-rspec-2.31.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.30.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.29.2 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.29.1 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.29.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.28.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.27.1 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.27.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.26.1/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.26.1 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.26.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-rspec-2.22.0/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.25.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.24.1 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.24.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.23.2 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.23.1 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-2.23.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.22.0/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-2.22.0/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb