FEATURE: Allow group owners to edit group name and avatar flair.

This commit is contained in:
Guo Xiang Tan
2016-11-29 16:25:02 +08:00
parent b45fd21ed9
commit 31acd311e5
26 changed files with 453 additions and 209 deletions

View File

@ -0,0 +1,31 @@
require 'rails_helper'
describe GroupShowSerializer do
context 'admin user' do
let(:user) { Fabricate(:admin) }
let(:group) { Fabricate(:group, users: [user]) }
it 'should return the right attributes' do
json = GroupShowSerializer.new(group, scope: Guardian.new(user)).as_json
expect(json[:group_show][:is_group_owner]).to eq(true)
expect(json[:group_show][:is_group_user]).to eq(true)
end
end
context 'group owner' do
let(:user) { Fabricate(:user) }
let(:group) { Fabricate(:group) }
before do
group.add_owner(user)
end
it 'should return the right attributes' do
json = GroupShowSerializer.new(group, scope: Guardian.new(user)).as_json
expect(json[:group_show][:is_group_owner]).to eq(true)
expect(json[:group_show][:is_group_user]).to eq(true)
end
end
end