Skip to content

Commit

Permalink
Merge pull request #391 from Shopify/fix-config-check-for-minimum-rub…
Browse files Browse the repository at this point in the history
…ocop-version

Skip config tests on minimum Rubocop version
  • Loading branch information
rafaelfranca committed May 13, 2022
2 parents f5122f5 + 7175204 commit f56d998
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

0 comments on commit f56d998

Please sign in to comment.