Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip config tests on minimum Rubocop version #391

Merged
merged 1 commit into from May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ruby.yml
Expand Up @@ -28,3 +28,5 @@ jobs:
run: bundle info rubocop | head -1
- name: RuboCop and Tests
run: bundle exec rake
env:
CHECKING_RUBOCOP_VERSION_COMPATIBILITY: ${{ matrix.gemfile == 'gemfiles/minimum_rubocop.gemfile' }}
10 changes: 10 additions & 0 deletions test/config_test.rb
Expand Up @@ -7,6 +7,8 @@

class ConfigTest < Minitest::Test
def test_config_is_unchanged
skip if checking_rubocop_version_compatibility?

Rake.application.load_rakefile

original_config = "test/fixtures/full_config.yml"
Expand All @@ -32,6 +34,8 @@ def test_config_is_unchanged
end

def test_config_has_no_redundant_entries
skip if checking_rubocop_version_compatibility?

config = RuboCop::ConfigLoader.load_file("rubocop.yml")
default_config = RuboCop::ConfigLoader.default_configuration
redundant_config = Hash.new { |hash, key| hash[key] = {} }
Expand All @@ -57,4 +61,10 @@ def test_config_has_no_redundant_entries

assert(redundant_config.empty?, error_message)
end

private

def checking_rubocop_version_compatibility?
ENV.fetch("CHECKING_RUBOCOP_VERSION_COMPATIBILITY", "") == "true"
end
end