Closed patmbolger closed 8 years ago
You're publishing events on the same channel. See Publishing Events.
Sorry, I totally read the issue incorrectly. Looking into it.
You're checking Pusher.channels
not PusherFake::Channel.channels
.
Also, I'm not sure a test like this is going to work since the servers are in a fork. It's not design to be for unit testing like this. And a unit test isn't typically supposed to check the integration so much. Why not just verify the Pusher.trigger
method calls and verify the full workflow in an integration test?
You're right and I realize I was doing something here not entirely suited to the design (limited workflow testing from a model (unit) rspec test). I thought I'd give it a shot in any case. I will take your advice and focus on acceptance/cucumber tests for the complete workflow.
Thanks for taking a look for me.
I am using V 1.5 of the gem. I have a couple of simple respect tests that confirm that a channel is being opened when an event occurs on the server side of my app.
Here is the test code:
Here is the code under test:
I get this output when I run the tests:
The first test always succeeds and the second fails, regardless of which order I run the tests. So, somehow the channel reset is not actually working.
I have this in spec/rails_helper.rb:
And I am initializing the Pusher app ID, key and secret in config/initializers/pusher.rb.
Note that I running these tests as model rspec tests. Might that cause PusherFake::Channel.reset not to work? If so, any idea on a work-around? (for various reasons I am creating Pusher events from a model, not a controller).
Thanks for your help.