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
d3962bf9
Commit
d3962bf9
authored
Jun 18, 2019
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RSpec::Parameterized syntax for CI pipeline build seed specs
parent
76f49de4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
47 deletions
+43
-47
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
+43
-47
No files found.
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
View file @
d3962bf9
...
@@ -153,76 +153,72 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
...
@@ -153,76 +153,72 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
end
end
end
end
context
'when keywords and pipeline source policy matches'
do
context
'with source-keyword policy'
do
possibilities
=
[
%w[pushes push]
,
using
RSpec
::
Parameterized
%w[web web]
,
%w[triggers trigger]
,
let
(
:pipeline
)
{
build
(
:ci_empty_pipeline
,
ref:
'deploy'
,
tag:
false
,
source:
source
)
}
%w[schedules schedule]
,
%w[api api]
,
context
'matches'
do
%w[external external]
]
where
(
:keyword
,
:source
)
do
[
context
'when using only'
do
%w(pushes push)
,
possibilities
.
each
do
|
keyword
,
source
|
%w(web web)
,
context
"when using keyword `
#{
keyword
}
` and source `
#{
source
}
`"
do
%w(triggers trigger)
,
let
(
:pipeline
)
do
%w(schedules schedule)
,
build
(
:ci_empty_pipeline
,
ref:
'deploy'
,
tag:
false
,
source:
source
)
%w(api api)
,
end
%w(external external)
]
end
with_them
do
context
'using an only policy'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
[
keyword
]
}
}
}
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
[
keyword
]
}
}
}
it
{
is_expected
.
to
be_included
}
it
{
is_expected
.
to
be_included
}
end
end
end
end
context
'when using except'
do
possibilities
.
each
do
|
keyword
,
source
|
context
"when using keyword `
#{
keyword
}
` and source `
#{
source
}
`"
do
let
(
:pipeline
)
do
build
(
:ci_empty_pipeline
,
ref:
'deploy'
,
tag:
false
,
source:
source
)
end
context
'using an except policy'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
except:
{
refs:
[
keyword
]
}
}
}
let
(
:attributes
)
{
{
name:
'rspec'
,
except:
{
refs:
[
keyword
]
}
}
}
it
{
is_expected
.
not_to
be_included
}
it
{
is_expected
.
not_to
be_included
}
end
end
context
'using both only and except policies'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
[
keyword
]
},
except:
{
refs:
[
keyword
]
}
}
}
it
{
is_expected
.
not_to
be_included
}
end
end
end
end
end
end
context
'when keywords and pipeline source does not match'
do
context
'non-matches'
do
possibilities
=
[
%w[pushes web]
,
where
(
:keyword
,
:source
)
do
%w[web push]
,
%w(web trigger schedule api external)
.
map
{
|
source
|
[
'pushes'
,
source
]
}
+
%w[triggers schedule]
,
%w(push trigger schedule api external)
.
map
{
|
source
|
[
'web'
,
source
]
}
+
%w[schedules external]
,
%w(push web schedule api external)
.
map
{
|
source
|
[
'triggers'
,
source
]
}
+
%w[api trigger]
,
%w(push web trigger api external)
.
map
{
|
source
|
[
'schedules'
,
source
]
}
+
%w[external api]
]
%w(push web trigger schedule external)
.
map
{
|
source
|
[
'api'
,
source
]
}
+
%w(push web trigger schedule api)
.
map
{
|
source
|
[
'external'
,
source
]
}
context
'when using only'
do
end
possibilities
.
each
do
|
keyword
,
source
|
context
"when using keyword `
#{
keyword
}
` and source `
#{
source
}
`"
do
let
(
:pipeline
)
do
build
(
:ci_empty_pipeline
,
ref:
'deploy'
,
tag:
false
,
source:
source
)
end
with_them
do
context
'using an only policy'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
[
keyword
]
}
}
}
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
[
keyword
]
}
}
}
it
{
is_expected
.
not_to
be_included
}
it
{
is_expected
.
not_to
be_included
}
end
end
end
end
context
'when using except'
do
possibilities
.
each
do
|
keyword
,
source
|
context
"when using keyword `
#{
keyword
}
` and source `
#{
source
}
`"
do
let
(
:pipeline
)
do
build
(
:ci_empty_pipeline
,
ref:
'deploy'
,
tag:
false
,
source:
source
)
end
context
'using an except policy'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
except:
{
refs:
[
keyword
]
}
}
}
let
(
:attributes
)
{
{
name:
'rspec'
,
except:
{
refs:
[
keyword
]
}
}
}
it
{
is_expected
.
to
be_included
}
it
{
is_expected
.
to
be_included
}
end
end
context
'using both only and except policies'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
[
keyword
]
},
except:
{
refs:
[
keyword
]
}
}
}
it
{
is_expected
.
not_to
be_included
}
end
end
end
end
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