|
4 | 4 | mock_github_auth |
5 | 5 | end |
6 | 6 |
|
7 | | - scenario 'they can''t proceed unless they accept the ToCs' do |
| 7 | + scenario "they can't proceed unless they accept the ToCs" do |
8 | 8 | visit root_path |
9 | 9 | click_on 'Join us as a student' |
10 | 10 | click_on 'Join us as a student' |
|
16 | 16 | expect(page).to have_content('You have to accept the Terms and Conditions before you are able to proceed.') |
17 | 17 | end |
18 | 18 |
|
19 | | - scenario 'they can read the Code of Conduct before accepting the ToCs', js: true do |
| 19 | + scenario 'they can read the Code of Conduct before accepting the ToCs', :js do |
20 | 20 | visit root_path |
21 | 21 | click_on 'Join us as a student' |
22 | 22 | click_on 'Join us as a student' |
|
47 | 47 | end |
48 | 48 |
|
49 | 49 | context 'When an existing member logs in' do |
50 | | - context 'and they have not yet accepted codebar''s ToCs' do |
| 50 | + context "and they have not yet accepted codebar's ToCs" do |
51 | 51 | scenario 'they have to accept before continuing to the page they want to get' do |
52 | 52 | member = Fabricate(:member_without_toc) |
53 | 53 | login(member) |
|
59 | 59 | end |
60 | 60 | end |
61 | 61 |
|
62 | | - context 'and they have already accepted codebar''s ToCs' do |
| 62 | + context "and they have already accepted codebar's ToCs" do |
63 | 63 | scenario 'they will be redirected to the link they were trying to access' do |
64 | 64 | member = Fabricate(:member) |
65 | 65 | login(member) |
66 | 66 |
|
67 | 67 | visit dashboard_path |
68 | 68 | expect(page).to have_current_path(dashboard_path) |
69 | 69 | end |
| 70 | + |
| 71 | + scenario 'they see a message that they have already accepted on the T&C page' do |
| 72 | + member = Fabricate(:member) |
| 73 | + login(member) |
| 74 | + |
| 75 | + visit terms_and_conditions_path |
| 76 | + expect(page).to have_current_path(terms_and_conditions_path) |
| 77 | + expect(page).to have_content(/already accepted.*#{member.accepted_toc_at.strftime('%d %B %Y')}/) |
| 78 | + expect(page).not_to have_button('Accept') |
| 79 | + end |
| 80 | + end |
| 81 | + end |
| 82 | + |
| 83 | + context 'When a guest user (not logged in) visits the page' do |
| 84 | + scenario 'they see a login prompt and cannot accept the ToCs' do |
| 85 | + visit terms_and_conditions_path |
| 86 | + |
| 87 | + expect(page).to have_content('Please log in to accept our Code of Conduct.') |
| 88 | + expect(page).to have_link('Log in with GitHub') |
| 89 | + end |
| 90 | + |
| 91 | + scenario 'they see a disabled form' do |
| 92 | + visit terms_and_conditions_path |
| 93 | + |
| 94 | + expect(page).to have_field('terms_and_conditions_form_terms', disabled: true) |
| 95 | + expect(page).to have_button('Accept', disabled: true) |
70 | 96 | end |
71 | 97 | end |
72 | 98 | end |
0 commit comments