spec/features/user_view_spec.rb in marty-3.0.0 vs spec/features/user_view_spec.rb in marty-3.0.1
- old
+ new
@@ -1,8 +1,8 @@
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
@@ -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 visible btn/
+ expect { find(:btn, 'New User') }.to raise_error(err)
+ expect { find(:btn, 'Edit') }.to raise_error(err)
+ expect { find(:btn, 'Delete') }.to raise_error(err)
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 visible btn/
+ expect { find(:btn, 'New User') }.to raise_error(err)
+ expect { find(:btn, 'Edit') }.to raise_error(err)
+ expect { find(:btn, 'Delete') }.to raise_error(err)
end
end
end
end