Skip to content

Commit

Permalink
Refactor integration tests to allow configuration of Faye port for te…
Browse files Browse the repository at this point in the history
…sting.
  • Loading branch information
mjtko committed Mar 13, 2013
1 parent 6187c23 commit 9ea95bc
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Kandan.Broadcasters.FayeBroadcaster

constructor: ()->
@fayeClient = new Faye.Client("<%= ENV['FULL_HOST'] %>/remote/faye")
@fayeClient = new Faye.Client("<%= ENV['KANDAN_FAYE_URL'] %>/remote/faye")

@fayeClient.disable('websocket')
authExtension = {
Expand Down
3 changes: 2 additions & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
config.active_support.deprecation = :stderr

# Variable set to be able to get faye client for test environments
ENV['FULL_HOST'] = "http://localhost:9292"
ENV['KANDAN_FAYE_PORT'] = "9292" unless ENV['KANDAN_FAYE_PORT']
ENV['KANDAN_FAYE_URL'] = "http://localhost:#{ENV['KANDAN_FAYE_PORT']}" unless ENV['KANDAN_FAYE_URL']

end
2 changes: 1 addition & 1 deletion lib/broadcasters/faye.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def broadcast(channel, message)
end

def assets
["#{ENV['FULL_HOST']}/remote/faye.js"]
["#{ENV['KANDAN_FAYE_URL']}/remote/faye.js"]
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
ActiveUsers.remove_by_client_id(client_id)
end

Thread.new {faye_server.listen(9292)}
Thread.new {faye_server.listen(ENV['KANDAN_FAYE_PORT'].to_i)}

Capybara.app = Rack::URLMap.new({
"/" => Kandan::Application
Expand Down

0 comments on commit 9ea95bc

Please sign in to comment.