FIX: Group owners should be able to invite users to their groups.

https://meta.discourse.org/t/group-owner-cannot-send-an-invite-to-a-group/60617/12
This commit is contained in:
Guo Xiang Tan
2017-07-21 15:12:24 +09:00
parent fe05587134
commit 2a17f1ccd7
18 changed files with 256 additions and 114 deletions

View File

@ -0,0 +1,36 @@
require 'rails_helper'
describe BasicGroupUserSerializer do
let(:group) { Fabricate(:group) }
let(:user) { Fabricate(:user) }
before do
group.add(user)
end
describe '#owner' do
describe 'when scoped to the user' do
it 'should be false' do
json = described_class.new(
GroupUser.last,
scope: Guardian.new(user),
root: false
).as_json
expect(json[:owner]).to eq(false)
end
end
describe 'when not scoped to the user' do
it 'should be nil' do
json = described_class.new(
GroupUser.last,
scope: Guardian.new,
root: false
).as_json
expect(json[:owner]).to eq(nil)
end
end
end
end