summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-05-07 11:59:43 +0900
committerShinya Maeda <shinya@gitlab.com>2018-05-07 11:59:43 +0900
commit1f39fcd1123c1a65798a0a0b3e5f3b2fa43651ac (patch)
tree8d8a6a5a6a424c3f61332e509b97ab85cf0167b5 /spec/support
parentc1d3b48c96ce44a2ff3e84cb89063a00c67297f5 (diff)
parent58aa2d7f395be4aee38b5202ef1666879505c737 (diff)
downloadgitlab-ce-1f39fcd1123c1a65798a0a0b3e5f3b2fa43651ac.tar.gz
Merge branch 'master' into live-trace-v2
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/helpers/terms_helper.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/support/helpers/terms_helper.rb b/spec/support/helpers/terms_helper.rb
new file mode 100644
index 00000000000..a00ec14138b
--- /dev/null
+++ b/spec/support/helpers/terms_helper.rb
@@ -0,0 +1,19 @@
+module TermsHelper
+ def enforce_terms
+ stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
+ settings = Gitlab::CurrentSettings.current_application_settings
+ ApplicationSettings::UpdateService.new(
+ settings, nil, terms: 'These are the terms', enforce_terms: true
+ ).execute
+ end
+
+ def accept_terms(user)
+ terms = Gitlab::CurrentSettings.current_application_settings.latest_terms
+ Users::RespondToTermsService.new(user, terms).execute(accepted: true)
+ end
+
+ def expect_to_be_on_terms_page
+ expect(current_path).to eq terms_path
+ expect(page).to have_content('Please accept the Terms of Service before continuing.')
+ end
+end