Skip to content

Commit eec9084

Browse files
authored
Merge pull request #529 from amatsuda/TOPLEVEL_method
Don't define a method on TOPLEVEL while testing
2 parents 56a2fc6 + 2cc4c0a commit eec9084

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

spec/rails_helper.rb

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060

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

@@ -78,11 +79,3 @@
7879
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
7980
end
8081
end
81-
82-
def save_timestamped_screenshot(page)
83-
timestamp = Time.zone.now.strftime("%Y_%m_%d-%H_%M_%S")
84-
filename = "#{method_name}-#{timestamp}.png"
85-
screenshot_path = Rails.root.join("tmp", "screenshots", filename)
86-
87-
page.save_screenshot(screenshot_path)
88-
end

0 commit comments

Comments
 (0)