-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
ActiveSupport::Concern#prepended
usage for Rails 6 (#662)
`ActiveSupport::Concern#prepended` is only available in Rails 6.1+. Since we support `>= 5.2` we can't rely on the `prepended` callback in `lib/stimulus_reflex/cable_readiness.rb`. Since we can easily support Rails 5.2 and Rails 6.0 with this fix. Otherwise we would need to make StimulusReflex depend on Rails 6.1+, which seems rather dramatic. Fixes #656
- Loading branch information
Showing
2 changed files
with
23 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "test_helper" | ||
|
||
class MyReflexPrepended | ||
prepend StimulusReflex::CableReadiness | ||
|
||
def id | ||
"123" | ||
end | ||
|
||
def stream_name | ||
"123" | ||
end | ||
end | ||
|
||
class StimulusReflex::CableReadinessTest < ActiveSupport::TestCase | ||
test "can be prepended" do | ||
reflex = MyReflexPrepended.new | ||
assert_includes reflex.methods, :cable_ready | ||
end | ||
end |