BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
71c80375
Commit
71c80375
authored
Feb 07, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/gb/invalid-new-merge-request-api' into 'master'
Fix rendering pipelines for a new merge request See merge request !9032
parents
9aafb2a6
d410c937
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
52 additions
and
25 deletions
+52
-25
merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+4
-2
_new_submit.html.haml
app/views/projects/merge_requests/_new_submit.html.haml
+1
-1
_pipelines.html.haml
app/views/projects/merge_requests/show/_pipelines.html.haml
+3
-1
merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+7
-1
create_new_mr_spec.rb
spec/features/merge_requests/create_new_mr_spec.rb
+20
-0
mock_data.js.es6
spec/javascripts/commit/pipelines/mock_data.js.es6
+2
-0
pipelines_spec.js.es6
spec/javascripts/commit/pipelines/pipelines_spec.js.es6
+5
-6
pipelines_store_spec.js.es6
.../javascripts/commit/pipelines/pipelines_store_spec.js.es6
+4
-4
commit_spec.js.es6
spec/javascripts/vue_shared/components/commit_spec.js.es6
+1
-1
pipelines_table_row_spec.js.es6
...pts/vue_shared/components/pipelines_table_row_spec.js.es6
+2
-4
pipelines_table_spec.js.es6
...scripts/vue_shared/components/pipelines_table_spec.js.es6
+3
-5
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
71c80375
...
...
@@ -229,9 +229,11 @@ class Projects::MergeRequestsController < Projects::ApplicationController
respond_to
do
|
format
|
format
.
html
{
define_new_vars
}
format
.
json
do
render
json:
{
pipelines:
PipelineSerializer
define_pipelines_vars
render
json:
PipelineSerializer
.
new
(
project:
@project
,
user:
@current_user
)
.
represent
(
@pipelines
)
}
.
represent
(
@pipelines
)
end
end
end
...
...
app/views/projects/merge_requests/_new_submit.html.haml
View file @
71c80375
...
...
@@ -46,7 +46,7 @@
-# This tab is always loaded via AJAX
-
if
@pipelines
.
any?
#pipelines
.pipelines.tab-pane
=
render
"projects/merge_requests/show/pipelines"
,
endpoint:
link_to
(
url_for
(
params
))
=
render
'projects/merge_requests/show/pipelines'
,
endpoint:
url_for
(
params
.
merge
(
format: :json
))
.mr-loading-status
=
spinner
...
...
app/views/projects/merge_requests/show/_pipelines.html.haml
View file @
71c80375
=
render
'projects/commit/pipelines_list'
,
endpoint:
pipelines_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
-
endpoint_path
=
local_assigns
[
:endpoint
]
||
pipelines_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
,
format: :json
)
=
render
'projects/commit/pipelines_list'
,
endpoint:
endpoint_path
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
71c80375
...
...
@@ -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
...
...
spec/features/merge_requests/create_new_mr_spec.rb
View file @
71c80375
...
...
@@ -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
spec/javascripts/commit/pipelines/mock_data.js.es6
View file @
71c80375
...
...
@@ -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;
spec/javascripts/commit/pipelines/pipelines_spec.js.es6
View file @
71c80375
/* 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', () => {
...
...
spec/javascripts/commit/pipelines/pipelines_store_spec.js.es6
View file @
71c80375
require('~commit/pipelines/pipelines_store');
require('~
/
commit/pipelines/pipelines_store');
describe('Store', () => {
const store = gl.commits.pipelines.PipelinesS
tore;
let s
tore;
beforeEach(() => {
store
.creat
e();
store
= new gl.commits.pipelines.PipelinesStor
e();
});
it('should start with a blank state', () => {
...
...
@@ -23,7 +23,7 @@ describe('Store', () => {
},
];
store.store(pipelines);
store.store
Pipelines
(pipelines);
expect(store.state.pipelines.length).toBe(pipelines.length);
});
...
...
spec/javascripts/vue_shared/components/commit_spec.js.es6
View file @
71c80375
require('~/vue_shared/components/commit
t
');
require('~/vue_shared/components/commit');
describe('Commit component', () => {
let props;
...
...
spec/javascripts/vue_shared/components/pipelines_table_row_spec.js.es6
View file @
71c80375
/* 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;
...
...
spec/javascripts/vue_shared/components/pipelines_table_spec.js.es6
View file @
71c80375
/* 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');
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment