Skip to content

Commit 537816a

Browse files
justin808claude
andcommitted
Use mock request object instead of real HTTPX::Request
The HTTPX::Request constructor requires 3-4 arguments, not 2. Instead of figuring out the exact signature, use an RSpec instance_double to create a minimal mock request object that satisfies the ErrorResponse constructor. This fixes the test failure: ArgumentError: wrong number of arguments (given 2, expected 3..4) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6ebb06c commit 537816a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

react_on_rails_pro/spec/react_on_rails_pro/request_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,11 @@
245245
# This simulates a connection error after partial data is sent
246246
mock_streaming_response(render_full_url, 200) do |yielder|
247247
yielder.call("#{original_chunks[0]}\n")
248-
# Simulate connection error mid-stream
249-
# HTTPError expects a response object, so create a mock error response
248+
# Simulate connection error mid-stream by creating a mock error response
249+
# Create a minimal mock request object that satisfies the ErrorResponse constructor
250+
mock_request = instance_double(HTTPX::Request, uri: URI(render_full_url))
250251
error_response = HTTPX::ErrorResponse.new(
251-
HTTPX::Request.new("POST", render_full_url),
252+
mock_request,
252253
StandardError.new("Connection closed")
253254
)
254255
raise HTTPX::HTTPError, error_response

0 commit comments

Comments
 (0)