Skip to content

Commit

Permalink
Merge pull request #47483 from palkan/fix/channel-test-case-test-server
Browse files Browse the repository at this point in the history
Fix using TestServer in ConnectionStub
  • Loading branch information
rafaelfranca committed Mar 3, 2023
2 parents 5aa84bc + 8fff6d6 commit 1bc9db4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion actioncable/lib/action_cable/channel/base.rb
Expand Up @@ -286,7 +286,7 @@ def action_signature(action, data)
end

def parameter_filter
@parameter_filter ||= ActiveSupport::ParameterFilter.new(connection.server.config.filter_parameters)
@parameter_filter ||= ActiveSupport::ParameterFilter.new(connection.config.filter_parameters)
end

def transmit_subscription_confirmation
Expand Down
4 changes: 2 additions & 2 deletions actioncable/lib/action_cable/channel/test_case.rb
Expand Up @@ -45,7 +45,7 @@ def start_periodic_timers; end
end

class ConnectionStub
attr_reader :transmissions, :identifiers, :subscriptions, :logger, :server
attr_reader :transmissions, :identifiers, :subscriptions, :logger, :config

def initialize(identifiers = {})
@transmissions = []
Expand All @@ -57,7 +57,7 @@ def initialize(identifiers = {})
@subscriptions = ActionCable::Connection::Subscriptions.new(self)
@identifiers = identifiers.keys
@logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new)
@server = TestServer.new
@config = ActionCable::Server::Configuration.new
end

def transmit(cable_message)
Expand Down
2 changes: 1 addition & 1 deletion actioncable/lib/action_cable/connection/base.rb
Expand Up @@ -51,7 +51,7 @@ class Base
include ActiveSupport::Rescuable

attr_reader :server, :env, :subscriptions, :logger, :worker_pool, :protocol
delegate :event_loop, :pubsub, to: :server
delegate :event_loop, :pubsub, :config, to: :server

def initialize(server, env, coder: ActiveSupport::JSON)
@server, @env, @coder = server, env, coder
Expand Down
2 changes: 1 addition & 1 deletion actioncable/test/stubs/test_connection.rb
Expand Up @@ -5,7 +5,7 @@
class TestConnection
attr_reader :identifiers, :logger, :current_user, :server, :subscriptions, :transmissions

delegate :pubsub, to: :server
delegate :pubsub, :config, to: :server

def initialize(user = User.new("lifo"), coder: ActiveSupport::JSON, subscription_adapter: SuccessAdapter)
@coder = coder
Expand Down

0 comments on commit 1bc9db4

Please sign in to comment.