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
3447d71e
Commit
3447d71e
authored
Mar 29, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for empty states .matches? methods
parent
ddabac46
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
1 deletion
+110
-1
spec/lib/gitlab/ci/status/build/canceled_spec.rb
spec/lib/gitlab/ci/status/build/canceled_spec.rb
+22
-0
spec/lib/gitlab/ci/status/build/created_spec.rb
spec/lib/gitlab/ci/status/build/created_spec.rb
+22
-0
spec/lib/gitlab/ci/status/build/manual_spec.rb
spec/lib/gitlab/ci/status/build/manual_spec.rb
+22
-1
spec/lib/gitlab/ci/status/build/pending_spec.rb
spec/lib/gitlab/ci/status/build/pending_spec.rb
+22
-0
spec/lib/gitlab/ci/status/build/skipped_spec.rb
spec/lib/gitlab/ci/status/build/skipped_spec.rb
+22
-0
No files found.
spec/lib/gitlab/ci/status/build/canceled_spec.rb
View file @
3447d71e
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Canceled
do
let
(
:user
)
{
create
(
:user
)
}
subject
do
described_class
.
new
(
double
(
'subject'
))
end
...
...
@@ -8,4 +10,24 @@ describe Gitlab::Ci::Status::Build::Canceled do
describe
'#illustration'
do
it
{
expect
(
subject
.
illustration
).
to
include
(
:image
,
:size
,
:title
)
}
end
describe
'.matches?'
do
subject
{
described_class
.
matches?
(
build
,
user
)
}
context
'when build is canceled'
do
let
(
:build
)
{
create
(
:ci_build
,
:canceled
)
}
it
'is a correct match'
do
expect
(
subject
).
to
be
true
end
end
context
'when build is not canceled'
do
let
(
:build
)
{
create
(
:ci_build
)
}
it
'does not match'
do
expect
(
subject
).
to
be
false
end
end
end
end
spec/lib/gitlab/ci/status/build/created_spec.rb
View file @
3447d71e
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Created
do
let
(
:user
)
{
create
(
:user
)
}
subject
do
described_class
.
new
(
double
(
'subject'
))
end
...
...
@@ -8,4 +10,24 @@ describe Gitlab::Ci::Status::Build::Created do
describe
'#illustration'
do
it
{
expect
(
subject
.
illustration
).
to
include
(
:image
,
:size
,
:title
,
:content
)
}
end
describe
'.matches?'
do
subject
{
described_class
.
matches?
(
build
,
user
)
}
context
'when build is created'
do
let
(
:build
)
{
create
(
:ci_build
,
:created
)
}
it
'is a correct match'
do
expect
(
subject
).
to
be
true
end
end
context
'when build is not created'
do
let
(
:build
)
{
create
(
:ci_build
)
}
it
'does not match'
do
expect
(
subject
).
to
be
false
end
end
end
end
spec/lib/gitlab/ci/status/build/manual_spec.rb
View file @
3447d71e
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Manual
do
let
(
:user
)
{
create
(
:user
)
}
subject
do
user
=
create
(
:user
)
build
=
create
(
:ci_build
,
:manual
)
described_class
.
new
(
Gitlab
::
Ci
::
Status
::
Core
.
new
(
build
,
user
))
end
...
...
@@ -10,4 +11,24 @@ describe Gitlab::Ci::Status::Build::Manual do
describe
'#illustration'
do
it
{
expect
(
subject
.
illustration
).
to
include
(
:image
,
:size
,
:title
,
:content
)
}
end
describe
'.matches?'
do
subject
{
described_class
.
matches?
(
build
,
user
)
}
context
'when build is manual'
do
let
(
:build
)
{
create
(
:ci_build
,
:manual
)
}
it
'is a correct match'
do
expect
(
subject
).
to
be
true
end
end
context
'when build is not manual'
do
let
(
:build
)
{
create
(
:ci_build
)
}
it
'does not match'
do
expect
(
subject
).
to
be
false
end
end
end
end
spec/lib/gitlab/ci/status/build/pending_spec.rb
View file @
3447d71e
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Pending
do
let
(
:user
)
{
create
(
:user
)
}
subject
do
described_class
.
new
(
double
(
'subject'
))
end
...
...
@@ -8,4 +10,24 @@ describe Gitlab::Ci::Status::Build::Pending do
describe
'#illustration'
do
it
{
expect
(
subject
.
illustration
).
to
include
(
:image
,
:size
,
:title
,
:content
)
}
end
describe
'.matches?'
do
subject
{
described_class
.
matches?
(
build
,
user
)
}
context
'when build is pending'
do
let
(
:build
)
{
create
(
:ci_build
,
:pending
)
}
it
'is a correct match'
do
expect
(
subject
).
to
be
true
end
end
context
'when build is not pending'
do
let
(
:build
)
{
create
(
:ci_build
,
:success
)
}
it
'does not match'
do
expect
(
subject
).
to
be
false
end
end
end
end
spec/lib/gitlab/ci/status/build/skipped_spec.rb
View file @
3447d71e
require
'spec_helper'
describe
Gitlab
::
Ci
::
Status
::
Build
::
Skipped
do
let
(
:user
)
{
create
(
:user
)
}
subject
do
described_class
.
new
(
double
(
'subject'
))
end
...
...
@@ -8,4 +10,24 @@ describe Gitlab::Ci::Status::Build::Skipped do
describe
'#illustration'
do
it
{
expect
(
subject
.
illustration
).
to
include
(
:image
,
:size
,
:title
)
}
end
describe
'.matches?'
do
subject
{
described_class
.
matches?
(
build
,
user
)
}
context
'when build is skipped'
do
let
(
:build
)
{
create
(
:ci_build
,
:skipped
)
}
it
'is a correct match'
do
expect
(
subject
).
to
be
true
end
end
context
'when build is not skipped'
do
let
(
:build
)
{
create
(
:ci_build
)
}
it
'does not match'
do
expect
(
subject
).
to
be
false
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