Skip to content

Commit

Permalink
Merge pull request #212 from mjtko/fix/repeated-id
Browse files Browse the repository at this point in the history
Refactor integration test to not require standards violating repeated element ID
  • Loading branch information
gabceb committed Mar 14, 2013
2 parents 989d673 + 6f2b972 commit 82cfd2c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 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
2 changes: 1 addition & 1 deletion app/assets/templates/chatbox.jst.eco
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<textarea class="chat-input" id="chat-input"></textarea>
<textarea class="chat-input"></textarea>
<button class="post">Post</button>
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
8 changes: 5 additions & 3 deletions spec/features/login_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@
page.should have_content(@user.first_name)
page.should have_content(@user.last_name)

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

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

fill_in "chat-input", :with => "Hi again"
chat_input.set "Hi again"
click_button "Post"

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

end
end
end
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 82cfd2c

Please sign in to comment.