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
Boxiang Sun
gitlab-ce
Commits
c7fc65e0
Commit
c7fc65e0
authored
May 17, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zj keen eye
parent
e828e835
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
26 deletions
+12
-26
spec/requests/api/pipeline_schedules_spec.rb
spec/requests/api/pipeline_schedules_spec.rb
+12
-26
No files found.
spec/requests/api/pipeline_schedules_spec.rb
View file @
c7fc65e0
...
@@ -11,11 +11,10 @@ describe API::PipelineSchedules do
...
@@ -11,11 +11,10 @@ describe API::PipelineSchedules do
describe
'GET /projects/:id/pipeline_schedules'
do
describe
'GET /projects/:id/pipeline_schedules'
do
context
'authenticated user with valid permissions'
do
context
'authenticated user with valid permissions'
do
let
(
:pipeline_schedule
)
{
create
(
:ci_pipeline_schedule
,
project:
project
,
owner:
developer
)
}
before
do
before
do
create
(
:ci_pipeline_schedule
,
project:
project
,
owner:
developer
)
pipeline_schedule
.
pipelines
<<
build
(
:ci_pipeline
,
project:
project
)
.
tap
do
|
pipeline_schedule
|
pipeline_schedule
.
pipelines
<<
build
(
:ci_pipeline
,
project:
project
)
end
end
end
it
'returns list of pipeline_schedules'
do
it
'returns list of pipeline_schedules'
do
...
@@ -57,11 +56,10 @@ describe API::PipelineSchedules do
...
@@ -57,11 +56,10 @@ describe API::PipelineSchedules do
end
end
describe
'GET /projects/:id/pipeline_schedules/:pipeline_schedule_id'
do
describe
'GET /projects/:id/pipeline_schedules/:pipeline_schedule_id'
do
let
(
:pipeline_schedule
)
do
let
(
:pipeline_schedule
)
{
create
(
:ci_pipeline_schedule
,
project:
project
,
owner:
developer
)
}
create
(
:ci_pipeline_schedule
,
project:
project
,
owner:
developer
)
.
tap
do
|
pipeline_schedule
|
before
do
pipeline_schedule
.
pipelines
<<
build
(
:ci_pipeline
,
project:
project
)
pipeline_schedule
.
pipelines
<<
build
(
:ci_pipeline
,
project:
project
)
end
end
end
context
'authenticated user with valid permissions'
do
context
'authenticated user with valid permissions'
do
...
@@ -97,11 +95,7 @@ describe API::PipelineSchedules do
...
@@ -97,11 +95,7 @@ describe API::PipelineSchedules do
end
end
describe
'POST /projects/:id/pipeline_schedules'
do
describe
'POST /projects/:id/pipeline_schedules'
do
let
(
:params
)
do
let
(
:params
)
{
attributes_for
(
:ci_pipeline_schedule
)
}
attributes_for
(
:ci_pipeline_schedule
,
description:
'description'
,
ref:
'master'
,
cron:
'* * * * *'
,
cron_timezone:
'UTC'
,
active:
true
)
end
context
'authenticated user with valid permissions'
do
context
'authenticated user with valid permissions'
do
context
'with required parameters'
do
context
'with required parameters'
do
...
@@ -117,7 +111,7 @@ describe API::PipelineSchedules do
...
@@ -117,7 +111,7 @@ describe API::PipelineSchedules do
expect
(
json_response
[
'ref'
]).
to
eq
(
params
[
:ref
])
expect
(
json_response
[
'ref'
]).
to
eq
(
params
[
:ref
])
expect
(
json_response
[
'cron'
]).
to
eq
(
params
[
:cron
])
expect
(
json_response
[
'cron'
]).
to
eq
(
params
[
:cron
])
expect
(
json_response
[
'cron_timezone'
]).
to
eq
(
params
[
:cron_timezone
])
expect
(
json_response
[
'cron_timezone'
]).
to
eq
(
params
[
:cron_timezone
])
expect
(
json_response
[
'
active'
]).
to
eq
(
params
[
:active
]
)
expect
(
json_response
[
'
owner'
][
'id'
]).
to
eq
(
developer
.
id
)
end
end
end
end
...
@@ -132,7 +126,7 @@ describe API::PipelineSchedules do
...
@@ -132,7 +126,7 @@ describe API::PipelineSchedules do
context
'when cron has validation error'
do
context
'when cron has validation error'
do
it
'does not create pipeline_schedule'
do
it
'does not create pipeline_schedule'
do
post
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules"
,
developer
),
post
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules"
,
developer
),
params
.
tap
{
|
_
|
params
[
'cron'
]
=
'invalid-cron'
}
params
.
merge
(
'cron'
=>
'invalid-cron'
)
expect
(
response
).
to
have_http_status
(
:bad_request
)
expect
(
response
).
to
have_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
have_key
(
'cron'
)
expect
(
json_response
[
'message'
]).
to
have_key
(
'cron'
)
...
@@ -211,19 +205,11 @@ describe API::PipelineSchedules do
...
@@ -211,19 +205,11 @@ describe API::PipelineSchedules do
end
end
context
'authenticated user with valid permissions'
do
context
'authenticated user with valid permissions'
do
let
(
:developer2
)
{
create
(
:user
)
}
before
do
project
.
add_developer
(
developer2
)
end
it
'updates owner'
do
it
'updates owner'
do
post
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules/
#{
pipeline_schedule
.
id
}
/take_ownership"
,
developer2
)
post
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules/
#{
pipeline_schedule
.
id
}
/take_ownership"
,
developer
)
pipeline_schedule
.
reload
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'pipeline_schedule'
)
expect
(
response
).
to
match_response_schema
(
'pipeline_schedule'
)
expect
(
pipeline_schedule
.
owner
).
to
eq
(
developer2
)
end
end
end
end
...
@@ -259,7 +245,7 @@ describe API::PipelineSchedules do
...
@@ -259,7 +245,7 @@ describe API::PipelineSchedules do
it
'deletes pipeline_schedule'
do
it
'deletes pipeline_schedule'
do
expect
do
expect
do
delete
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules/
#{
pipeline_schedule
.
id
}
"
,
master
)
delete
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules/
#{
pipeline_schedule
.
id
}
"
,
master
)
end
.
to
change
{
project
.
pipeline_schedules
.
count
}.
by
(
-
1
)
end
.
to
change
{
project
.
pipeline_schedules
.
count
}.
by
(
-
1
)
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'pipeline_schedule'
)
expect
(
response
).
to
match_response_schema
(
'pipeline_schedule'
)
...
...
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