Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-07-27 12:15:57 +0300
committerRémy Coutable <remy@rymai.me>2017-07-28 17:33:30 +0300
commit60797a42b419841e14f50f85bf8daa2a115a72f9 (patch)
tree930ea47354df7c2e415cf77dbb727967da97296a /spec/support/capybara.rb
parent48c51e207e4cba8a69e4ca65cba1e169d384cefa (diff)
Ensure Gitlab::Application.routes.default_url_options are set correctly in Capybara + :js specs
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/support/capybara.rb')
-rw-r--r--spec/support/capybara.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index 3e5d6cf1364..c45c4a4310d 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -36,7 +36,14 @@ RSpec.configure do |config|
$capybara_server_already_started = true
end
- config.after(:each, :js) do |example|
+ config.before(:example, :js) do
+ allow(Gitlab::Application.routes).to receive(:default_url_options).and_return(
+ host: Capybara.current_session.server.host,
+ port: Capybara.current_session.server.port,
+ protocol: 'http')
+ end
+
+ config.after(:example, :js) do |example|
# capybara/rspec already calls Capybara.reset_sessions! in an `after` hook,
# but `block_and_wait_for_requests_complete` is called before it so by
# calling it explicitely here, we prevent any new requests from being fired