Skip to content

Conversation

@palkan
Copy link
Contributor

@palkan palkan commented Feb 23, 2023

Motivation / Background

Closes #47377.

Detail

It's an alternative implementation to #47409.

The solution in #47409 suggest promoting TestServer to be an official part of the Action Cable, which, I believe, isn't a good idea. The whole purpose of Channels/Connections testing it to make it possible to test logic in isolation from any kind of a server.

This PR fixes the original server leakage by making channel dependent on the configuration (which is fine, it's a part of the abstraction, not implementation), without directly depending on a server.

Checklist

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

It's an internal testing entity, we cannot use it in a test case class
@palkan palkan force-pushed the fix/channel-test-case-test-server branch from 54f841d to 8fff6d6 Compare February 23, 2023 20:32
@hahmed
Copy link
Contributor

hahmed commented Feb 23, 2023

I would not say official because it's nodoc'd 😂 but yup, this LGTM.

@hahmed hahmed added the ready PRs ready to merge label Feb 24, 2023
@rafaelfranca rafaelfranca merged commit 1bc9db4 into rails:main Mar 3, 2023
@palkan palkan deleted the fix/channel-test-case-test-server branch March 6, 2023 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

actioncable ready PRs ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using ActionCable::Channel::TestCase causes NameError: TestServer is missing

3 participants