rubocop.rb 998 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rubocop/rspec/support'
  3. # https://github.com/rubocop/rubocop/tree/91e72f8bb4a5a646845e7915052f912d60a3d280/lib/rubocop/rspec/shared_contexts.rb:52
  4. RSpec.shared_context 'when checking custom RuboCop cops' do
  5. include RuboCop::RSpec::ExpectOffense
  6. let(:cop_options) { {} }
  7. let(:cop_config) { {} }
  8. let(:cur_cop_config) do
  9. RuboCop::ConfigLoader
  10. .default_configuration.for_cop(described_class)
  11. .merge({
  12. 'Enabled' => true, # in case it is 'pending'
  13. 'AutoCorrect' => true # in case defaults set it to false
  14. })
  15. .merge(cop_config)
  16. end
  17. let(:config) { ::RuboCop::Config.new({ described_class.cop_name => cur_cop_config }, "#{Rails.configuration.root}/.rubocop.yml") }
  18. let(:cop) { described_class.new(config, cop_options) }
  19. end
  20. RSpec.configure do |config|
  21. config.include_context 'when checking custom RuboCop cops', type: :rubocop
  22. end