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
Jérome Perrin
gitlab-ce
Commits
60425c23
Commit
60425c23
authored
Jul 06, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce less meaningful test suits from pipeline_schedules_controller_spec.rb
parent
9a9aaa56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
108 deletions
+0
-108
spec/controllers/projects/pipeline_schedules_controller_spec.rb
...ontrollers/projects/pipeline_schedules_controller_spec.rb
+0
-108
No files found.
spec/controllers/projects/pipeline_schedules_controller_spec.rb
View file @
60425c23
...
...
@@ -75,18 +75,6 @@ describe Projects::PipelineSchedulesController do
attributes_for
(
:ci_pipeline_schedule
)
end
context
'when variables_attributes is empty'
do
let
(
:schedule
)
{
basic_param
}
it
'creates a new schedule'
do
expect
{
go
}
.
to
change
{
Ci
::
PipelineSchedule
.
count
}.
by
(
1
)
.
and
change
{
Ci
::
PipelineScheduleVariable
.
count
}.
by
(
0
)
expect
(
response
).
to
have_http_status
(
:found
)
end
end
context
'when variables_attributes has one variable'
do
let
(
:schedule
)
do
basic_param
.
merge
({
...
...
@@ -106,57 +94,6 @@ describe Projects::PipelineSchedulesController do
expect
(
v
.
value
).
to
eq
(
"AAA123"
)
end
end
context
'when the same key has already been persisted'
do
it
'returns an error that the key of variable is invaild'
do
go
pipeline_schedule_variable
=
build
(
:ci_pipeline_schedule_variable
,
key:
'AAA'
,
pipeline_schedule:
assigns
(
:schedule
))
expect
(
pipeline_schedule_variable
).
to
be_invalid
end
end
end
context
'when variables_attributes has one variable and key is empty'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
key:
''
,
value:
'AAA123'
}]
})
end
it
'returns an error that the key of variable is invaild'
do
expect
{
go
}
.
to
change
{
Ci
::
PipelineSchedule
.
count
}.
by
(
0
)
.
and
change
{
Ci
::
PipelineScheduleVariable
.
count
}.
by
(
0
)
expect
(
assigns
(
:schedule
).
errors
[
'variables.key'
]).
not_to
be_empty
end
end
context
'when variables_attributes has two variables and unique'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
key:
'AAA'
,
value:
'AAA123'
},
{
key:
'BBB'
,
value:
'BBB123'
}]
})
end
it
'creates a new schedule'
do
expect
{
go
}
.
to
change
{
Ci
::
PipelineSchedule
.
count
}.
by
(
1
)
.
and
change
{
Ci
::
PipelineScheduleVariable
.
count
}.
by
(
2
)
expect
(
response
).
to
have_http_status
(
:found
)
Ci
::
PipelineScheduleVariable
.
first
.
tap
do
|
v
|
expect
(
v
.
key
).
to
eq
(
"AAA"
)
expect
(
v
.
value
).
to
eq
(
"AAA123"
)
end
Ci
::
PipelineScheduleVariable
.
last
.
tap
do
|
v
|
expect
(
v
.
key
).
to
eq
(
"BBB"
)
expect
(
v
.
value
).
to
eq
(
"BBB123"
)
end
end
end
context
'when variables_attributes has two variables and duplicted'
do
...
...
@@ -210,19 +147,6 @@ describe Projects::PipelineSchedulesController do
{
description:
'updated_desc'
,
cron:
'0 1 * * *'
,
cron_timezone:
'UTC'
,
ref:
'patch-x'
,
active:
true
}
end
context
'when params do not include variables'
do
let
(
:schedule
)
{
basic_param
}
it
'updates only scheduled pipeline attributes'
do
go
pipeline_schedule
.
reload
expect
(
response
).
to
have_http_status
(
:found
)
expect
(
pipeline_schedule
).
to
have_attributes
(
basic_param
)
expect
(
pipeline_schedule
.
variables
).
to
be_empty
end
end
context
'when params include one variable'
do
let
(
:schedule
)
do
basic_param
.
merge
({
...
...
@@ -240,25 +164,6 @@ describe Projects::PipelineSchedulesController do
end
end
context
'when params include two unique variables'
do
let
(
:schedule
)
do
basic_param
.
merge
({
variables_attributes:
[{
key:
'AAA'
,
value:
'AAA123'
},
{
key:
'BBB'
,
value:
'BBB123'
}]
})
end
it
'inserts two new variables to the pipeline schedule'
do
expect
{
go
}.
to
change
{
Ci
::
PipelineScheduleVariable
.
count
}.
by
(
2
)
pipeline_schedule
.
reload
expect
(
response
).
to
have_http_status
(
:found
)
expect
(
pipeline_schedule
.
variables
.
first
.
key
).
to
eq
(
'AAA'
)
expect
(
pipeline_schedule
.
variables
.
first
.
value
).
to
eq
(
'AAA123'
)
expect
(
pipeline_schedule
.
variables
.
last
.
key
).
to
eq
(
'BBB'
)
expect
(
pipeline_schedule
.
variables
.
last
.
value
).
to
eq
(
'BBB123'
)
end
end
context
'when params include two duplicated variables'
do
let
(
:schedule
)
do
basic_param
.
merge
({
...
...
@@ -284,19 +189,6 @@ describe Projects::PipelineSchedulesController do
key:
'CCC'
,
pipeline_schedule:
pipeline_schedule
)
end
context
'when params do not include variables'
do
let
(
:schedule
)
{
basic_param
}
it
'updates only scheduled pipeline attributes'
do
go
pipeline_schedule
.
reload
expect
(
response
).
to
have_http_status
(
:found
)
expect
(
pipeline_schedule
).
to
have_attributes
(
basic_param
)
expect
(
pipeline_schedule
.
variables
.
last
.
key
).
to
eq
(
'CCC'
)
end
end
context
'when params include one variable'
do
context
'when adds a new variable'
do
let
(
:schedule
)
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