Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

pusher should work even if pusher-fake gem is present #5

Open
@catmando

Description

@catmando

right now you say set up pusher fake, but setting up normal pusher config, then merging in pusher fake config.

(This is the recommended pusher-fake approach)

However the client side code detects pusher-fake by noticing the PusherFake constant. Thus the only way to turn off pusher fake is by removing the gem (or removing the constant which is how the test cases do it.)

There must be a better approach.

Perhaps just add add a transport: pusher-fake, which would take care of the pusher-fake setup under the hood. Thus:

      require 'pusher'
      require 'pusher-fake'
      Pusher.app_id = "MY_TEST_ID"
      Pusher.key =    "MY_TEST_KEY"
      Pusher.secret = "MY_TEST_SECRET"
      require "pusher-fake/support/base"

      Synchromesh.configuration do |config|
        config.transport = :pusher
        config.channel_prefix = "synchromesh"
        config.opts = {
          app_id: Pusher.app_id,
          key: Pusher.key,
          secret: Pusher.secret,
          auth: {headers: {'X-CSRF-Token': "123"}},
          authEndpoint: "rr/synchromesh-pusher-auth"
        }.merge(PusherFake.configuration.web_options)
      end

becomes

      Synchromesh.configuration do |config|
        config.transport = :pusher_fake
        config.channel_prefix = "synchromesh"
        config.opts = {
          app_id: ...app_id...,
          key: ...key...,
          secret: ...secret...,
        }
      end

with all the other cruft getting merged in under the hood, and if app, key and secret are missing they just get defaulted to dummy values.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions