From b6ce93a965beb31eca0b5c4616aed4b71c6673e3 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 2 Aug 2017 20:58:35 +0900 Subject: [PATCH] Add specs for https://github.com/discourse/discourse/commit/1c80c233cfe8d6dd8e6b7e0a988870760a0900fb --- spec/integration/admin/groups_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/integration/admin/groups_spec.rb b/spec/integration/admin/groups_spec.rb index 4f41f6d219a..0781ff61c23 100644 --- a/spec/integration/admin/groups_spec.rb +++ b/spec/integration/admin/groups_spec.rb @@ -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