diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-12 15:58:44 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-10-04 23:49:41 +0300 |
commit | 3e6dd7d88daaac2dbafc234753942086e0ba0403 (patch) | |
tree | e80888fc0580c78e71db4b0b57c4b088c9c64d0c /spec/serializers/group_child_serializer_spec.rb | |
parent | 960559aa6889a0b5ac1d46b84b7f7977a57d50ca (diff) |
Use same response-body in groups-dashboard as we do for group-home
Diffstat (limited to 'spec/serializers/group_child_serializer_spec.rb')
-rw-r--r-- | spec/serializers/group_child_serializer_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/serializers/group_child_serializer_spec.rb b/spec/serializers/group_child_serializer_spec.rb index 7a87c1adc8f..e5896f54dd7 100644 --- a/spec/serializers/group_child_serializer_spec.rb +++ b/spec/serializers/group_child_serializer_spec.rb @@ -49,6 +49,22 @@ describe GroupChildSerializer do expect(subgroup1_json[:id]).to eq(subgroup1.id) expect(subsub_group1_json[:id]).to eq(subsub_group1.id) end + + context 'without a specified parent' do + subject(:serializer) do + described_class.new(current_user: user).expand_hierarchy + end + + it 'can render a tree' do + subgroup = create(:group, parent: parent) + + json = serializer.represent([subgroup]) + parent_json = json.first + + expect(parent_json[:id]).to eq(parent.id) + expect(parent_json[:children].first[:id]).to eq(subgroup.id) + end + end end context 'for projects' do |