summaryrefslogtreecommitdiff
path: root/spec/serializers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-20 13:18:24 +0000
commit0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch)
tree4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /spec/serializers
parent744144d28e3e7fddc117924fef88de5d9674fe4c (diff)
downloadgitlab-ce-0653e08efd039a5905f3fa4f6e9cef9f5d2f799c.tar.gz
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'spec/serializers')
-rw-r--r--spec/serializers/group_child_entity_spec.rb36
-rw-r--r--spec/serializers/issuable_sidebar_extras_entity_spec.rb8
-rw-r--r--spec/serializers/pipeline_serializer_spec.rb2
3 files changed, 38 insertions, 8 deletions
diff --git a/spec/serializers/group_child_entity_spec.rb b/spec/serializers/group_child_entity_spec.rb
index 7f330da44a7..e4844c25067 100644
--- a/spec/serializers/group_child_entity_spec.rb
+++ b/spec/serializers/group_child_entity_spec.rb
@@ -87,7 +87,7 @@ RSpec.describe GroupChildEntity do
expect(json[:children_count]).to eq(2)
end
- %w[children_count leave_path parent_id number_projects_with_delimiter number_users_with_delimiter project_count subgroup_count].each do |attribute|
+ %w[children_count leave_path parent_id number_users_with_delimiter project_count subgroup_count].each do |attribute|
it "includes #{attribute}" do
expect(json[attribute.to_sym]).to be_present
end
@@ -114,6 +114,40 @@ RSpec.describe GroupChildEntity do
it_behaves_like 'group child json'
end
+ describe 'for a private group' do
+ let(:object) do
+ create(:group, :private)
+ end
+
+ describe 'user is member of the group' do
+ before do
+ object.add_owner(user)
+ end
+
+ it 'includes the counts' do
+ expect(json.keys).to include(*%i(project_count subgroup_count))
+ end
+ end
+
+ describe 'user is not a member of the group' do
+ it 'does not include the counts' do
+ expect(json.keys).not_to include(*%i(project_count subgroup_count))
+ end
+ end
+
+ describe 'user is only a member of a project in the group' do
+ let(:project) { create(:project, namespace: object) }
+
+ before do
+ project.add_guest(user)
+ end
+
+ it 'does not include the counts' do
+ expect(json.keys).not_to include(*%i(project_count subgroup_count))
+ end
+ end
+ end
+
describe 'for a project with external authorization enabled' do
let(:object) do
create(:project, :with_avatar,
diff --git a/spec/serializers/issuable_sidebar_extras_entity_spec.rb b/spec/serializers/issuable_sidebar_extras_entity_spec.rb
index f49b9acfd5d..80c135cdc22 100644
--- a/spec/serializers/issuable_sidebar_extras_entity_spec.rb
+++ b/spec/serializers/issuable_sidebar_extras_entity_spec.rb
@@ -10,11 +10,7 @@ RSpec.describe IssuableSidebarExtrasEntity do
subject { described_class.new(resource, request: request).as_json }
- it 'have subscribe attributes' do
- expect(subject).to include(:participants,
- :project_emails_disabled,
- :subscribe_disabled_description,
- :subscribed,
- :assignees)
+ it 'have assignee attribute' do
+ expect(subject).to include(:assignees)
end
end
diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb
index bcad9eb6e23..587d167520f 100644
--- a/spec/serializers/pipeline_serializer_spec.rb
+++ b/spec/serializers/pipeline_serializer_spec.rb
@@ -202,7 +202,7 @@ RSpec.describe PipelineSerializer do
# Existing numbers are high and require performance optimization
# Ongoing issue:
# https://gitlab.com/gitlab-org/gitlab/-/issues/225156
- expected_queries = Gitlab.ee? ? 77 : 70
+ expected_queries = Gitlab.ee? ? 74 : 70
expect(recorded.count).to be_within(2).of(expected_queries)
expect(recorded.cached_count).to eq(0)