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
fbb07064
Commit
fbb07064
authored
May 13, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add validation spec
parent
0a11ab48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
spec/requests/api/pipeline_schedules_spec.rb
spec/requests/api/pipeline_schedules_spec.rb
+21
-11
No files found.
spec/requests/api/pipeline_schedules_spec.rb
View file @
fbb07064
...
@@ -118,6 +118,17 @@ describe API::PipelineSchedules do
...
@@ -118,6 +118,17 @@ describe API::PipelineSchedules do
expect
(
response
).
to
have_http_status
(
:bad_request
)
expect
(
response
).
to
have_http_status
(
:bad_request
)
end
end
end
end
context
'when cron has validation error'
do
it
'does not create pipeline_schedule'
do
post
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules"
,
developer
),
description:
description
,
ref:
ref
,
cron:
'invalid-cron'
,
cron_timezone:
cron_timezone
,
active:
active
expect
(
response
).
to
have_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
have_key
(
'cron'
)
end
end
end
end
context
'authenticated user with invalid permissions'
do
context
'authenticated user with invalid permissions'
do
...
@@ -147,17 +158,6 @@ describe API::PipelineSchedules do
...
@@ -147,17 +158,6 @@ describe API::PipelineSchedules do
end
end
context
'authenticated user with valid permissions'
do
context
'authenticated user with valid permissions'
do
let
(
:new_ref
)
{
'patch-x'
}
it
'updates ref'
do
put
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules/
#{
pipeline_schedule
.
id
}
"
,
developer
),
ref:
new_ref
expect
(
response
).
to
have_http_status
(
:ok
)
expect
(
response
).
to
match_response_schema
(
'pipeline_schedule'
)
expect
(
json_response
[
'ref'
]).
to
eq
(
new_ref
)
end
let
(
:new_cron
)
{
'1 2 3 4 *'
}
let
(
:new_cron
)
{
'1 2 3 4 *'
}
it
'updates cron'
do
it
'updates cron'
do
...
@@ -173,6 +173,16 @@ describe API::PipelineSchedules do
...
@@ -173,6 +173,16 @@ describe API::PipelineSchedules do
expect
(
pipeline_schedule
.
next_run_at
.
day
).
to
eq
(
3
)
expect
(
pipeline_schedule
.
next_run_at
.
day
).
to
eq
(
3
)
expect
(
pipeline_schedule
.
next_run_at
.
month
).
to
eq
(
4
)
expect
(
pipeline_schedule
.
next_run_at
.
month
).
to
eq
(
4
)
end
end
context
'when cron has validation error'
do
it
'does not update pipeline_schedule'
do
put
api
(
"/projects/
#{
project
.
id
}
/pipeline_schedules/
#{
pipeline_schedule
.
id
}
"
,
developer
),
cron:
'invalid-cron'
expect
(
response
).
to
have_http_status
(
:bad_request
)
expect
(
json_response
[
'message'
]).
to
have_key
(
'cron'
)
end
end
end
end
context
'authenticated user with invalid permissions'
do
context
'authenticated user with invalid permissions'
do
...
...
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