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
cdb0caaf
Commit
cdb0caaf
authored
Aug 11, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract common badge metadata test examples
parent
f0ff1bfd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
19 deletions
+23
-19
spec/lib/gitlab/badge/build/metadata_spec.rb
spec/lib/gitlab/badge/build/metadata_spec.rb
+2
-19
spec/lib/gitlab/badge/shared/metadata.rb
spec/lib/gitlab/badge/shared/metadata.rb
+21
-0
No files found.
spec/lib/gitlab/badge/build/metadata_spec.rb
View file @
cdb0caaf
require
'spec_helper'
require
'lib/gitlab/badge/shared/metadata'
describe
Gitlab
::
Badge
::
Build
::
Metadata
do
let
(
:badge
)
{
double
(
project:
create
(
:project
),
ref:
'feature'
)
}
let
(
:metadata
)
{
described_class
.
new
(
badge
)
}
describe
'#to_html'
do
let
(
:html
)
{
Nokogiri
::
HTML
.
parse
(
metadata
.
to_html
)
}
let
(
:a_href
)
{
html
.
at
(
'a'
)
}
it
'points to link'
do
expect
(
a_href
[
:href
]).
to
eq
metadata
.
link_url
end
it
'contains clickable image'
do
expect
(
a_href
.
children
.
first
.
name
).
to
eq
'img'
end
end
describe
'#to_markdown'
do
subject
{
metadata
.
to_markdown
}
it
{
is_expected
.
to
include
metadata
.
image_url
}
it
{
is_expected
.
to
include
metadata
.
link_url
}
end
it_behaves_like
'badge metadata'
describe
'#image_url'
do
it
'returns valid url'
do
...
...
spec/lib/gitlab/badge/shared/metadata.rb
0 → 100644
View file @
cdb0caaf
shared_examples
'badge metadata'
do
describe
'#to_html'
do
let
(
:html
)
{
Nokogiri
::
HTML
.
parse
(
metadata
.
to_html
)
}
let
(
:a_href
)
{
html
.
at
(
'a'
)
}
it
'points to link'
do
expect
(
a_href
[
:href
]).
to
eq
metadata
.
link_url
end
it
'contains clickable image'
do
expect
(
a_href
.
children
.
first
.
name
).
to
eq
'img'
end
end
describe
'#to_markdown'
do
subject
{
metadata
.
to_markdown
}
it
{
is_expected
.
to
include
metadata
.
image_url
}
it
{
is_expected
.
to
include
metadata
.
link_url
}
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