summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/merge_requests_controller_spec.rb8
-rw-r--r--spec/features/merge_requests/create_new_mr_spec.rb20
-rw-r--r--spec/javascripts/commit/pipelines/mock_data.js.es62
-rw-r--r--spec/javascripts/commit/pipelines/pipelines_spec.js.es611
-rw-r--r--spec/javascripts/commit/pipelines/pipelines_store_spec.js.es68
-rw-r--r--spec/javascripts/vue_shared/components/commit_spec.js.es62
-rw-r--r--spec/javascripts/vue_shared/components/pipelines_table_row_spec.js.es66
-rw-r--r--spec/javascripts/vue_shared/components/pipelines_table_spec.js.es68
8 files changed, 44 insertions, 21 deletions
diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb
index d18e8c37901..63780802cfa 100644
--- a/spec/controllers/projects/merge_requests_controller_spec.rb
+++ b/spec/controllers/projects/merge_requests_controller_spec.rb
@@ -33,11 +33,17 @@ describe Projects::MergeRequestsController do
end
context 'when rendering JSON response' do
+ before do
+ create(:ci_pipeline, sha: fork_project.commit('remove-submodule').id,
+ ref: 'remove-submodule',
+ project: fork_project)
+ end
+
it 'renders JSON including serialized pipelines' do
submit_new_merge_request(format: :json)
- expect(json_response).to have_key('pipelines')
expect(response).to be_ok
+ expect(json_response).not_to be_empty
end
end
end
diff --git a/spec/features/merge_requests/create_new_mr_spec.rb b/spec/features/merge_requests/create_new_mr_spec.rb
index f1b68a39343..e853fb7e016 100644
--- a/spec/features/merge_requests/create_new_mr_spec.rb
+++ b/spec/features/merge_requests/create_new_mr_spec.rb
@@ -84,4 +84,24 @@ feature 'Create New Merge Request', feature: true, js: true do
expect(page).not_to have_selector('#error_explanation')
expect(page).not_to have_content('The form contains the following error')
end
+
+ context 'when a new merge request has a pipeline' do
+ let!(:pipeline) do
+ create(:ci_pipeline, sha: project.commit('fix').id,
+ ref: 'fix',
+ project: project)
+ end
+
+ it 'shows pipelines for a new merge request' do
+ visit new_namespace_project_merge_request_path(
+ project.namespace, project,
+ merge_request: { target_branch: 'master', source_branch: 'fix' })
+
+ page.within('.merge-request') do
+ click_link 'Pipelines'
+
+ expect(page).to have_content "##{pipeline.id}"
+ end
+ end
+ end
end
diff --git a/spec/javascripts/commit/pipelines/mock_data.js.es6 b/spec/javascripts/commit/pipelines/mock_data.js.es6
index 5f0f26a013c..188908d66bd 100644
--- a/spec/javascripts/commit/pipelines/mock_data.js.es6
+++ b/spec/javascripts/commit/pipelines/mock_data.js.es6
@@ -88,3 +88,5 @@ const pipeline = {
created_at: '2017-01-16T17:13:59.800Z',
updated_at: '2017-01-25T00:00:17.132Z',
};
+
+module.exports = pipeline;
diff --git a/spec/javascripts/commit/pipelines/pipelines_spec.js.es6 b/spec/javascripts/commit/pipelines/pipelines_spec.js.es6
index c2b61632827..f09c57978a1 100644
--- a/spec/javascripts/commit/pipelines/pipelines_spec.js.es6
+++ b/spec/javascripts/commit/pipelines/pipelines_spec.js.es6
@@ -1,18 +1,17 @@
/* global pipeline, Vue */
-require('vue-resource');
-require('flash');
+require('~/flash');
require('~/commit/pipelines/pipelines_store');
require('~/commit/pipelines/pipelines_service');
require('~/commit/pipelines/pipelines_table');
-require('~vue_shared/vue_resource_interceptor');
-require('./mock_data');
+require('~/vue_shared/vue_resource_interceptor');
+const pipeline = require('./mock_data');
describe('Pipelines table in Commits and Merge requests', () => {
- preloadFixtures('pipelines_table');
+ preloadFixtures('static/pipelines_table.html.raw');
beforeEach(() => {
- loadFixtures('pipelines_table');
+ loadFixtures('static/pipelines_table.html.raw');
});
describe('successfull request', () => {
diff --git a/spec/javascripts/commit/pipelines/pipelines_store_spec.js.es6 b/spec/javascripts/commit/pipelines/pipelines_store_spec.js.es6
index a5a16544ffb..559723bafcc 100644
--- a/spec/javascripts/commit/pipelines/pipelines_store_spec.js.es6
+++ b/spec/javascripts/commit/pipelines/pipelines_store_spec.js.es6
@@ -1,10 +1,10 @@
-require('~commit/pipelines/pipelines_store');
+require('~/commit/pipelines/pipelines_store');
describe('Store', () => {
- const store = gl.commits.pipelines.PipelinesStore;
+ let store;
beforeEach(() => {
- store.create();
+ store = new gl.commits.pipelines.PipelinesStore();
});
it('should start with a blank state', () => {
@@ -23,7 +23,7 @@ describe('Store', () => {
},
];
- store.store(pipelines);
+ store.storePipelines(pipelines);
expect(store.state.pipelines.length).toBe(pipelines.length);
});
diff --git a/spec/javascripts/vue_shared/components/commit_spec.js.es6 b/spec/javascripts/vue_shared/components/commit_spec.js.es6
index 84d169a3fb9..15ab10b9b69 100644
--- a/spec/javascripts/vue_shared/components/commit_spec.js.es6
+++ b/spec/javascripts/vue_shared/components/commit_spec.js.es6
@@ -1,4 +1,4 @@
-require('~/vue_shared/components/committ');
+require('~/vue_shared/components/commit');
describe('Commit component', () => {
let props;
diff --git a/spec/javascripts/vue_shared/components/pipelines_table_row_spec.js.es6 b/spec/javascripts/vue_shared/components/pipelines_table_row_spec.js.es6
index e83a1749e82..412abfd5e41 100644
--- a/spec/javascripts/vue_shared/components/pipelines_table_row_spec.js.es6
+++ b/spec/javascripts/vue_shared/components/pipelines_table_row_spec.js.es6
@@ -1,7 +1,5 @@
-/* global pipeline */
-
-require('~vue_shared/components/pipelines_table_row');
-require('./mock_data');
+require('~/vue_shared/components/pipelines_table_row');
+const pipeline = require('../../commit/pipelines/mock_data');
describe('Pipelines Table Row', () => {
let component;
diff --git a/spec/javascripts/vue_shared/components/pipelines_table_spec.js.es6 b/spec/javascripts/vue_shared/components/pipelines_table_spec.js.es6
index adc9ea904cc..54d81e2ea7d 100644
--- a/spec/javascripts/vue_shared/components/pipelines_table_spec.js.es6
+++ b/spec/javascripts/vue_shared/components/pipelines_table_spec.js.es6
@@ -1,8 +1,6 @@
-/* global pipeline */
-
-require('~vue_shared/components/pipelines_table');
-require('~lib/utils/datetime_utility');
-require('./mock_data');
+require('~/vue_shared/components/pipelines_table');
+require('~/lib/utils/datetime_utility');
+const pipeline = require('../../commit/pipelines/mock_data');
describe('Pipelines Table', () => {
preloadFixtures('static/environments/element.html.raw');