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
Jérome Perrin
gitlab-ce
Commits
a63ea487
Commit
a63ea487
authored
Jun 01, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend specs for builds badge
Related to #17549
parent
30524901
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
spec/lib/gitlab/badge/build_spec.rb
spec/lib/gitlab/badge/build_spec.rb
+23
-3
No files found.
spec/lib/gitlab/badge/build_spec.rb
View file @
a63ea487
...
@@ -42,9 +42,7 @@ describe Gitlab::Badge::Build do
...
@@ -42,9 +42,7 @@ describe Gitlab::Badge::Build do
end
end
context
'build exists'
do
context
'build exists'
do
let
(
:ci_commit
)
{
create
(
:ci_commit
,
project:
project
,
sha:
sha
,
ref:
branch
)
}
let!
(
:build
)
{
create_build
(
project
,
sha
,
branch
)
}
let!
(
:build
)
{
create
(
:ci_build
,
commit:
ci_commit
)
}
context
'build success'
do
context
'build success'
do
before
{
build
.
success!
}
before
{
build
.
success!
}
...
@@ -96,6 +94,28 @@ describe Gitlab::Badge::Build do
...
@@ -96,6 +94,28 @@ describe Gitlab::Badge::Build do
end
end
end
end
context
'when outdated pipeline for given ref exists'
do
before
do
build
=
create_build
(
project
,
sha
,
branch
)
build
.
success!
old_build
=
create_build
(
project
,
'11eeffdd'
,
branch
)
old_build
.
drop!
end
it
'does not take outdated pipeline into account'
do
expect
(
badge
.
to_s
).
to
eq
'build-success'
end
end
def
create_build
(
project
,
sha
,
branch
)
ci_commit
=
create
(
:ci_commit
,
project:
project
,
sha:
sha
,
ref:
branch
)
create
(
:ci_build
,
commit:
ci_commit
)
end
def
status_node
(
data
,
status
)
def
status_node
(
data
,
status
)
xml
=
Nokogiri
::
XML
.
parse
(
data
)
xml
=
Nokogiri
::
XML
.
parse
(
data
)
xml
.
at
(
%Q{text:contains("
#{
status
}
")}
)
xml
.
at
(
%Q{text:contains("
#{
status
}
")}
)
...
...
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