Skip to content

Commit 9ea95bc

Browse files
committed
Refactor integration tests to allow configuration of Faye port for testing.
1 parent 6187c23 commit 9ea95bc

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

app/assets/javascripts/backbone/broadcasters/faye.js.coffee.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class Kandan.Broadcasters.FayeBroadcaster
22

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

66
@fayeClient.disable('websocket')
77
authExtension = {

config/environments/test.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
config.active_support.deprecation = :stderr
3737

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

4142
end

lib/broadcasters/faye.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def broadcast(channel, message)
1313
end
1414

1515
def assets
16-
["#{ENV['FULL_HOST']}/remote/faye.js"]
16+
["#{ENV['KANDAN_FAYE_URL']}/remote/faye.js"]
1717
end
1818
end
1919
end

spec/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
ActiveUsers.remove_by_client_id(client_id)
3535
end
3636

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

3939
Capybara.app = Rack::URLMap.new({
4040
"/" => Kandan::Application

0 commit comments

Comments
 (0)