team_user_spec.rb revision 7c7a19761235efff584ee65a1c6dc4aa1735ff64
require 'spec_helper'
context 'Associations' do
end
end
it 'have 2 members' do
expect(team.team_users.count).to eq(2)
end
it 'have a admin' do
expect(team.team_users.admin.first.user).to eq(team_admin)
end
it 'have a non-admin' do
expect(team.team_users.non_admin.first.user).to eq(team_user)
end
it 'remove non-admin' do
expect(non_admim_user.destroy).to be_truthy
end
it 'not destroy the last admin' do
expect { assert admin_user.destroy }.
to raise_error(Permission::PowerVaccuumError)
end
it 'not remove the last admin flag' do
expect { admin_user.update_attribute :admin, false }.
to raise_error(Permission::PowerVaccuumError)
end
end
end