Skip to content

Commit 7bb0eb1

Browse files
justin808claude
andcommitted
Add options stub to mock request object
The HTTPX::ErrorResponse constructor also calls request.options during initialization. Add this stub using instance_double to satisfy RuboCop's VerifiedDoubles cop and prevent the test from failing with: received unexpected message :options with (no args) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent cf5a797 commit 7bb0eb1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

react_on_rails_pro/spec/react_on_rails_pro/request_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,13 @@
247247
yielder.call("#{original_chunks[0]}\n")
248248
# Simulate connection error mid-stream by creating a mock error response
249249
# Create a minimal mock request object that satisfies the ErrorResponse constructor
250-
mock_request = instance_double(HTTPX::Request, uri: URI(render_full_url), response: nil)
250+
mock_options = instance_double(HTTPX::Options, timeout: {})
251+
mock_request = instance_double(
252+
HTTPX::Request,
253+
uri: URI(render_full_url),
254+
response: nil,
255+
options: mock_options
256+
)
251257
error_response = HTTPX::ErrorResponse.new(
252258
mock_request,
253259
StandardError.new("Connection closed")

0 commit comments

Comments
 (0)