lib/capybara/screenshot/diff.rb in capybara-screenshot-diff-1.5.1 vs lib/capybara/screenshot/diff.rb in capybara-screenshot-diff-1.5.2

- old
+ new

@@ -53,10 +53,16 @@ mattr_accessor :skip_area mattr_accessor(:driver) { :auto } mattr_accessor(:tolerance) { 0.001 } AVAILABLE_DRIVERS = Utils.detect_available_drivers.freeze + begin + require 'minitest' + ASSERTION = Minitest::Assertion + rescue + ASSERTION = RuntimeError + end def self.included(klass) klass.include TestMethods klass.setup do if Capybara::Screenshot.window_size @@ -71,10 +77,10 @@ klass.teardown do if Capybara::Screenshot::Diff.enabled && @test_screenshots test_screenshot_errors = @test_screenshots .map { |caller, name, compare| assert_image_not_changed(caller, name, compare) } test_screenshot_errors.compact! - fail(test_screenshot_errors.join("\n\n")) if test_screenshot_errors.any? + raise ASSERTION, test_screenshot_errors.join("\n\n") if test_screenshot_errors.any? end end end end end