mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #32127 from zamith/zamith/screenshot-absolute-path
Uses the absolute path for system test screenshots
This commit is contained in:
commit
39d2cde659
2 changed files with 6 additions and 6 deletions
|
@ -43,7 +43,7 @@ module ActionDispatch
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_path
|
def image_path
|
||||||
@image_path ||= absolute_image_path.relative_path_from(Pathname.pwd).to_s
|
@image_path ||= absolute_image_path.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
def absolute_image_path
|
def absolute_image_path
|
||||||
|
|
|
@ -9,7 +9,7 @@ class ScreenshotHelperTest < ActiveSupport::TestCase
|
||||||
new_test = DrivenBySeleniumWithChrome.new("x")
|
new_test = DrivenBySeleniumWithChrome.new("x")
|
||||||
|
|
||||||
Rails.stub :root, Pathname.getwd do
|
Rails.stub :root, Pathname.getwd do
|
||||||
assert_equal "tmp/screenshots/x.png", new_test.send(:image_path)
|
assert_equal Rails.root.join("tmp/screenshots/x.png").to_s, new_test.send(:image_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class ScreenshotHelperTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
Rails.stub :root, Pathname.getwd do
|
Rails.stub :root, Pathname.getwd do
|
||||||
new_test.stub :passed?, false do
|
new_test.stub :passed?, false do
|
||||||
assert_equal "tmp/screenshots/failures_x.png", new_test.send(:image_path)
|
assert_equal Rails.root.join("tmp/screenshots/failures_x.png").to_s, new_test.send(:image_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -29,7 +29,7 @@ class ScreenshotHelperTest < ActiveSupport::TestCase
|
||||||
Rails.stub :root, Pathname.getwd do
|
Rails.stub :root, Pathname.getwd do
|
||||||
new_test.stub :passed?, false do
|
new_test.stub :passed?, false do
|
||||||
new_test.stub :skipped?, true do
|
new_test.stub :skipped?, true do
|
||||||
assert_equal "tmp/screenshots/x.png", new_test.send(:image_path)
|
assert_equal Rails.root.join("tmp/screenshots/x.png").to_s, new_test.send(:image_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -59,11 +59,11 @@ class ScreenshotHelperTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "image path returns the relative path from current directory" do
|
test "image path returns the absolute path from root" do
|
||||||
new_test = DrivenBySeleniumWithChrome.new("x")
|
new_test = DrivenBySeleniumWithChrome.new("x")
|
||||||
|
|
||||||
Rails.stub :root, Pathname.getwd.join("..") do
|
Rails.stub :root, Pathname.getwd.join("..") do
|
||||||
assert_equal "../tmp/screenshots/x.png", new_test.send(:image_path)
|
assert_equal Rails.root.join("tmp/screenshots/x.png").to_s, new_test.send(:image_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue