diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 16:16:36 +0300 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /spec/presenters/project_presenter_spec.rb | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
Diffstat (limited to 'spec/presenters/project_presenter_spec.rb')
-rw-r--r-- | spec/presenters/project_presenter_spec.rb | 74 |
1 files changed, 15 insertions, 59 deletions
diff --git a/spec/presenters/project_presenter_spec.rb b/spec/presenters/project_presenter_spec.rb index 5f789f59908..27b777dec5f 100644 --- a/spec/presenters/project_presenter_spec.rb +++ b/spec/presenters/project_presenter_spec.rb @@ -567,44 +567,27 @@ RSpec.describe ProjectPresenter do end describe '#upload_anchor_data' do - context 'with empty_repo_upload enabled' do + context 'when a user can push to the default branch' do before do - stub_experiments(empty_repo_upload: :candidate) - end - - context 'user can push to branch' do - before do - project.add_developer(user) - end - - it 'returns upload_anchor_data' do - expect(presenter.upload_anchor_data).to have_attributes( - is_link: false, - label: a_string_including('Upload file'), - data: { - "can_push_code" => "true", - "original_branch" => "master", - "path" => "/#{project.full_path}/-/create/master", - "project_path" => project.full_path, - "target_branch" => "master" - } - ) - end + project.add_developer(user) end - context 'user cannot push to branch' do - it 'returns nil' do - expect(presenter.upload_anchor_data).to be_nil - end + it 'returns upload_anchor_data' do + expect(presenter.upload_anchor_data).to have_attributes( + is_link: false, + label: a_string_including('Upload file'), + data: { + "can_push_code" => "true", + "original_branch" => "master", + "path" => "/#{project.full_path}/-/create/master", + "project_path" => project.full_path, + "target_branch" => "master" + } + ) end end - context 'with empty_repo_upload disabled' do - before do - stub_experiments(empty_repo_upload: :control) - project.add_developer(user) - end - + context 'when the user cannot push to default branch' do it 'returns nil' do expect(presenter.upload_anchor_data).to be_nil end @@ -666,7 +649,6 @@ RSpec.describe ProjectPresenter do context 'for a developer' do before do project.add_developer(user) - stub_experiments(empty_repo_upload: :candidate) end it 'orders the items correctly' do @@ -680,16 +662,6 @@ RSpec.describe ProjectPresenter do a_string_including('CI/CD') ) end - - context 'when not in the upload experiment' do - before do - stub_experiments(empty_repo_upload: :control) - end - - it 'does not include upload button' do - expect(empty_repo_statistics_buttons.map(&:label)).not_to start_with(a_string_including('Upload')) - end - end end end @@ -781,20 +753,4 @@ RSpec.describe ProjectPresenter do it { is_expected.to match(/code_quality_walkthrough=true.*template=Code-Quality/) } end - - describe 'empty_repo_upload_experiment?' do - subject { presenter.empty_repo_upload_experiment? } - - it 'returns false when upload_anchor_data is nil' do - allow(presenter).to receive(:upload_anchor_data).and_return(nil) - - expect(subject).to be false - end - - it 'returns true when upload_anchor_data exists' do - allow(presenter).to receive(:upload_anchor_data).and_return(true) - - expect(subject).to be true - end - end end |