Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor integration test to not require standards violating repeated element ID #212

Merged
merged 3 commits into from
Mar 14, 2013
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why KANDAN_FAYE_URL vs KANDAN_HOST? I don't think that variable name is very descriptive of the actual value of the variable since it is not faye specific

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... My understanding was that it is Faye specific though! Where is it used for anything other than Faye?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only used there now but may be used in other places later and since the variable value is not really faye specific it may be confusing in the future. No big deal anyways. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In which case, I'd suggest that we rename it when/if we use it elsewhere. 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


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
7 changes: 4 additions & 3 deletions spec/features/login_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,20 @@
page.should have_content(@user.first_name)
page.should have_content(@user.last_name)

fill_in "chat-input", :with => "Hello there"
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