Closed ingolfured closed 4 years ago
I'm not super familiar with spring and guard configuration, but is it similar to Zeus? If so it's probably worth checking out https://github.com/tristandunn/pusher-fake/issues/34 which fixes the same issue here. You basically only want the server and configuration to be run once. If not I can try digging around in the near future.
FYI I left the other issue open and will leave this issue open once resolved as I'd like to provide instructions and possibly better integration for all three libraries.
Yeah, this is a side-effect of the weird launch-server-on-require logic that I'm always poking about ranting about... AND THAT I AM TOTALLY GOING TO FIX, PROMISE.
To get around this on wordset, I'm doing the following:
config.before(:suite) do
#DatabaseCleaner.orm = "mongoid"
DatabaseCleaner.strategy = :truncation
require 'pusher-fake/support/base'
end
And, my initializers/pusher.rb looks like this now:
require 'pusher'
if Rails.env == "production"
Pusher.url = ENV["PUSHER_URL"]
Pusher.logger = Rails.logger
else
Pusher.app_id = "wordset"
Pusher.key = "key"
Pusher.secret = "mybigsecret"
if Rails.env.development?
require 'pusher-fake/support/base'
end
end
Guessing this is fine to close after five years. Feel free to open a new issue or submit a patch with instructions if you have it working now.
I'm running Rails 3.2 with guard 2.12.5, spring 1.3.3 and pusher-fake 1.3.0. When run my test the second time, it seems like the pusher-fake assign another port which is not being updated by spring. The error I'm getting is
Connection refused - connect(2) (http://127.0.0.1:50555) (Errno::ECONNREFUSED) (Pusher::HTTPError)
on every spec I run. When I do spring stop and run it again, everything seems fine. Don't know if I should post this here or at spring/guard but what do you guys think?