diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-02 15:09:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-02 15:09:26 +0300 |
commit | c658e2d29296721aa65d569a42b778485042795a (patch) | |
tree | 24a39099120ead3fc31d7f115094dc928c38af29 /spec/serializers | |
parent | 3256c55b0f188227e27a4863532feee84e654911 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/environment_serializer_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/serializers/environment_serializer_spec.rb b/spec/serializers/environment_serializer_spec.rb index 05644dad151..01d1e47b5bb 100644 --- a/spec/serializers/environment_serializer_spec.rb +++ b/spec/serializers/environment_serializer_spec.rb @@ -101,6 +101,37 @@ RSpec.describe EnvironmentSerializer do expect(subject.third[:latest][:environment_type]).to be_nil end end + + context 'when folders and standalone environments share the same name' do + before do + create(:environment, project: project, name: 'staging/my-review-1') + create(:environment, project: project, name: 'staging/my-review-2') + create(:environment, project: project, name: 'production/my-review-3') + create(:environment, project: project, name: 'staging') + create(:environment, project: project, name: 'testing') + end + + it 'does not group standalone environments with folders that have the same name' do + expect(subject.count).to eq 4 + + expect(subject.first[:name]).to eq 'production' + expect(subject.first[:size]).to eq 1 + expect(subject.first[:latest][:name]).to eq 'production/my-review-3' + expect(subject.first[:latest][:environment_type]).to eq 'production' + expect(subject.second[:name]).to eq 'staging' + expect(subject.second[:size]).to eq 1 + expect(subject.second[:latest][:name]).to eq 'staging' + expect(subject.second[:latest][:environment_type]).to be_nil + expect(subject.third[:name]).to eq 'staging' + expect(subject.third[:size]).to eq 2 + expect(subject.third[:latest][:name]).to eq 'staging/my-review-2' + expect(subject.third[:latest][:environment_type]).to eq 'staging' + expect(subject.fourth[:name]).to eq 'testing' + expect(subject.fourth[:size]).to eq 1 + expect(subject.fourth[:latest][:name]).to eq 'testing' + expect(subject.fourth[:latest][:environment_type]).to be_nil + end + end end context 'when used with pagination' do |