From 2eb60ff0794a17dbd9683d8f7c49beb2adbf637f Mon Sep 17 00:00:00 2001 From: Kate Higa <16447748+khiga8@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:04:36 -0400 Subject: [PATCH] Update the test setup With the latest rubocop-performance update, the tests are failing to run. It looks like we need to update the setup. Based off of https://github.com/rubocop/rubocop-minitest/commit/a96a985467481659c757bc26a0dcd0f550204644. --- test/cop_test.rb | 6 +++--- test/test_image_has_alt.rb | 2 +- test/test_no_positive_tabindex.rb | 2 +- test/test_no_redundant_image_alt.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/cop_test.rb b/test/cop_test.rb index d271106..bb9e298 100644 --- a/test/cop_test.rb +++ b/test/cop_test.rb @@ -11,13 +11,13 @@ def cop_class attr_reader :cop def setup - config = RuboCop::Config.new - @cop = cop_class.new(config) + @config = RuboCop::Config.new + @cop = cop_class.new(@config) end def investigate(cop, src, filename = nil) processed_source = RuboCop::ProcessedSource.new(src, RUBY_VERSION.to_f, filename) - team = RuboCop::Cop::Team.new([cop], nil, raise_error: true) + team = RuboCop::Cop::Team.new([cop], @config, raise_error: true) report = team.investigate(processed_source) report.offenses end diff --git a/test/test_image_has_alt.rb b/test/test_image_has_alt.rb index 7e79b47..5cf5fee 100644 --- a/test/test_image_has_alt.rb +++ b/test/test_image_has_alt.rb @@ -15,7 +15,7 @@ def test_image_has_alt_offense ERB assert_equal 1, offenses.count - assert_equal "Images should have an alt prop with meaningful text or an empty string for decorative images", + assert_equal "RailsAccessibility/ImageHasAlt: Images should have an alt prop with meaningful text or an empty string for decorative images", offenses[0].message end diff --git a/test/test_no_positive_tabindex.rb b/test/test_no_positive_tabindex.rb index cfb611b..e8a5165 100644 --- a/test/test_no_positive_tabindex.rb +++ b/test/test_no_positive_tabindex.rb @@ -15,7 +15,7 @@ def test_no_positive_tabindex_alt_offense ERB assert_equal 1, offenses.count - assert_equal "Positive tabindex is error-prone and often inaccessible.", offenses[0].message + assert_equal "RailsAccessibility/NoPositiveTabindex: Positive tabindex is error-prone and often inaccessible.", offenses[0].message end def test_no_positive_tabindex_alt_no_offense diff --git a/test/test_no_redundant_image_alt.rb b/test/test_no_redundant_image_alt.rb index 01b5fdf..ffc1418 100644 --- a/test/test_no_redundant_image_alt.rb +++ b/test/test_no_redundant_image_alt.rb @@ -15,7 +15,7 @@ def test_no_redundant_image_alt_offense ERB assert_equal 1, offenses.count - assert_equal "Alt prop should not contain `image` or `picture` as screen readers already announce the element as an image", + assert_equal "RailsAccessibility/NoRedundantImageAlt: Alt prop should not contain `image` or `picture` as screen readers already announce the element as an image", offenses[0].message end