From ac9746e4317356c5d1ab18659928f1d1cc9d46cb Mon Sep 17 00:00:00 2001 From: Felix Wolfsteller Date: Thu, 24 Sep 2020 12:47:25 +0200 Subject: [PATCH] improve test #13 --- app/views/terms_acceptances/show.html.haml | 28 ++++++++++++++-------- test/system/tos_test.rb | 26 ++++++++++++++++++-- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/app/views/terms_acceptances/show.html.haml b/app/views/terms_acceptances/show.html.haml index 6d2d399..2803405 100644 --- a/app/views/terms_acceptances/show.html.haml +++ b/app/views/terms_acceptances/show.html.haml @@ -14,13 +14,21 @@ .content.is-medium.has-text-justified != SiteSetting['terms'] -= form_with url: terms_acceptance_path, builder: BulmaFormBuilder::FormBuilder do |f| - .field - = label_tag :accept_terms, t('activerecord.attributes.user.tos_agreement') - = f.check_box :accept_terms - .field - = label_tag :read_privacy_terms, t('activerecord.attributes.user.read_privacy_terms') - = f.check_box :read_privacy_terms - .actions - = f.submit t('Save'), class: 'button is-primary' - +.columns + .column.is-half + %h2.title + = t('.acceptance') + = form_with url: terms_acceptance_path, builder: BulmaFormBuilder::FormBuilder do |f| + .field + = f.check_box :accept_terms + = label_tag :accept_terms, t('activerecord.attributes.user.tos_agreement') + .field + = f.check_box :read_privacy_terms + = label_tag :read_privacy_terms, t('activerecord.attributes.user.read_privacy_terms') + .actions + = f.submit t('Save'), class: 'button is-primary' + .column.is-half + %h2.title + = t('.actions') + .block + = t('.not-happy?') diff --git a/test/system/tos_test.rb b/test/system/tos_test.rb index 8663213..0070446 100644 --- a/test/system/tos_test.rb +++ b/test/system/tos_test.rb @@ -70,8 +70,30 @@ class TosTest < ApplicationSystemTestCase click_on "Anmelden" assert_selector '.notification', text: /Du musst/ - assert_selector 'button', text: 'gelesen' - assert_selector 'button', text: 'löschen' + assert_selector '.button', text: 'Mein Konto zerstören' + assert_selector '.button', text: 'Zeig mir meine Daten!' + + visit root_path + + assert_equal terms_acceptance_path, page.current_path + + assert_selector '.notification', text: /Du musst/ + assert_selector '.button', text: 'Mein Konto zerstören' + assert_selector '.button', text: 'Zeig mir meine Daten!' + + #click_on 'Speichern' + + assert_selector '.notification', text: /Du musst/ + + check 'Datenschutzhinweise gelesen' + check 'Stimme AGB zu' + + click_on 'Speichern' + + assert_selector '.notification', text: /Willkommen/ + + user.reload + assert_in_delta DateTime.current.to_i, User.last.terms_accepted_at.to_i, 5 end test "admins can update date of tos changes and user has to re-agree or delete account" do