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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
5bf0441f
Commit
5bf0441f
authored
Apr 24, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup deploymentsd controller spec and use schema validation to test the output
parent
88f69cbd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
9 deletions
+62
-9
spec/controllers/projects/deployments_controller_spec.rb
spec/controllers/projects/deployments_controller_spec.rb
+4
-9
spec/fixtures/api/schemas/deployments.json
spec/fixtures/api/schemas/deployments.json
+58
-0
No files found.
spec/controllers/projects/deployments_controller_spec.rb
View file @
5bf0441f
...
...
@@ -6,16 +6,15 @@ describe Projects::DeploymentsController do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:environment
)
{
create
(
:environment
,
name:
'production'
,
project:
project
)
}
let
(
:deployment
)
{
create
(
:deployment
,
project:
project
,
environment:
environment
)
}
before
do
project
.
team
<<
[
user
,
:master
]
project
.
add_master
(
user
)
sign_in
(
user
)
end
describe
'GET #index'
do
it
'returns list of deployments
withing
last 8 hours'
do
it
'returns list of deployments
from
last 8 hours'
do
create
(
:deployment
,
environment:
environment
,
created_at:
9
.
hours
.
ago
)
create
(
:deployment
,
environment:
environment
,
created_at:
7
.
hours
.
ago
)
create
(
:deployment
,
environment:
environment
)
...
...
@@ -31,13 +30,9 @@ describe Projects::DeploymentsController do
create
(
:deployment
,
environment:
environment
)
get
:index
,
environment_params
expect
(
response
).
to
be_ok
deployments
=
json_response
[
'deployments'
]
deployment_info
=
deployments
.
first
.
with_indifferent_access
expect
(
deployments
.
count
).
to
eq
(
1
)
expect
(
deployment_info
).
to
include
(
:id
,
:iid
,
:sha
,
:ref
,
:tag
,
:created_at
)
expect
(
response
).
to
be_ok
expect
(
response
).
to
match_response_schema
(
'deployments'
)
end
end
...
...
spec/fixtures/api/schemas/deployments.json
0 → 100644
View file @
5bf0441f
{
"additionalProperties"
:
false
,
"properties"
:
{
"deployments"
:
{
"items"
:
{
"additionalProperties"
:
false
,
"properties"
:
{
"created_at"
:
{
"type"
:
"string"
},
"id"
:
{
"type"
:
"integer"
},
"iid"
:
{
"type"
:
"integer"
},
"last?"
:
{
"type"
:
"boolean"
},
"ref"
:
{
"additionalProperties"
:
false
,
"properties"
:
{
"name"
:
{
"type"
:
"string"
}
},
"required"
:
[
"name"
],
"type"
:
"object"
},
"sha"
:
{
"type"
:
"string"
},
"tag"
:
{
"type"
:
"boolean"
}
},
"required"
:
[
"sha"
,
"created_at"
,
"iid"
,
"tag"
,
"last?"
,
"ref"
,
"id"
],
"type"
:
"object"
},
"minItems"
:
1
,
"type"
:
"array"
}
},
"required"
:
[
"deployments"
],
"type"
:
"object"
}
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