Skip to content

Commit ec3d392

Browse files
committed
Fix skips in Action Pack
We can't run this test on Ruby 2.7 due to minitest being locked in the Gemfile to an older version, so we should use that as a condition instead of skipping if minitest doesn't have metadata.
1 parent b843387 commit ec3d392

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

actionpack/test/dispatch/system_testing/screenshot_helper_test.rb

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,17 +152,18 @@ def setup
152152
assert_match %r|url=artifact://.+?tmp/screenshots/1_x\.png|, display_image_actual
153153
end
154154

155-
test "take_failed_screenshot persists the image path in the test metadata" do
156-
skip "Older versions of Minitest don't support test metadata." unless Minitest::Runnable.method_defined?(:metadata)
157-
158-
Rails.stub :root, Pathname.getwd do
159-
@new_test.stub :passed?, false do
160-
Capybara::Session.stub :instance_created?, true do
161-
@new_test.stub :save_image, nil do
162-
@new_test.stub :show, -> (_) { } do
163-
@new_test.take_failed_screenshot
164-
165-
assert_equal @new_test.send(:relative_image_path), @new_test.metadata[:failure_screenshot_path]
155+
# minitest doesn't support metadata in the version locked on Ruby 2.7
156+
if RUBY_VERSION > "3.0"
157+
test "take_failed_screenshot persists the image path in the test metadata" do
158+
Rails.stub :root, Pathname.getwd do
159+
@new_test.stub :passed?, false do
160+
Capybara::Session.stub :instance_created?, true do
161+
@new_test.stub :save_image, nil do
162+
@new_test.stub :show, -> (_) { } do
163+
@new_test.take_failed_screenshot
164+
165+
assert_equal @new_test.send(:relative_image_path), @new_test.metadata[:failure_screenshot_path]
166+
end
166167
end
167168
end
168169
end

0 commit comments

Comments
 (0)