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
1f3f0666
Commit
1f3f0666
authored
Oct 10, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and add spec
parent
4f49f54a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
2 deletions
+67
-2
spec/models/ci/build_spec.rb
spec/models/ci/build_spec.rb
+44
-2
spec/models/deployment_spec.rb
spec/models/deployment_spec.rb
+1
-0
spec/serializers/deployment_entity_spec.rb
spec/serializers/deployment_entity_spec.rb
+22
-0
No files found.
spec/models/ci/build_spec.rb
View file @
1f3f0666
...
...
@@ -1523,11 +1523,11 @@ describe Ci::Build do
end
end
describe
'#other_actions'
do
describe
'#other_
manual_
actions'
do
let
(
:build
)
{
create
(
:ci_build
,
:manual
,
pipeline:
pipeline
)
}
let!
(
:other_build
)
{
create
(
:ci_build
,
:manual
,
pipeline:
pipeline
,
name:
'other action'
)
}
subject
{
build
.
other_actions
}
subject
{
build
.
other_
manual_
actions
}
before
do
project
.
add_developer
(
user
)
...
...
@@ -1558,6 +1558,48 @@ describe Ci::Build do
end
end
describe
'#other_scheduled_actions'
do
let
(
:build
)
{
create
(
:ci_build
,
:scheduled
,
pipeline:
pipeline
)
}
subject
{
build
.
other_scheduled_actions
}
before
do
project
.
add_developer
(
user
)
end
context
"when other build's status is success"
do
let!
(
:other_build
)
{
create
(
:ci_build
,
:schedulable
,
:success
,
pipeline:
pipeline
,
name:
'other action'
)
}
it
'returns other actions'
do
is_expected
.
to
contain_exactly
(
other_build
)
end
end
context
"when other build's status is failed"
do
let!
(
:other_build
)
{
create
(
:ci_build
,
:schedulable
,
:failed
,
pipeline:
pipeline
,
name:
'other action'
)
}
it
'returns other actions'
do
is_expected
.
to
contain_exactly
(
other_build
)
end
end
context
"when other build's status is running"
do
let!
(
:other_build
)
{
create
(
:ci_build
,
:schedulable
,
:running
,
pipeline:
pipeline
,
name:
'other action'
)
}
it
'does not return other actions'
do
is_expected
.
to
be_empty
end
end
context
"when other build's status is scheduled"
do
let!
(
:other_build
)
{
create
(
:ci_build
,
:scheduled
,
pipeline:
pipeline
,
name:
'other action'
)
}
it
'does not return other actions'
do
is_expected
.
to
contain_exactly
(
other_build
)
end
end
end
describe
'#persisted_environment'
do
let!
(
:environment
)
do
create
(
:environment
,
project:
project
,
name:
"foo-
#{
project
.
default_branch
}
"
)
...
...
spec/models/deployment_spec.rb
View file @
1f3f0666
...
...
@@ -12,6 +12,7 @@ describe Deployment do
it
{
is_expected
.
to
delegate_method
(
:commit
).
to
(
:project
)
}
it
{
is_expected
.
to
delegate_method
(
:commit_title
).
to
(
:commit
).
as
(
:try
)
}
it
{
is_expected
.
to
delegate_method
(
:manual_actions
).
to
(
:deployable
).
as
(
:try
)
}
it
{
is_expected
.
to
delegate_method
(
:scheduled_actions
).
to
(
:deployable
).
as
(
:try
)
}
it
{
is_expected
.
to
validate_presence_of
(
:ref
)
}
it
{
is_expected
.
to
validate_presence_of
(
:sha
)
}
...
...
spec/serializers/deployment_entity_spec.rb
View file @
1f3f0666
...
...
@@ -22,4 +22,26 @@ describe DeploymentEntity do
it
'exposes creation date'
do
expect
(
subject
).
to
include
(
:created_at
)
end
describe
'scheduled_actions'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
user:
user
)
}
let
(
:build
)
{
create
(
:ci_build
,
:success
,
pipeline:
pipeline
)
}
let
(
:deployment
)
{
create
(
:deployment
,
deployable:
build
)
}
context
'when deployment has another action'
do
let
(
:other_build
)
{
create
(
:ci_build
,
:scheduled
,
pipeline:
pipeline
,
name:
'other build'
)
}
let!
(
:other_deployment
)
{
create
(
:deployment
,
deployable:
other_build
)
}
it
'returns other actions'
do
expect
(
subject
[
:scheduled_actions
][
0
][
:name
]).
to
eq
'other build'
end
end
context
'when deployment does not have other actions'
do
it
'does not return other actions'
do
expect
(
subject
[
:scheduled_actions
]).
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