Skip to content
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

Tests: rely on load hooks instead of class constants #514

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seanpdoyle
Copy link
Contributor

Follow-up to #513

Rely on on_load hooks to extend test helpers. Despite the fact that Action Cable is an optional dependency and Action Dispatch is not, this commit replaces all class-style extensions with on_load hooks for the sake of consistency.

There isn't a hook for ActionCable::Channel::TestCase, so waiting for action_cable_channel to fire is the best that we can do.

Follow-up to [hotwired#513][]

Rely on [on_load hooks][] to extend test helpers. Despite the fact that
Action Cable is an optional dependency and Action Dispatch is not, this
commit replaces all `class`-style extensions with `on_load` hooks for
the sake of consistency.

There isn't a hook for `ActionCable::Channel::TestCase`, so waiting for
`action_cable_channel` to fire is the best that we can do.

[hotwired#513]: hotwired#513
[on_load hooks]: https://guides.rubyonrails.org/engines.html#available-load-hooks
@xymbol
Copy link

xymbol commented Nov 13, 2023

In #512 and #513, we're dealing with runtime configuration, i.e. apps that load turbo-rails but don't require actioncable, but this can't happen in tests—unless I'm missing something.

@seanpdoyle In which situation do we need this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants