lib/rubocop/rspec/config_formatter.rb in rubocop-rspec-2.7.0 vs lib/rubocop/rspec/config_formatter.rb in rubocop-rspec-2.8.0
- old
+ new
@@ -6,11 +6,11 @@
module RSpec
# Builds a YAML config file from two config hashes
class ConfigFormatter
EXTENSION_ROOT_DEPARTMENT = %r{^(RSpec/)}.freeze
SUBDEPARTMENTS = %(RSpec/Capybara RSpec/FactoryBot RSpec/Rails)
- STYLE_GUIDE_BASE_URL = 'https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/'
+ COP_DOC_BASE_URL = 'https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/'
def initialize(config, descriptions)
@config = config
@descriptions = descriptions
end
@@ -25,12 +25,11 @@
def unified_config
cops.each_with_object(config.dup) do |cop, unified|
next if SUBDEPARTMENTS.include?(cop)
- unified[cop] = config.fetch(cop)
- .merge(descriptions.fetch(cop))
- .merge('StyleGuide' => STYLE_GUIDE_BASE_URL + cop.sub('RSpec/', ''))
+ unified[cop].merge!(descriptions.fetch(cop))
+ unified[cop]['Reference'] = COP_DOC_BASE_URL + cop.sub('RSpec/', '')
end
end
def cops
(descriptions.keys | config.keys).grep(EXTENSION_ROOT_DEPARTMENT)