lib/capybara/screenshot/diff/test_methods.rb in capybara-screenshot-diff-1.8.1 vs lib/capybara/screenshot/diff/test_methods.rb in capybara-screenshot-diff-1.8.2
- old
+ new
@@ -72,25 +72,25 @@
screenshot_full_name = build_full_name(name)
job = build_screenshot_matches_job(screenshot_full_name, options)
return false unless job
- test_caller = caller(skip_stack_frames)
+ job.prepend(caller[skip_stack_frames])
if Screenshot::Diff.delayed
- schedule_match_job([test_caller] + job)
+ schedule_match_job(job)
else
- error_msg = assert_image_not_changed(job.first, job.last)
+ error_msg = assert_image_not_changed(*job)
if error_msg
error = ASSERTION.new(error_msg)
error.set_backtrace(caller(2))
raise error
end
end
end
- def assert_image_not_changed(name, comparison)
+ def assert_image_not_changed(caller, name, comparison)
result = comparison.different?
# Cleanup after comparisons
if !result && comparison.base_image_path.exist?
FileUtils.mv(comparison.base_image_path, comparison.image_path, force: true)
@@ -98,10 +98,10 @@
FileUtils.rm_rf(comparison.base_image_path)
end
return unless result
- "Screenshot does not match for '#{name}' #{comparison.error_message}"
+ "Screenshot does not match for '#{name}' #{comparison.error_message}\n#{caller}"
end
private
def build_screenshot_matches_job(screenshot_full_name, options)