]> git.openstreetmap.org Git - rails.git/blob - test/system/account_terms_test.rb
Add frozen_string_literal comments to ruby files
[rails.git] / test / system / account_terms_test.rb
1 # frozen_string_literal: true
2
3 require "application_system_test_case"
4
5 class AccountTermsTest < ApplicationSystemTestCase
6   test "should inform about terms if not agreed" do
7     user = create(:user, :terms_seen => true, :terms_agreed => nil, :tou_agreed => nil)
8
9     sign_in_as(user)
10     visit account_path
11
12     within_content_body do
13       assert_text(/You have not yet agreed to.*Contributor Terms/)
14       assert_text(/You have not yet agreed to.*Terms of Use/)
15       assert_link "Review and accept the Terms"
16
17       click_on "Review and accept the Terms", :match => :first
18     end
19
20     assert_current_path account_terms_path
21   end
22
23   test "should inform about terms if partially agreed" do
24     user = create(:user, :terms_seen => true, :terms_agreed => "2022-03-14", :tou_agreed => nil)
25
26     sign_in_as(user)
27     visit account_path
28
29     within_content_body do
30       assert_text(/You agreed to.*Contributor Terms.*March 14, 2022/)
31       assert_text(/You have not yet agreed to.*Terms of Use/)
32       assert_link "Review the Terms"
33       assert_link "Review and accept the Terms"
34
35       click_on "Review and accept the Terms", :match => :first
36     end
37
38     assert_current_path account_terms_path
39   end
40
41   test "should inform about terms if agreed" do
42     user = create(:user, :terms_seen => true, :terms_agreed => "2023-04-15", :tou_agreed => "2024-05-16")
43
44     sign_in_as(user)
45     visit account_path
46
47     within_content_body do
48       assert_text(/You agreed to.*Contributor Terms.*April 15, 2023/)
49       assert_text(/You agreed to.*Terms of Use.*May 16, 2024/)
50       assert_link "Review the Terms"
51
52       click_on "Review the Terms", :match => :first
53     end
54
55     assert_current_path account_terms_path
56   end
57
58   test "should ask to consider pd if not considered" do
59     user = create(:user, :consider_pd => false)
60
61     sign_in_as(user)
62     visit account_path
63
64     within_content_body do
65       assert_text(/You haven't declared.*Public Domain/)
66       assert_link "Consider Public Domain"
67
68       click_on "Consider Public Domain"
69     end
70
71     assert_current_path account_pd_declaration_path
72   end
73
74   test "should not ask to consider pd if considered" do
75     user = create(:user, :consider_pd => true)
76
77     sign_in_as(user)
78     visit account_path
79
80     within_content_body do
81       assert_text(/You have also declared.*Public Domain/)
82       assert_no_link "Consider Public Domain"
83     end
84   end
85 end