aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-02-23 22:30:01 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-02-23 22:40:35 +0900
commitebaf1e709fb64cf7bbddb8f539863c2f24c3d3d5 (patch)
tree0f4f2009bce3b83666514d5cce0bd693057c4dc4 /actionpack
parentfd85bec26148e05a8e3d546c2827c889f9a9f8f8 (diff)
downloadrails-ebaf1e709fb64cf7bbddb8f539863c2f24c3d3d5.tar.gz
rails-ebaf1e709fb64cf7bbddb8f539863c2f24c3d3d5.tar.bz2
rails-ebaf1e709fb64cf7bbddb8f539863c2f24c3d3d5.zip
Do not take screenshot when test skipped
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb8
-rw-r--r--actionpack/test/dispatch/system_testing/screenshot_helper_test.rb10
2 files changed, 16 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb b/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb
index 784005cb93..ddc961cf84 100644
--- a/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb
+++ b/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb
@@ -22,12 +22,12 @@ module ActionDispatch
# fails add +take_failed_screenshot+ to the teardown block before clearing
# sessions.
def take_failed_screenshot
- take_screenshot unless passed?
+ take_screenshot if failed?
end
private
def image_name
- passed? ? method_name : "failures_#{method_name}"
+ failed? ? "failures_#{method_name}" : method_name
end
def image_path
@@ -51,6 +51,10 @@ module ActionDispatch
def inline_base64(path)
Base64.encode64(path).gsub("\n", "")
end
+
+ def failed?
+ !passed? && !skipped?
+ end
end
end
end
diff --git a/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb b/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb
index 8c14f799b0..3b4ea96c4f 100644
--- a/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb
+++ b/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb
@@ -15,4 +15,14 @@ class ScreenshotHelperTest < ActiveSupport::TestCase
assert_equal "tmp/screenshots/failures_x.png", new_test.send(:image_path)
end
end
+
+ test "image path does not include failures text if test skipped" do
+ new_test = ActionDispatch::SystemTestCase.new("x")
+
+ new_test.stub :passed?, false do
+ new_test.stub :skipped?, true do
+ assert_equal "tmp/screenshots/x.png", new_test.send(:image_path)
+ end
+ end
+ end
end