Skip to content

Commit 9aa3e03

Browse files
pftgclaude
andcommitted
test: add test for assert_no_screenshot_changes caller reporting
Verifies skip_stack_frames correctly points backtrace to the test method, not to dsl.rb internals. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3d3221e commit 9aa3e03

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

test/unit/dsl_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,21 @@ def assert_no_screenshot_jobs_scheduled
100100
end
101101
end
102102

103+
test "#assert_no_screenshot_changes reports caller from test method" do
104+
Capybara::Screenshot::Diff::Vcs.stub(:checkout_vcs, true) do
105+
assert_no_screenshot_jobs_scheduled
106+
107+
snap = create_snapshot_for(:a, :c)
108+
109+
assert_no_screenshot_changes(snap.full_name)
110+
assert_equal 1, CapybaraScreenshotDiff.assertions.size
111+
assert_match(
112+
%r{/dsl_test.rb},
113+
CapybaraScreenshotDiff.assertions[0].caller.first
114+
)
115+
end
116+
end
117+
103118
test "#screenshot with delayed: false raises error when images differ" do
104119
Capybara::Screenshot::Diff::Vcs.stub(:checkout_vcs, true) do
105120
Capybara::Screenshot::Diff.stub(:delayed, false) do

0 commit comments

Comments
 (0)