diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2019-07-04 11:53:31 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-07-04 11:53:31 +0300 |
commit | efde6f7db97bd3962732b6885040dcc98ab46cd4 (patch) | |
tree | 13e4f43bea42d5a0372262e4854e002718de522f /spec/features/oauth_login_spec.rb | |
parent | ac6cebce1264ca858ec71648f4e914f61459afb2 (diff) |
OmniAuth full_host spec helper
Allows us to correctly set omniauth's full_host
so redirects take the port into account.
Needed when running selenium tests on a different port
Diffstat (limited to 'spec/features/oauth_login_spec.rb')
-rw-r--r-- | spec/features/oauth_login_spec.rb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/spec/features/oauth_login_spec.rb b/spec/features/oauth_login_spec.rb index 5ebfc32952d..86331728f88 100644 --- a/spec/features/oauth_login_spec.rb +++ b/spec/features/oauth_login_spec.rb @@ -16,16 +16,8 @@ describe 'OAuth Login', :js, :allow_forgery_protection do providers = [:github, :twitter, :bitbucket, :gitlab, :google_oauth2, :facebook, :cas3, :auth0, :authentiq, :salesforce] - before(:all) do - # The OmniAuth `full_host` parameter doesn't get set correctly (it gets set to something like `http://localhost` - # here), and causes integration tests to fail with 404s. We set the `full_host` by removing the request path (and - # anything after it) from the request URI. - @omniauth_config_full_host = OmniAuth.config.full_host - OmniAuth.config.full_host = ->(request) { request['REQUEST_URI'].sub(/#{request['REQUEST_PATH']}.*/, '') } - end - - after(:all) do - OmniAuth.config.full_host = @omniauth_config_full_host + around(:all) do |example| + with_omniauth_full_host { example.run } end def login_with_provider(provider, enter_two_factor: false) |