Sha256: 2e8bd2bde987f9b98c008a9b6bfb5d1ca86d9ce5e652eeb01a8f9855c8c6122d
Contents?: true
Size: 1.74 KB
Versions: 2
Compression:
Stored size: 1.74 KB
Contents
require 'spec_helper' describe 'Admin Roles' do before { as :admin } before(:all) { set_resource 'admin-role' } let(:role) { create(:role, name: 'teacher') } context 'new', js: true do before do visit gaku.admin_roles_path click new_link end it 'creates and shows' do expect do fill_in 'role_name', with: 'master admin' click submit flash_created? end.to change(Gaku::Role, :count).by 1 has_content? 'master admin' count? 'Roles list(2)' end it 'validates' do fill_in 'role_name', with: '' click submit has_content? "can't be blank" end end context 'existing' do before do role visit gaku.admin_roles_path end context 'edit', js: true do before do within('#admin-roles-index tbody tr:nth-child(2)') { click js_edit_link } wait_until_visible modal end it 'edits' do fill_in 'role_name', with: 'ninja' click submit flash_updated? expect(role.reload.name).to eq 'ninja' has_content? 'ninja' has_no_content? 'teacher' end it 'validates' do fill_in 'role_name', with: '' click submit has_content? "can't be blank" end end it 'deletes', js: true do has_content? role.name within(count_div) { has_content? 'Roles list(2)' } tr_count = size_of table_rows expect do within('#admin-roles-index tbody tr:nth-child(2)') { click delete_link } accept_alert flash_destroyed? wait_until { size_of(table_rows) == tr_count - 1 } end.to change(Gaku::Role, :count).by -1 count? 'Roles list(2)' has_content? role.name end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gaku-0.0.3 | core/spec/requests/admin/roles_spec.rb |
gaku-0.0.2 | core/spec/requests/admin/roles_spec.rb |