group progress, never email banned users

This commit is contained in:
Sam
2013-05-09 11:33:56 +10:00
parent c1185d92eb
commit 0f0fd281a8
5 changed files with 152 additions and 9 deletions

View File

@ -28,4 +28,49 @@ describe Admin::GroupsController do
xhr :post, :refresh_automatic_groups
response.status.should == 200
end
it "is able to destroy a group" do
log_in(:admin)
group = Fabricate(:group)
xhr :delete, :destroy, id: group.id
response.status.should == 200
Group.count.should == 0
end
it "is able to create a group" do
a = log_in(:admin)
xhr :post, :create, group: {
usernames: a.username,
name: "bob"
}
response.status.should == 200
groups = Group.all.to_a
groups.count.should == 1
groups[0].usernames.should == a.username
groups[0].name.should == "bob"
end
it "is able to update group members" do
user1 = Fabricate(:user)
user2 = Fabricate(:user)
group = Fabricate(:group)
log_in(:admin)
xhr :put, :update, id: group.id, name: 'fred', group: {
name: 'fred',
usernames: "#{user1.username},#{user2.username}"
}
group.reload
group.users.count.should == 2
group.name.should == 'fred'
end
end