diff options
Diffstat (limited to 'spec/controllers/projects/pipelines_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/pipelines_controller_spec.rb | 64 |
1 files changed, 22 insertions, 42 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index e1405660ccb..753223c5a4f 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -7,13 +7,14 @@ RSpec.describe Projects::PipelinesController do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :public, :repository) } + let(:feature) { ProjectFeature::ENABLED } before do allow(Sidekiq.logger).to receive(:info) stub_not_protect_default_branch project.add_developer(user) - project.project_feature.update(builds_access_level: feature) + project.project_feature.update!(builds_access_level: feature) sign_in(user) end @@ -272,6 +273,23 @@ RSpec.describe Projects::PipelinesController do end end + describe 'GET #index' do + context 'pipeline_empty_state_templates experiment' do + before do + stub_application_setting(auto_devops_enabled: false) + end + + it 'tracks the view', :experiment do + expect(experiment(:pipeline_empty_state_templates)) + .to track(:view, value: project.namespace_id) + .with_context(actor: user) + .on_next_instance + + get :index, params: { namespace_id: project.namespace, project_id: project } + end + end + end + describe 'GET show.json' do let(:pipeline) { create(:ci_pipeline, project: project) } @@ -628,44 +646,6 @@ RSpec.describe Projects::PipelinesController do end end - describe 'GET stages_ajax.json' do - let(:pipeline) { create(:ci_pipeline, project: project) } - - context 'when accessing existing stage' do - before do - create(:ci_build, pipeline: pipeline, stage: 'build') - - get_stage_ajax('build') - end - - it 'returns html source for stage dropdown' do - expect(response).to have_gitlab_http_status(:ok) - expect(response).to render_template('projects/pipelines/_stage') - expect(json_response).to include('html') - end - end - - context 'when accessing unknown stage' do - before do - get_stage_ajax('test') - end - - it 'responds with not found' do - expect(response).to have_gitlab_http_status(:not_found) - end - end - - def get_stage_ajax(name) - get :stage_ajax, params: { - namespace_id: project.namespace, - project_id: project, - id: pipeline.id, - stage: name - }, - format: :json - end - end - describe 'GET status.json' do let(:pipeline) { create(:ci_pipeline, project: project) } let(:status) { pipeline.detailed_status(double('user')) } @@ -702,7 +682,7 @@ RSpec.describe Projects::PipelinesController do before do project.add_developer(user) - project.project_feature.update(builds_access_level: feature) + project.project_feature.update!(builds_access_level: feature) end context 'with a valid .gitlab-ci.yml file' do @@ -721,7 +701,7 @@ RSpec.describe Projects::PipelinesController do pipeline = project.ci_pipelines.last expected_redirect_path = Gitlab::Routing.url_helpers.project_pipeline_path(project, pipeline) - expect(pipeline).to be_pending + expect(pipeline).to be_created expect(response).to redirect_to(expected_redirect_path) end end @@ -777,7 +757,7 @@ RSpec.describe Projects::PipelinesController do before do project.add_developer(user) - project.project_feature.update(builds_access_level: feature) + project.project_feature.update!(builds_access_level: feature) end context 'with a valid .gitlab-ci.yml file' do |