mirror of https://github.com/fspc/BikeShed-1.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
712 B
25 lines
712 B
12 years ago
|
require 'spec_helper'
|
||
|
|
||
|
describe TeamMembership do
|
||
|
describe 'membership validations' do
|
||
|
let(:team) { create(:team) }
|
||
|
let(:user) { create(:user) }
|
||
|
|
||
|
describe 'should require user and team' do
|
||
|
it { should have(1).error_on(:user) }
|
||
|
it { should have(1).error_on(:team) }
|
||
|
end
|
||
|
|
||
|
it 'should only allow a user to be a member once' do
|
||
|
TeamMembership.create(:user => user, :team => team)
|
||
|
second = TeamMembership.create(:user => user, :team => team)
|
||
|
second.should be_invalid
|
||
|
end
|
||
|
|
||
|
it 'should not allow a captain to become a member' do
|
||
|
membership = TeamMembership.create(:user => team.captain, :team => team)
|
||
|
membership.should be_invalid
|
||
|
end
|
||
|
end
|
||
|
end
|