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
4dd1f955
Commit
4dd1f955
authored
Jul 24, 2016
by
winniehell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add failing test for #20026
parent
f4cb04da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
relative_link_filter_spec.rb
spec/lib/banzai/filter/relative_link_filter_spec.rb
+18
-2
No files found.
spec/lib/banzai/filter/relative_link_filter_spec.rb
View file @
4dd1f955
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Banzai
::
Filter
::
RelativeLinkFilter
,
lib:
true
do
describe
Banzai
::
Filter
::
RelativeLinkFilter
,
lib:
true
do
def
filter
(
doc
,
contexts
=
{})
def
filter
(
doc
,
contexts
=
{})
contexts
.
reverse_merge!
({
contexts
.
reverse_merge!
({
commit:
project
.
commit
,
commit:
commit
,
project:
project
,
project:
project
,
project_wiki:
project_wiki
,
project_wiki:
project_wiki
,
ref:
ref
,
ref:
ref
,
...
@@ -28,6 +28,7 @@ describe Banzai::Filter::RelativeLinkFilter, lib: true do
...
@@ -28,6 +28,7 @@ describe Banzai::Filter::RelativeLinkFilter, lib: true do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project_path
)
{
project
.
path_with_namespace
}
let
(
:project_path
)
{
project
.
path_with_namespace
}
let
(
:ref
)
{
'markdown'
}
let
(
:ref
)
{
'markdown'
}
let
(
:commit
)
{
project
.
commit
(
ref
)
}
let
(
:project_wiki
)
{
nil
}
let
(
:project_wiki
)
{
nil
}
let
(
:requested_path
)
{
'/'
}
let
(
:requested_path
)
{
'/'
}
...
@@ -77,7 +78,13 @@ describe Banzai::Filter::RelativeLinkFilter, lib: true do
...
@@ -77,7 +78,13 @@ describe Banzai::Filter::RelativeLinkFilter, lib: true do
expect
{
filter
(
act
)
}.
not_to
raise_error
expect
{
filter
(
act
)
}.
not_to
raise_error
end
end
context
'with a valid repository'
do
it
'ignores ref if commit is passed'
do
doc
=
filter
(
link
(
'non/existent.file'
),
commit:
project
.
commit
(
'empty-branch'
)
)
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
"/
#{
project_path
}
/
#{
ref
}
/non/existent.file"
# non-existent files have no leading blob/raw/tree
end
shared_examples
:valid_repository
do
it
'rebuilds absolute URL for a file in the repo'
do
it
'rebuilds absolute URL for a file in the repo'
do
doc
=
filter
(
link
(
'/doc/api/README.md'
))
doc
=
filter
(
link
(
'/doc/api/README.md'
))
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
...
@@ -184,4 +191,13 @@ describe Banzai::Filter::RelativeLinkFilter, lib: true do
...
@@ -184,4 +191,13 @@ describe Banzai::Filter::RelativeLinkFilter, lib: true do
include_examples
:relative_to_requested
include_examples
:relative_to_requested
end
end
end
end
context
'with a valid commit'
do
include_examples
:valid_repository
end
context
'with a valid ref'
do
let
(
:commit
)
{
nil
}
# force filter to use ref instead of commit
include_examples
:valid_repository
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