Skip to content

Commit

Permalink
Update the test setup
Browse files Browse the repository at this point in the history
With the latest rubocop-performance update, the tests are failing to run.
It looks like we need to update the setup.
Based off of rubocop/rubocop-minitest@a96a985.
  • Loading branch information
khiga8 committed Oct 17, 2023
1 parent 3adf59a commit 2eb60ff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions test/cop_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_image_has_alt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/test_no_positive_tabindex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_no_redundant_image_alt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2eb60ff

Please sign in to comment.