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
b9d43e27
Commit
b9d43e27
authored
Jun 25, 2019
by
drew cimino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added specs for Ci::Pipeline::Seed::Build
- #included? when only: and except: both match
parent
d50125a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
8 deletions
+49
-8
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
+49
-8
No files found.
spec/lib/gitlab/ci/pipeline/seed/build_spec.rb
View file @
b9d43e27
...
...
@@ -3,14 +3,9 @@ require 'spec_helper'
describe
Gitlab
::
Ci
::
Pipeline
::
Seed
::
Build
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
let
(
:attributes
)
{
{
name:
'rspec'
,
ref:
'master'
}
}
let
(
:attributes
)
do
{
name:
'rspec'
,
ref:
'master'
}
end
subject
do
described_class
.
new
(
pipeline
,
attributes
)
end
subject
{
described_class
.
new
(
pipeline
,
attributes
)
}
describe
'#attributes'
do
it
'returns hash attributes of a build'
do
...
...
@@ -76,7 +71,7 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
end
end
describe
'applying
only/except
policies'
do
describe
'applying
job inclusion
policies'
do
context
'when no branch policy is specified'
do
let
(
:attributes
)
{
{
name:
'rspec'
}
}
...
...
@@ -95,6 +90,12 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
it
{
is_expected
.
to
be_included
}
end
context
'with both only and except policies'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
%w(deploy)
},
except:
{
refs:
%(deploy)
}
}
}
it
{
is_expected
.
not_to
be_included
}
end
end
context
'when branch regexp policy does not match'
do
...
...
@@ -109,6 +110,12 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
it
{
is_expected
.
to
be_included
}
end
context
'with both only and except policies'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
%w(/^deploy$/)
},
except:
{
refs:
%w(/^deploy$/)
}
}
}
it
{
is_expected
.
not_to
be_included
}
end
end
context
'when branch policy matches'
do
...
...
@@ -123,6 +130,12 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
it
{
is_expected
.
not_to
be_included
}
end
context
'when using both only and except policies'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
%w(deploy master)
},
except:
{
refs:
%w(deploy master)
}
}
}
it
{
is_expected
.
not_to
be_included
}
end
end
context
'when keyword policy matches'
do
...
...
@@ -137,6 +150,12 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
it
{
is_expected
.
not_to
be_included
}
end
context
'when using both only and except policies'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
%w(branches)
},
except:
{
refs:
%(branches)
}
}
}
it
{
is_expected
.
not_to
be_included
}
end
end
context
'when keyword policy does not match'
do
...
...
@@ -151,6 +170,12 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
it
{
is_expected
.
to
be_included
}
end
context
'when using both only and except policies'
do
let
(
:attributes
)
{
{
name:
'rspec'
,
only:
{
refs:
%(tags)
},
except:
{
refs:
%(tags)
}
}
}
it
{
is_expected
.
not_to
be_included
}
end
end
context
'with source-keyword policy'
do
...
...
@@ -239,6 +264,14 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
it
{
is_expected
.
not_to
be_included
}
end
context
'when using both only and except policies'
do
let
(
:attributes
)
do
{
name:
'rspec'
,
only:
{
refs:
[
"branches@
#{
pipeline
.
project_full_path
}
"
]
},
except:
{
refs:
[
"branches@
#{
pipeline
.
project_full_path
}
"
]
}
}
end
it
{
is_expected
.
not_to
be_included
}
end
end
context
'when repository path does not matches'
do
...
...
@@ -257,6 +290,14 @@ describe Gitlab::Ci::Pipeline::Seed::Build do
it
{
is_expected
.
to
be_included
}
end
context
'when using both only and except policies'
do
let
(
:attributes
)
do
{
name:
'rspec'
,
only:
{
refs:
[
'branches@fork'
]
},
except:
{
refs:
[
'branches@fork'
]
}
}
end
it
{
is_expected
.
not_to
be_included
}
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