BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
82bc6c62
Commit
82bc6c62
authored
Mar 01, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a spec for WikiPipeline
Removes the specs from GollumTagsFilter that were more like integration tests for the pipeline than unit tests of the filter.
parent
6aa50165
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
44 deletions
+60
-44
gollum_tags_filter_spec.rb
spec/lib/banzai/filter/gollum_tags_filter_spec.rb
+7
-44
wiki_pipeline_spec.rb
spec/lib/banzai/pipeline/wiki_pipeline_spec.rb
+53
-0
No files found.
spec/lib/banzai/filter/gollum_tags_filter_spec.rb
View file @
82bc6c62
...
...
@@ -88,54 +88,17 @@ describe Banzai::Filter::GollumTagsFilter, lib: true do
end
context
'table of contents'
do
let
(
:pipeline
)
{
Banzai
::
Pipeline
[
:wiki
]
}
it
'replaces [[<em>TOC</em>]] with ToC result'
do
doc
=
described_class
.
call
(
"<p>[[<em>TOC</em>]]</p>"
,
{
project_wiki:
project_wiki
},
{
toc:
"FOO"
})
it
'replaces the tag with the TableOfContentsFilter result'
do
markdown
=
<<-
MD
.
strip_heredoc
[[_TOC_]]
## Header
Foo
MD
result
=
pipeline
.
call
(
markdown
,
project_wiki:
project_wiki
,
project:
project
)
aggregate_failures
do
expect
(
result
[
:output
].
text
).
not_to
include
'[[_TOC_]]'
expect
(
result
[
:output
].
text
).
not_to
include
'[['
expect
(
result
[
:output
].
to_html
).
to
include
(
result
[
:toc
])
end
end
it
'is case-sensitive'
do
markdown
=
<<-
MD
.
strip_heredoc
[[_toc_]]
# Header 1
Foo
MD
output
=
pipeline
.
to_html
(
markdown
,
project_wiki:
project_wiki
,
project:
project
)
expect
(
output
).
to
include
(
'[[<em>toc</em>]]'
)
expect
(
doc
.
to_html
).
to
eq
(
"FOO"
)
end
it
'handles an empty pipeline result'
do
# No Markdown headers in this doc, so `result[:toc]` will be empty
markdown
=
<<-
MD
.
strip_heredoc
[[_TOC_]]
Foo
MD
output
=
pipeline
.
to_html
(
markdown
,
project_wiki:
project_wiki
,
project:
project
)
it
'handles an empty ToC result'
do
input
=
output
=
"<p>[[<em>TOC</em>]]</p>"
doc
=
described_class
.
call
(
input
,
project_wiki:
project_wiki
)
aggregate_failures
do
expect
(
output
).
not_to
include
(
'<ul>'
)
expect
(
output
).
to
include
(
'[[<em>TOC</em>]]'
)
end
expect
(
doc
.
to_html
).
to
eq
output
end
end
end
spec/lib/banzai/pipeline/wiki_pipeline_spec.rb
0 → 100644
View file @
82bc6c62
require
'rails_helper'
describe
Banzai
::
Pipeline
::
WikiPipeline
do
describe
'TableOfContents'
do
it
'replaces the tag with the TableOfContentsFilter result'
do
markdown
=
<<-
MD
.
strip_heredoc
[[_TOC_]]
## Header
Foo
MD
result
=
described_class
.
call
(
markdown
,
project:
spy
,
project_wiki:
double
)
aggregate_failures
do
expect
(
result
[
:output
].
text
).
not_to
include
'[['
expect
(
result
[
:output
].
text
).
not_to
include
'TOC'
expect
(
result
[
:output
].
to_html
).
to
include
(
result
[
:toc
])
end
end
it
'is case-sensitive'
do
markdown
=
<<-
MD
.
strip_heredoc
[[_toc_]]
# Header 1
Foo
MD
output
=
described_class
.
to_html
(
markdown
,
project:
spy
,
project_wiki:
double
)
expect
(
output
).
to
include
(
'[[<em>toc</em>]]'
)
end
it
'handles an empty pipeline result'
do
# No Markdown headers in this doc, so `result[:toc]` will be empty
markdown
=
<<-
MD
.
strip_heredoc
[[_TOC_]]
Foo
MD
output
=
described_class
.
to_html
(
markdown
,
project:
spy
,
project_wiki:
double
)
aggregate_failures
do
expect
(
output
).
not_to
include
(
'<ul>'
)
expect
(
output
).
to
include
(
'[[<em>TOC</em>]]'
)
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