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

Allow for front end tests with poltergeist #206

Merged
merged 10 commits into from
Mar 13, 2013
Merged

Allow for front end tests with poltergeist #206

merged 10 commits into from
Mar 13, 2013

Conversation

oponder
Copy link
Contributor

@oponder oponder commented Mar 12, 2013

Submitting this as a conversation starter for issue #149.

It adds poltergeist and capybara to allow testing of the frontend.

I had to do some judo with Faye to get it all running. I'm not very happy with the conditionals on Rails.env that I introduced, so if anyone has better ideas let me know!

Also includes a proof of concept test (spec/features/login_spec.rb). Which tests the login, as well as submitting of a couple of chat messages.

@coveralls
Copy link

Coverage increased (+6.58%) when pulling 6c89ac3 on oponder:front_end_tests_with_poltergeist into 804b508 on kandanapp:master.

View Details

@fusion94
Copy link
Member

@coveralls
Copy link

Coverage increased (+9.27%) when pulling 74967a7 on oponder:front_end_tests_with_poltergeist into 804b508 on kandanapp:master.

View Details

@oponder
Copy link
Contributor Author

oponder commented Mar 12, 2013

Looks like poltergeist just needed a larger timeout in the Travis environment.

Also, this is just a suggested route! No worries If you guys already had something in mind for the code. Don't want to step on anyone's toes. 😄

@fusion94
Copy link
Member

@oponder Someone is supposed to verify all of this later today. I'm expecting the PR to be accepted in a few hours.

@@ -1,7 +1,13 @@
class Kandan.Broadcasters.FayeBroadcaster

constructor: ()->
<% if Rails.env == "test" %>
@fayeClient = new Faye.Client("http://localhost:9292/remote/faye")
Copy link
Member

Choose a reason for hiding this comment

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

What about adding an env variable on each of the .rb files on /config/environments?

test.rb -> ENV['HOST'] = "http://localhost:9292"

production.rb and development.rb -> ENV['HOST'] = ""

You can use "#{ENV["HOST"]}/remote/faye" which will return the desired url for each host.

Anyways we will need this ENV variable for mailer eventually

@oponder
Copy link
Contributor Author

oponder commented Mar 13, 2013

@gabceb: That makes sense!

What do you think about using ActionMailer::Base.default_url_options[:host] instead of ENV['host']? like in this commit https://github.com/oponder/kandan/commit/c592bef3eed289ccf0c06f0f443d89658de1070d

@coveralls
Copy link

Coverage increased (+9.38%) when pulling c592bef on oponder:front_end_tests_with_poltergeist into 804b508 on kandanapp:master.

View Details

@gabceb
Copy link
Member

gabceb commented Mar 13, 2013

That works too! 👍

gabceb added a commit that referenced this pull request Mar 13, 2013
Allow for front end tests with poltergeist
@gabceb gabceb merged commit 6c2b3fe into kandanapp:master Mar 13, 2013
ar7em pushed a commit to ar7em/kandan that referenced this pull request Jun 9, 2013
…ltergeist

Allow for front end tests with poltergeist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants