|
1 | 1 | require 'rails_helper' |
2 | 2 |
|
3 | | -RSpec.describe 'Admin' do |
4 | | - subject { page } |
| 3 | +RSpec.describe 'Super Admin', type: :system do |
5 | 4 | let(:admin) { create(:admin_user, email: '[email protected]') } |
6 | 5 | let(:super_admin) { create(:super_admin) } |
7 | 6 |
|
8 | | - before { admin } |
9 | | - |
10 | | - describe 'login' do |
11 | | - before do |
12 | | - sign_in super_admin |
13 | | - visit '/super_admins' |
14 | | - end |
15 | | - its(:current_path) { should == '/super_admins' } |
| 7 | + before do |
| 8 | + admin |
| 9 | + sign_in super_admin |
| 10 | + visit '/super_admins' |
| 11 | + click_link 'Admin Users' |
| 12 | + end |
16 | 13 |
|
17 | | - describe 'index page' do |
18 | | - before { click_link 'Admin Users' } |
| 14 | + describe 'updating an admin from the index page' do |
| 15 | + it 'should not crash' do |
| 16 | + expect(page).to have_content('[email protected]') |
19 | 17 |
|
20 | | - it { should have_content('[email protected]') } |
| 18 | + first('.table_actions').click_link('Edit') |
| 19 | + fill_in 'Email', with: '[email protected]' |
| 20 | + click_button 'Update Admin user' |
21 | 21 |
|
22 | | - describe 'updating the admin user' do |
23 | | - before do |
24 | | - first('.table_actions').click_link('Edit') |
25 | | - fill_in 'Email', with: '[email protected]' |
26 | | - click_button 'Update Admin user' |
27 | | - end |
| 22 | + expect(page).to have_content('Admin user was successfully updated.') |
| 23 | + expect(page).to have_content('[email protected]') |
| 24 | + end |
| 25 | + end |
28 | 26 |
|
29 | | - it 'should update the admin' do |
30 | | - expect(page).to have_content('Admin user was successfully updated.') |
31 | | - expect(page).to have_content('[email protected]') |
32 | | - end |
33 | | - end |
| 27 | + describe 'visiting new user page' do |
| 28 | + it 'should not crash' do |
| 29 | + click_link 'New Admin User' |
| 30 | + end |
| 31 | + end |
34 | 32 |
|
35 | | - describe 'walking around' do |
36 | | - it 'should not crash' do |
37 | | - click_link 'New Admin User' |
38 | | - click_link 'Logout' |
39 | | - end |
40 | | - end |
| 33 | + describe 'logging out' do |
| 34 | + it 'should not crash' do |
| 35 | + click_link 'Logout' |
41 | 36 | end |
42 | 37 | end |
43 | 38 | end |
0 commit comments