Skip to content

Commit

Permalink
Make auto_gen_config_spec.rb more stable
Browse files Browse the repository at this point in the history
The previous commit caused failures in this file for some ruby versions in the
CI builds. I have not been able to reproduce locally, but I suspect that since
DisabledConfigFormatter has two singleton variables that keep their values
between test cases, we need to clear both of them.
  • Loading branch information
jonas054 committed Jul 1, 2021
1 parent 3d57dc5 commit 98d229f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions spec/rubocop/cli/auto_gen_config_spec.rb
Expand Up @@ -8,7 +8,10 @@
include_context 'cli spec behavior'

describe '--auto-gen-config' do
before { RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {} }
before do
RuboCop::Formatter::DisabledConfigFormatter.config_to_allow_offenses = {}
RuboCop::Formatter::DisabledConfigFormatter.detected_styles = {}
end

shared_examples 'LineLength handling' do |ctx, initial_dotfile, exp_dotfile|
context ctx do
Expand Down Expand Up @@ -446,11 +449,10 @@ def fooBar; end
todo_contents = File.read('.rubocop_todo.yml').lines[8..-1].join
expect(todo_contents).to eq(<<~YAML)
# Offense count: 1
# Configuration parameters: EnforcedStyle, IgnoredPatterns.
# Configuration parameters: IgnoredPatterns.
# SupportedStyles: snake_case, camelCase
Naming/MethodName:
Exclude:
- 'example1.rb'
EnforcedStyle: camelCase
# Offense count: 1
# Cop supports --auto-correct.
Expand Down

0 comments on commit 98d229f

Please sign in to comment.