summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/test_helper.rb20
-rw-r--r--users/test/integration/api/rack_test.rb3
-rw-r--r--users/test/integration/browser/account_test.rb2
3 files changed, 14 insertions, 11 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index c6794f4..a409b58 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -12,24 +12,30 @@ class ActiveSupport::TestCase
end
require 'capybara/poltergeist'
-Capybara.javascript_driver = :poltergeist
CONFIG_RU = (Rails.root + 'config.ru').to_s
OUTER_APP = Rack::Builder.parse_file(CONFIG_RU).first
Capybara.register_driver :rack_test do |app|
- Capybara::RackTest::Driver.new(OUTER_APP)
+ Capybara::RackTest::Driver.new(app)
+end
+
+Capybara.register_driver :poltergeist do |app|
+ Capybara::Poltergeist::Driver.new(app)
end
-# Transactional fixtures do not work with Selenium tests, because Capybara
-# uses a separate server thread, which the transactions would be hidden
-# from. We hence use DatabaseCleaner to truncate our test database.
+# this is integration testing. So let's make the whole
+# rack stack available...
+Capybara.app = OUTER_APP
+Capybara.run_server = true
+Capybara.app_host = 'http://lvh.me:3003'
+Capybara.server_port = 3003
+Capybara.javascript_driver = :poltergeist
+
class BrowserIntegrationTest < ActionDispatch::IntegrationTest
# Make the Capybara DSL available
include Capybara::DSL
- Capybara.app_host = 'http://localhost:3000'
- Capybara.server_port = 3000
teardown do
Capybara.reset_sessions! # Forget the (simulated) browser state
Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver
diff --git a/users/test/integration/api/rack_test.rb b/users/test/integration/api/rack_test.rb
index da960f2..9a69f52 100644
--- a/users/test/integration/api/rack_test.rb
+++ b/users/test/integration/api/rack_test.rb
@@ -1,6 +1,3 @@
-CONFIG_RU = (Rails.root + 'config.ru').to_s
-OUTER_APP = Rack::Builder.parse_file(CONFIG_RU).first
-
class RackTest < ActiveSupport::TestCase
include Rack::Test::Methods
include Warden::Test::Helpers
diff --git a/users/test/integration/browser/account_test.rb b/users/test/integration/browser/account_test.rb
index 4fff637..5483c89 100644
--- a/users/test/integration/browser/account_test.rb
+++ b/users/test/integration/browser/account_test.rb
@@ -1,7 +1,7 @@
class AccountTest < BrowserIntegrationTest
setup do
- Capybara.current_driver = Capybara.javascript_driver # :selenium by default
+ Capybara.current_driver = Capybara.javascript_driver
end
test "normal account workflow" do