Skip to content

Commit 82cfd2c

Browse files
committed
Merge pull request #212 from mjtko/fix/repeated-id
Refactor integration test to not require standards violating repeated element ID
2 parents 989d673 + 6f2b972 commit 82cfd2c

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
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 = {

app/assets/templates/chatbox.jst.eco

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<textarea class="chat-input" id="chat-input"></textarea>
1+
<textarea class="chat-input"></textarea>
22
<button class="post">Post</button>

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/features/login_spec.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,21 @@
2323
page.should have_content(@user.first_name)
2424
page.should have_content(@user.last_name)
2525

26-
fill_in "chat-input", :with => "Hello there"
26+
expect(page).to have_css('.chat-input')
27+
chat_input = find(:css, ".chat-input")
28+
chat_input.set "Hello there"
2729
click_button "Post"
2830

2931
within("#channel-activities-1") do
3032
page.should have_content("Hello there")
3133
end
3234

33-
fill_in "chat-input", :with => "Hi again"
35+
chat_input.set "Hi again"
3436
click_button "Post"
3537

3638
within("#channel-activities-1") do
3739
page.should have_content("Hi again")
3840
end
3941

4042
end
41-
end
43+
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)