tristandunn / pusher-fake

A fake Pusher server for development and testing.
https://rubygems.org/gems/pusher-fake
MIT License
173 stars 32 forks source link

not sure what I am doing wrong #47

Closed PatrickArthur closed 8 years ago

PatrickArthur commented 8 years ago

I install the gem, I am creating the new pusher instant in a javascript file and include this in the top of my application html

`

when I run my tests I get an error saying

Warning: Pusher.app_id is not set. Should be set before including PusherFake. Warning: Pusher.key is not set. Should be set before including PusherFake. Warning: Pusher.secret is not set. Should be set before including PusherFake

tristandunn commented 8 years ago

You need to configure Pusher before including PusherFake, just as it says.

# Ensure Pusher configuration is set if you're not doing so elsewhere.
Pusher.app_id = "MY_TEST_ID"
Pusher.key    = "MY_TEST_KEY"
Pusher.secret = "MY_TEST_SECRET"

# Require the testing framework file.
require "pusher-fake/support/rspec"
PatrickArthur commented 7 years ago

I did that in my config/initializer/pusher.rb file and it still gives me the issue, the test I am running runs a class that runs a mailer and pusher.trigger...seems to error out always saying the app-key isn't defined.

tristandunn commented 7 years ago

You must be initializing the fake before the configuration then, since the warnings aren't show until it's included. Perhaps add some logging yourself to see the loading order and adjust it.