-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ActionCable::Connection::TestCase #34845
Add ActionCable::Connection::TestCase #34845
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish that could be included to 5.2 branch.
# end | ||
# end | ||
# | ||
# You can also provide additional information about underlying HTTP request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it makes sense to mention the support of signed/encrypted/plain cookies API, headers, env, and session in the documentation.
|
||
# Performs connection attempt (i.e. calls #connect method). | ||
# | ||
# Accepts request path as the first argument and cookies and headers as options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
env
and session
options are missed here. cookies
are no more an option
# class ConnectionTest < ActionCable::Connection::TestCase | ||
# def test_connects_with_cookies | ||
# # Simulate a connection | ||
# connect cookies: { user_id: users[:john].id } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right that this example is not relevant due to the new cookies API?
# Asserts that the connection is rejected (via +reject_unauthorized_connection+). | ||
# | ||
# # Asserts that connection without user_id fails | ||
# assert_reject_connection { connect cookies: { user_id: '' } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
641d1c8
to
2111bc2
Compare
2111bc2
to
9029667
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️❤️❤️
👍 Great to see |
@rafaelfranca @kaspth Hey folks! Is there any chance for get this reviewed (and, hopefully, merged for Beta 1) and thus finish the |
I just saw the other comment and I have added this PR to my list! If all goes well, I'll get to this before beta1 🙏 |
There we go, thanks @palkan! |
Summary
Follow-up for #33659.
That's the final part of
action-cable-testing
merging.Connection tests are written as follows:
connect
method to simulate connection establishment (=connect
callback invocation).For example:
You can also specify cookies, headers, Rack–all the options available for integration tests–plus session
Other Information
This PR doesn't contain a changelog entry intentionally (as the previous two): I'll add a change log in another PR, in which I'd like to update a testing guide as well.