Created
February 18, 2014 16:08
-
-
Save jeremyf/9073937 to your computer and use it in GitHub Desktop.
A set of specs for defining how the amend group membership form will behave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe GroupMembershipForm do | |
let(:group) { Group.new } | |
let(:group_id) { 'abc:123'} | |
let(:person) { Person.new } | |
let(:member_id) { 'abc:456'} | |
let(:params) { | |
{ | |
# These are the parameters that are generated in the existing form. | |
"group_id" => group_id | |
"members_attributes" => | |
{ | |
"0"=>{"id"=>member_id, "_destroy"=>""}, | |
} | |
} | |
} | |
subject { GroupMembership.new(params) } | |
before(:each) do | |
Group.should_receive(:find).with(group_id).and_return(group) | |
Person.should_receive(:find).with(member_id).and_return(person) | |
end | |
context '#save' do | |
it 'should append the member to the group' do | |
group.should_receive(:add_member).with(person) | |
subject.save | |
end | |
end | |
context 'validation' do | |
it 'should require a group_id' | |
it 'should require a title' | |
it 'should require a description' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment