Skip to content

Add unit tests for SSE::ConnectionProxy#245

Merged
rsamoilov merged 1 commit intorage-rb:mainfrom
jsxs0:add-connection-proxy-specs
Mar 25, 2026
Merged

Add unit tests for SSE::ConnectionProxy#245
rsamoilov merged 1 commit intorage-rb:mainfrom
jsxs0:add-connection-proxy-specs

Conversation

@jsxs0
Copy link
Copy Markdown
Contributor

@jsxs0 jsxs0 commented Mar 25, 2026

Summary

  • Add comprehensive unit tests for Rage::SSE::ConnectionProxy — the only SSE component without dedicated unit test coverage
  • Cover all public methods: write, <<, close, close_write, closed?, flush, read, close_read
  • Include a lightweight MockConnection that mirrors Iodine's connection interface (write, close, open?)

Context

While reading through the SSE implementation, I noticed that every other SSE component has dedicated specs:

  • spec/sse/sse_spec.rb — tests Rage::SSE.__serialize and .message
  • spec/sse/message_spec.rb — tests Rage::SSE::Message#to_s
  • spec/controller/api/sse_spec.rb — tests controller-level SSE rendering
  • spec/integration/sse_spec.rb — end-to-end SSE tests

But ConnectionProxy had none. These tests verify the proxy correctly delegates to the underlying connection, converts data via to_s, raises IOError on closed streams, and that no-op methods (read, close_read) behave as expected.

Test plan

  • bundle exec rspec spec/sse/connection_proxy_spec.rb — 15 examples, 0 failures
  • bundle exec rspec spec/sse/ — 44 examples, 0 failures (all existing SSE tests still pass)

Add comprehensive unit tests for Rage::SSE::ConnectionProxy, covering
all public methods: write, <<, close, close_write, closed?, flush,
read, and close_read. This is the only SSE component without dedicated
unit test coverage.
@jsxs0 jsxs0 force-pushed the add-connection-proxy-specs branch from 1cea1c5 to 5306cf4 Compare March 25, 2026 04:20
Copy link
Copy Markdown
Member

@rsamoilov rsamoilov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests look good! Thank you for the contribution!

@rsamoilov rsamoilov merged commit eefe852 into rage-rb:main Mar 25, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants