mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 04:38:47 +08:00
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:
36
spec/serializers/basic_group_user_serializer_spec.rb
Normal file
36
spec/serializers/basic_group_user_serializer_spec.rb
Normal 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
|
Reference in New Issue
Block a user