This commit is contained in:
Guo Xiang Tan 2017-08-02 20:58:35 +09:00
parent 1c80c233cf
commit b6ce93a965
1 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,7 @@ require 'rails_helper'
RSpec.describe "Managing groups as an admin" do
let(:admin) { Fabricate(:admin) }
let(:user) { Fabricate(:user) }
let(:group) { Fabricate(:group) }
before do
sign_in(admin)
@ -26,4 +27,17 @@ RSpec.describe "Managing groups as an admin" do
expect(group.allow_membership_requests).to eq(true)
end
end
describe 'adding a new owner' do
it 'should work' do
put "/admin/groups/#{group.id}/owners.json", group: {
usernames: [user.username, admin.username].join(",")
}
expect(response).to be_success
expect(group.group_users.where(owner: true).map(&:user))
.to contain_exactly(user, admin)
end
end
end