Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-08-11 18:10:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-08-11 18:10:08 +0300
commit9dde2726710184f066387d044fce4ae2b3684210 (patch)
tree141da0dfc25da6b1724329a3d5cf2d51c7d45937 /spec/serializers/analytics_issue_entity_spec.rb
parent03b5d94c2c145491bd493837ec50a36e5d1d2612 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers/analytics_issue_entity_spec.rb')
-rw-r--r--spec/serializers/analytics_issue_entity_spec.rb25
1 files changed, 21 insertions, 4 deletions
diff --git a/spec/serializers/analytics_issue_entity_spec.rb b/spec/serializers/analytics_issue_entity_spec.rb
index 2518eec8c23..447c5e7d02a 100644
--- a/spec/serializers/analytics_issue_entity_spec.rb
+++ b/spec/serializers/analytics_issue_entity_spec.rb
@@ -17,16 +17,13 @@ RSpec.describe AnalyticsIssueEntity do
}
end
- let(:project) { create(:project, name: 'my project') }
let(:request) { EntityRequest.new(entity: :merge_request) }
let(:entity) do
described_class.new(entity_hash, request: request, project: project)
end
- context 'generic entity' do
- subject { entity.as_json }
-
+ shared_examples 'generic entity' do
it 'contains the entity URL' do
expect(subject).to include(:url)
end
@@ -40,4 +37,24 @@ RSpec.describe AnalyticsIssueEntity do
expect(subject).not_to include(/variables/)
end
end
+
+ context 'without subgroup' do
+ let_it_be(:project) { create(:project, name: 'my project') }
+
+ subject { entity.as_json }
+
+ it_behaves_like 'generic entity'
+ end
+
+ context 'with subgroup' do
+ let_it_be(:project) { create(:project, :in_subgroup, name: 'my project') }
+
+ subject { entity.as_json }
+
+ it_behaves_like 'generic entity'
+
+ it 'has URL containing subgroup' do
+ expect(subject[:url]).to include("#{project.group.parent.name}/#{project.group.name}/my_project/")
+ end
+ end
end