aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb
blob: 3b4ea96c4f9e9f8b934dcd633ef9fdf339aa309a (plain) (tree)
1
2
3
4
5
6
7

                                                                       

                                                    
                                                
                                                      
 








                                                                               
     









                                                                        
   
require "abstract_unit"
require "action_dispatch/system_testing/test_helpers/screenshot_helper"

class ScreenshotHelperTest < ActiveSupport::TestCase
  test "image path is saved in tmp directory" do
    new_test = ActionDispatch::SystemTestCase.new("x")

    assert_equal "tmp/screenshots/x.png", new_test.send(:image_path)
  end

  test "image path includes failures text if test did not pass" do
    new_test = ActionDispatch::SystemTestCase.new("x")

    new_test.stub :passed?, false do
      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