1 require "application_system_test_case"
3 class AccountTermsTest < ApplicationSystemTestCase
4 test "should inform about terms if not agreed" do
5 user = create(:user, :terms_seen => true, :terms_agreed => nil, :tou_agreed => nil)
10 within_content_body do
11 assert_text(/You have not yet agreed to.*Contributor Terms/)
12 assert_text(/You have not yet agreed to.*Terms of Use/)
13 assert_link "Review and accept the Terms"
15 click_on "Review and accept the Terms", :match => :first
18 assert_current_path account_terms_path
21 test "should inform about terms if partially agreed" do
22 user = create(:user, :terms_seen => true, :terms_agreed => "2022-03-14", :tou_agreed => nil)
27 within_content_body do
28 assert_text(/You agreed to.*Contributor Terms.*March 14, 2022/)
29 assert_text(/You have not yet agreed to.*Terms of Use/)
30 assert_link "Review the Terms"
31 assert_link "Review and accept the Terms"
33 click_on "Review and accept the Terms", :match => :first
36 assert_current_path account_terms_path
39 test "should inform about terms if agreed" do
40 user = create(:user, :terms_seen => true, :terms_agreed => "2023-04-15", :tou_agreed => "2024-05-16")
45 within_content_body do
46 assert_text(/You agreed to.*Contributor Terms.*April 15, 2023/)
47 assert_text(/You agreed to.*Terms of Use.*May 16, 2024/)
48 assert_link "Review the Terms"
50 click_on "Review the Terms", :match => :first
53 assert_current_path account_terms_path
56 test "should ask to consider pd if not considered" do
57 user = create(:user, :consider_pd => false)
62 within_content_body do
63 assert_text(/You haven't declared.*Public Domain/)
64 assert_link "Consider Public Domain"
66 click_on "Consider Public Domain"
69 assert_current_path account_pd_declaration_path
72 test "should not ask to consider pd if considered" do
73 user = create(:user, :consider_pd => true)
78 within_content_body do
79 assert_text(/You have also declared.*Public Domain/)
80 assert_no_link "Consider Public Domain"