spec/features/user_view_spec.rb in marty-4.0.0.rc2 vs spec/features/user_view_spec.rb in marty-5.1.0

- old
+ new

@@ -1,16 +1,16 @@ require 'spec_helper' -feature 'under Sytem menu, User Management worflows', js: true do +feature 'under System menu, User Management worflows', js: true do def go_to_user_view press('System') press('User Management') expect(page).to have_content 'marty' end def go_to_user_view_backdoor - sys_btn = first(:btn, 'System') + sys_btn = first(:btn, 'System') rescue nil if sys_btn sys_btn.click expect(page).not_to have_content 'User Management' end @@ -75,10 +75,11 @@ end end and_by 'check row got edited' do wait_for_ajax + r2 = user_view.get_row_vals(2) expect(user_view.get_row_vals(2)).to netzke_include( login: 'new_login', firstname: 'new_fname', lastname: 'new_lname', active: true, @@ -112,10 +113,13 @@ go_to_user_view user_view = netzke_find('user_view') by 'check buttons' do find(:btn, 'New User', match: :first) user_view.select_row(1) + expect { find(:btn, 'New User') }.not_to raise_error + expect { find(:btn, 'Edit') }.not_to raise_error + expect { find(:btn, 'Delete') }.not_to raise_error expect(btn_disabled?('New User')).to be_falsy expect(btn_disabled?('Edit')).to be_falsy expect(btn_disabled?('Delete')).to be_falsy end end @@ -125,10 +129,13 @@ go_to_user_view user_view = netzke_find('user_view') by 'check buttons' do find(:btn, 'New User', match: :first) user_view.select_row(1) + expect { find(:btn, 'New User') }.not_to raise_error + expect { find(:btn, 'Edit') }.not_to raise_error + expect { find(:btn, 'Delete') }.not_to raise_error expect(btn_disabled?('New User')).to be_falsy expect(btn_disabled?('Edit')).to be_falsy expect(btn_disabled?('Delete')).to be_falsy end end @@ -138,25 +145,27 @@ go_to_user_view_backdoor user_view = netzke_find('user_view') by 'check buttons' do user_view.select_row(1) - expect(page).not_to have_content('New User') - expect(page).not_to have_content('Edit') - expect(page).not_to have_content('Delete') + err = /Unable to find btn/ + ['New User', 'Edit', 'Delete'].each do |btn_name| + expect { find(:btn, btn_name) }.to raise_error(err) + end end end it 'developer denied access' do log_in_as('dev1') go_to_user_view_backdoor user_view = netzke_find('user_view') by 'check buttons' do user_view.select_row(1) - expect(page).not_to have_content('New User') - expect(page).not_to have_content('Edit') - expect(page).not_to have_content('Delete') + err = /Unable to find btn/ + ['New User', 'Edit', 'Delete'].each do |btn_name| + expect { find(:btn, btn_name) }.to raise_error(err) + end end end end end