Skip to content

Commit

Permalink
Merge pull request #529 from amatsuda/TOPLEVEL_method
Browse files Browse the repository at this point in the history
Don't define a method on TOPLEVEL while testing
  • Loading branch information
amatsuda authored Mar 9, 2025
2 parents 56a2fc6 + 2cc4c0a commit eec9084
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@

config.after(:each, js: true) do |example|
if example.exception
save_timestamped_screenshot(Capybara.page)
screenshot_path = Rails.root.join("tmp/screenshots", "#{method_name}-#{Time.zone.now.strftime("%Y_%m_%d-%H_%M_%S")}.png")
Capybara.page.save_screenshot(screenshot_path)
end
end

Expand All @@ -78,11 +79,3 @@
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
end
end

def save_timestamped_screenshot(page)
timestamp = Time.zone.now.strftime("%Y_%m_%d-%H_%M_%S")
filename = "#{method_name}-#{timestamp}.png"
screenshot_path = Rails.root.join("tmp", "screenshots", filename)

page.save_screenshot(screenshot_path)
end

0 comments on commit eec9084

Please sign in to comment.