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
a615b544
Commit
a615b544
authored
Apr 15, 2020
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use table syntax for Ci::Processable validation spec conditions
parent
755601ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
53 deletions
+16
-53
spec/models/ci/processable_spec.rb
spec/models/ci/processable_spec.rb
+16
-53
No files found.
spec/models/ci/processable_spec.rb
View file @
a615b544
...
...
@@ -53,68 +53,31 @@ describe Ci::Processable do
describe
'validate presence of scheduling_type'
do
context
'on create'
do
let
(
:processable
)
do
build
(
:ci_build
,
:created
,
project:
project
,
pipeline:
pipeline
,
importing:
importing
,
scheduling_type:
nil
)
end
context
'when importing'
do
let
(
:importing
)
{
true
}
using
RSpec
::
Parameterized
::
TableSyntax
context
'when validate_scheduling_type_of_processables is true'
do
before
do
stub_feature_flags
(
validate_scheduling_type_of_processables:
true
)
end
subject
{
build
(
:ci_build
,
project:
project
,
pipeline:
pipeline
,
importing:
importing
)
}
it
'does not validate'
do
expect
(
processable
).
to
be_valid
end
end
context
'when validate_scheduling_type_of_processables is false'
do
before
do
stub_feature_flags
(
validate_scheduling_type_of_processables:
false
)
end
it
'does not validate'
do
expect
(
processable
).
to
be_valid
end
end
where
(
:importing
,
:validate_scheduling_type_flag
,
:should_validate
)
do
false
|
true
|
true
false
|
false
|
false
true
|
true
|
false
true
|
false
|
false
end
context
'when not importing'
do
let
(
:importing
)
{
false
}
context
'when validate_scheduling_type_of_processables is true'
do
before
do
stub_feature_flags
(
validate_scheduling_type_of_processables:
true
)
end
it
'validates'
do
expect
(
processable
).
not_to
be_valid
end
with_them
do
before
do
stub_feature_flags
(
validate_scheduling_type_of_processables:
validate_scheduling_type_flag
)
end
context
'when validate_scheduling_type_of_processables is false'
do
before
do
stub_feature_flags
(
validate_scheduling_type_of_processables:
false
)
end
it
'does not validate'
do
expect
(
processable
).
to
be_valid
it
'validates on create'
do
if
should_validate
is_expected
.
to
validate_presence_of
(
:scheduling_type
).
on
(
:create
)
else
is_expected
.
not_to
validate_presence_of
(
:scheduling_type
).
on
(
:create
)
end
end
end
end
context
'on update'
do
let
(
:processable
)
{
create
(
:ci_build
,
:created
,
project:
project
,
pipeline:
pipeline
)
}
it
'does not validate'
do
processable
.
scheduling_type
=
nil
expect
(
processable
).
to
be_valid
it
{
is_expected
.
not_to
validate_presence_of
(
:scheduling_type
).
on
(
:update
)
}
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