summaryrefslogtreecommitdiff
path: root/spec/controllers/projects
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-05-01 23:56:33 +0200
committerKamil Trzciński <ayufan@ayufan.eu>2018-05-02 00:05:03 +0200
commit6ea31cb7cd905e61508a0fcdd0b1a61fe758c8ba (patch)
treee3923a01ed715223da887844d4bfc6a09f60bc97 /spec/controllers/projects
parentf7dccbb7ddb7c9a93b934f4452f52abd3ec8e0e7 (diff)
downloadgitlab-ce-6ea31cb7cd905e61508a0fcdd0b1a61fe758c8ba.tar.gz
Add stages_ajax endpoint to serve old HTML
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/pipelines_controller_spec.rb39
1 files changed, 37 insertions, 2 deletions
diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb
index 35ac999cc65..a7a534b0a18 100644
--- a/spec/controllers/projects/pipelines_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_controller_spec.rb
@@ -109,8 +109,7 @@ describe Projects::PipelinesController do
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')
+ expect(response).to match_response_schema('pipeline_stage')
end
end
@@ -133,6 +132,42 @@ 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, 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')) }