Skip to content

Commit 3d3221e

Browse files
pftgclaude
andcommitted
refactor: delete dead ScreenshotAssertion.from method
No production callers remain after replacing tuple protocol with direct construction. Update 2 tests to construct directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d59231c commit 3d3221e

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

lib/capybara_screenshot_diff/screenshot_assertion.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@ def initialize(name, **args, &block)
1414
yield(self) if block_given?
1515
end
1616

17-
def self.from(screenshot_job)
18-
return screenshot_job if screenshot_job.is_a?(ScreenshotAssertion)
19-
20-
caller, name, compare = screenshot_job
21-
ScreenshotAssertion.new(name).tap do |assertion|
22-
assertion.caller = caller
23-
assertion.compare = compare
24-
end
25-
end
26-
2717
def validate
2818
return unless compare
2919

test/unit/diff_test.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ def _test_sample_screenshot_error
155155
mock.expect(:base_image_path, Pathname.new("screenshot.base.png"))
156156
mock.expect(:error_message, "expected error message")
157157

158-
assertion = CapybaraScreenshotDiff::ScreenshotAssertion.from([["my_test.rb:42"], "sample_screenshot", mock])
158+
assertion = CapybaraScreenshotDiff::ScreenshotAssertion.new("sample_screenshot")
159+
assertion.caller = ["my_test.rb:42"]
160+
assertion.compare = mock
159161
CapybaraScreenshotDiff.add_assertion(assertion)
160162

161163
assert true
@@ -189,7 +191,9 @@ def _test_sample_screenshot_error
189191
comparison.expect(:base_image_path, Pathname.new("screenshot.base.png"))
190192
comparison.expect(:error_message, "expected error message for non minitest")
191193

192-
assertion = CapybaraScreenshotDiff::ScreenshotAssertion.from([["my_test.rb:42"], "sample_screenshot", comparison])
194+
assertion = CapybaraScreenshotDiff::ScreenshotAssertion.new("sample_screenshot")
195+
assertion.caller = ["my_test.rb:42"]
196+
assertion.compare = comparison
193197
CapybaraScreenshotDiff.add_assertion(assertion)
194198
end
195199
end

0 commit comments

Comments
 (0)