Sha256: 1aec6973c3283ed13c58622acd615912d747f88c5daeac572dc0645babea0b5f

Contents?: true

Size: 799 Bytes

Versions: 13

Compression:

Stored size: 799 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 { |value| deep_dup(value) }
    else
      object # only collections undergo modifications and need duping
    end
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-3.0.3/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.3.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.2.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.1.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.0.5 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.0.4 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/rubocop-rspec-3.0.1/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.0.3 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.0.2 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/rubocop-rspec-3.0.1/lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.0.1 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.0.0 lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb
rubocop-rspec-3.0.0.pre lib/rubocop/rspec/shared_contexts/default_rspec_language_config_context.rb