Created
July 1, 2013 00:33
-
-
Save delba/5897662 to your computer and use it in GitHub Desktop.
Poltergeist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'capybara/rails' | |
| require 'capybara/poltergeist' | |
| class ActionDispatch::IntegrationTest | |
| include Capybara::DSL | |
| Capybara.javascript_driver = :poltergeist | |
| setup do | |
| Capybara.current_driver = Capybara.javascript_driver | |
| end | |
| teardown do | |
| Capybara.use_default_driver | |
| end | |
| end | |
| class ActiveRecord::Base | |
| mattr_accessor :shared_connection | |
| @@shared_connection = nil | |
| def self.connection | |
| @@shared_connection || retrieve_connection | |
| end | |
| end | |
| # Forces all threads to share the same connection. This works on | |
| # Capybara because it starts the web server in a thread. | |
| ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment