summaryrefslogtreecommitdiff
path: root/spec/features/users
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-04-27 14:56:50 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-05-04 13:54:43 +0200
commit10aa55a770c2985c22c92d17b8a7ea90b0a09085 (patch)
tree15b66bb5e3f26d0a49c07bf781c644deb998f0c8 /spec/features/users
parent65bea3f7d0bf30b5f9a9b3f94567474d3c8f7cbc (diff)
downloadgitlab-ce-10aa55a770c2985c22c92d17b8a7ea90b0a09085.tar.gz
Allow a user to accept/decline terms
When a user accepts, we store this in the agreements to keep track of which terms they accepted. We also update the flag on the user.
Diffstat (limited to 'spec/features/users')
-rw-r--r--spec/features/users/terms_spec.rb27
1 files changed, 25 insertions, 2 deletions
diff --git a/spec/features/users/terms_spec.rb b/spec/features/users/terms_spec.rb
index 34e759bc56a..a33f0937fab 100644
--- a/spec/features/users/terms_spec.rb
+++ b/spec/features/users/terms_spec.rb
@@ -5,12 +5,35 @@ describe 'Users > Terms' do
let!(:term) { create(:term, terms: 'By accepting, you promise to be nice!') }
before do
+ stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
sign_in(user)
-
- visit terms_path
end
it 'shows the terms' do
+ visit terms_path
+
expect(page).to have_content('By accepting, you promise to be nice!')
end
+
+ context 'declining the terms' do
+ it 'returns the user to the app' do
+ visit terms_path
+
+ click_button 'Decline and sign out'
+
+ expect(page).not_to have_content(term.terms)
+ expect(user.reload.terms_accepted?).to be(false)
+ end
+ end
+
+ context 'accepting the terms' do
+ it 'returns the user to the app' do
+ visit terms_path
+
+ click_button 'Accept terms'
+
+ expect(page).not_to have_content(term.terms)
+ expect(user.reload.terms_accepted?).to be(true)
+ end
+ end
end