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
97caed20
Commit
97caed20
authored
Sep 15, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for CI/CD job policy factory method
parent
a7a7e2d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
spec/lib/gitlab/ci/build/policy_spec.rb
spec/lib/gitlab/ci/build/policy_spec.rb
+40
-0
No files found.
spec/lib/gitlab/ci/build/policy_spec.rb
0 → 100644
View file @
97caed20
require
'spec_helper'
describe
Gitlab
::
Ci
::
Build
::
Policy
do
let
(
:policy
)
{
spy
(
'policy specification'
)
}
before
do
stub_const
(
"
#{
described_class
}
::Something"
,
policy
)
end
describe
'.fabricate'
do
context
'when policy exists'
do
it
'fabricates and initializes relevant policy'
do
specs
=
described_class
.
fabricate
(
something:
'some value'
)
expect
(
specs
).
to
be_an
Array
expect
(
specs
).
to
be_one
expect
(
policy
).
to
have_received
(
:new
).
with
(
'some value'
)
end
end
context
'when some policies are not defined'
do
it
'gracefully skips unknown policies'
do
specs
=
described_class
.
fabricate
(
something:
'first'
,
else:
'unknown'
)
expect
(
specs
).
to
be_an
Array
expect
(
specs
).
to
be_one
expect
(
policy
).
to
have_received
(
:new
).
with
(
'first'
)
end
end
context
'when passing a nil value as specs'
do
it
'returns an empty array'
do
specs
=
described_class
.
fabricate
(
nil
)
expect
(
specs
).
to
be_an
Array
expect
(
specs
).
to
be_empty
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