Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
4fa4a2ce
Commit
4fa4a2ce
authored
Mar 06, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add controllers spec
parent
af86d336
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
0 deletions
+67
-0
spec/controllers/projects/builds_controller_spec.rb
spec/controllers/projects/builds_controller_spec.rb
+30
-0
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+20
-0
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+17
-0
No files found.
spec/controllers/projects/builds_controller_spec.rb
0 → 100644
View file @
4fa4a2ce
require
'spec_helper'
describe
Projects
::
BuildsController
do
include
ApiHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
before
do
sign_in
(
user
)
end
describe
'GET status.json'
do
context
'when accessing status'
do
before
do
pipeline
=
create
(
:ci_pipeline
,
project:
project
)
build
=
create
(
:ci_build
,
pipeline:
pipeline
,
status:
'success'
)
get
:status
,
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
build
.
id
,
format: :json
end
it
'returns pipeline status via BuildSerializer'
do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'details'
][
'status'
][
'text'
]).
to
eq
'passed'
end
end
end
end
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
4fa4a2ce
...
...
@@ -1178,4 +1178,24 @@ describe Projects::MergeRequestsController do
end
end
end
describe
'GET status.json'
do
context
'when accessing status'
do
before
do
create
(
:ci_pipeline
,
project:
merge_request
.
source_project
,
ref:
merge_request
.
source_branch
,
sha:
merge_request
.
diff_head_sha
,
status:
'success'
)
get
:status
,
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
merge_request
.
iid
,
format: :json
end
it
'returns pipeline status via PipelineSerializer'
do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'details'
][
'status'
][
'text'
]).
to
eq
'passed'
end
end
end
end
spec/controllers/projects/pipelines_controller_spec.rb
View file @
4fa4a2ce
...
...
@@ -69,4 +69,21 @@ describe Projects::PipelinesController do
format: :json
end
end
describe
'GET status.json'
do
context
'when accessing status'
do
before
do
pipeline
=
create
(
:ci_pipeline
,
project:
project
,
status:
'success'
)
get
:status
,
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
pipeline
.
id
,
format: :json
end
it
'returns pipeline status via PipelineSerializer'
do
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
json_response
[
'details'
][
'status'
][
'text'
]).
to
eq
'passed'
end
end
end
end
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