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
Tatuya Kamada
gitlab-ce
Commits
0ae7c954
Commit
0ae7c954
authored
Feb 18, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for build status helper class
parent
364072b7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
3 deletions
+36
-3
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+8
-0
spec/lib/ci/status_spec.rb
spec/lib/ci/status_spec.rb
+17
-0
spec/services/ci/create_builds_service_spec.rb
spec/services/ci/create_builds_service_spec.rb
+11
-3
No files found.
spec/factories/ci/builds.rb
View file @
0ae7c954
...
@@ -16,6 +16,14 @@ FactoryGirl.define do
...
@@ -16,6 +16,14 @@ FactoryGirl.define do
commit
factory: :ci_commit
commit
factory: :ci_commit
trait
:success
do
status
'success'
end
trait
:failed
do
status
'failed'
end
trait
:canceled
do
trait
:canceled
do
status
'canceled'
status
'canceled'
end
end
...
...
spec/lib/ci/status_spec.rb
0 → 100644
View file @
0ae7c954
require
'spec_helper'
describe
Ci
::
Status
do
describe
'.get_status'
do
subject
{
described_class
.
get_status
(
builds
)
}
context
'all builds successful'
do
let
(
:builds
)
{
Array
.
new
(
2
)
{
create
(
:ci_build
,
:success
)
}
}
it
{
is_expected
.
to
eq
'success'
}
end
context
'at least one build failed'
do
let
(
:builds
)
{
[
create
(
:ci_build
,
:success
),
create
(
:ci_build
,
:failed
)]
}
it
{
is_expected
.
to
eq
'failed'
}
end
end
end
spec/services/ci/create_builds_service_spec.rb
View file @
0ae7c954
...
@@ -5,16 +5,24 @@ describe Ci::CreateBuildsService, services: true do
...
@@ -5,16 +5,24 @@ describe Ci::CreateBuildsService, services: true do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
describe
'#execute'
do
describe
'#execute'
do
# Using stubbed .gitlab-ci.yml created in commit factory
#
subject
do
subject
do
described_class
.
new
.
execute
(
commit
,
stage
,
'master'
,
nil
,
user
,
nil
,
status
)
described_class
.
new
.
execute
(
commit
,
'test'
,
'master'
,
nil
,
user
,
nil
,
status
)
end
end
context
'stubbed .gitlab-ci.yml'
do
context
'next builds available'
do
let
(
:stage
)
{
'test'
}
let
(
:status
)
{
'success'
}
let
(
:status
)
{
'success'
}
it
{
is_expected
.
to
be_an_instance_of
Array
}
it
{
is_expected
.
to
be_an_instance_of
Array
}
it
{
is_expected
.
to
all
(
be_an_instance_of
Ci
::
Build
)
}
it
{
is_expected
.
to
all
(
be_an_instance_of
Ci
::
Build
)
}
end
end
context
'builds skipped'
do
let
(
:status
)
{
'skipped'
}
it
{
is_expected
.
to
be_empty
}
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