1 # frozen_string_literal: true
3 require "application_system_test_case"
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)
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"
17 click_on "Review and accept the Terms", :match => :first
20 assert_current_path account_terms_path
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)
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"
35 click_on "Review and accept the Terms", :match => :first
38 assert_current_path account_terms_path
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")
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"
52 click_on "Review the Terms", :match => :first
55 assert_current_path account_terms_path
58 test "should ask to consider pd if not considered" do
59 user = create(:user, :consider_pd => false)
64 within_content_body do
65 assert_text(/You haven't declared.*Public Domain/)
66 assert_link "Consider Public Domain"
68 click_on "Consider Public Domain"
71 assert_current_path account_pd_declaration_path
74 test "should not ask to consider pd if considered" do
75 user = create(:user, :consider_pd => true)
80 within_content_body do
81 assert_text(/You have also declared.*Public Domain/)
82 assert_no_link "Consider Public Domain"