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
b07ecbb5
Commit
b07ecbb5
authored
Jul 19, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify AutolinkFilter specs
parent
f8bfd065
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
16 deletions
+12
-16
spec/features/markdown_spec.rb
spec/features/markdown_spec.rb
+12
-16
No files found.
spec/features/markdown_spec.rb
View file @
b07ecbb5
...
@@ -195,45 +195,41 @@ describe 'GitLab Markdown', feature: true do
...
@@ -195,45 +195,41 @@ describe 'GitLab Markdown', feature: true do
end
end
describe
'AutolinkFilter'
do
describe
'AutolinkFilter'
do
let
(
:list
)
{
get_section
(
'autolinkfilter'
).
next_element
}
def
body
get_section
(
'autolinkfilter'
).
next_element
end
def
item
(
index
)
# Override Capybara's `have_link` matcher to simplify our use case
list
.
at_css
(
"li:nth-child(
#{
index
}
)"
)
def
have_link
(
link
)
super
(
link
,
href:
link
)
end
end
it
'autolinks http://'
do
it
'autolinks http://'
do
expect
(
item
(
1
).
children
.
first
.
name
).
to
eq
'a'
expect
(
body
).
to
have_link
(
'http://about.gitlab.com/'
)
expect
(
item
(
1
).
children
.
first
[
'href'
]).
to
eq
'http://about.gitlab.com/'
end
end
it
'autolinks https://'
do
it
'autolinks https://'
do
expect
(
item
(
2
).
children
.
first
.
name
).
to
eq
'a'
expect
(
body
).
to
have_link
(
'https://google.com/'
)
expect
(
item
(
2
).
children
.
first
[
'href'
]).
to
eq
'https://google.com/'
end
end
it
'autolinks ftp://'
do
it
'autolinks ftp://'
do
expect
(
item
(
3
).
children
.
first
.
name
).
to
eq
'a'
expect
(
body
).
to
have_link
(
'ftp://ftp.us.debian.org/debian/'
)
expect
(
item
(
3
).
children
.
first
[
'href'
]).
to
eq
'ftp://ftp.us.debian.org/debian/'
end
end
it
'autolinks smb://'
do
it
'autolinks smb://'
do
expect
(
item
(
4
).
children
.
first
.
name
).
to
eq
'a'
expect
(
body
).
to
have_link
(
'smb://foo/bar/baz'
)
expect
(
item
(
4
).
children
.
first
[
'href'
]).
to
eq
'smb://foo/bar/baz'
end
end
it
'autolinks irc://'
do
it
'autolinks irc://'
do
expect
(
item
(
5
).
children
.
first
.
name
).
to
eq
'a'
expect
(
body
).
to
have_link
(
'irc://irc.freenode.net/git'
)
expect
(
item
(
5
).
children
.
first
[
'href'
]).
to
eq
'irc://irc.freenode.net/git'
end
end
it
'autolinks short, invalid URLs'
do
it
'autolinks short, invalid URLs'
do
expect
(
item
(
6
).
children
.
first
.
name
).
to
eq
'a'
expect
(
body
).
to
have_link
(
'http://localhost:3000'
)
expect
(
item
(
6
).
children
.
first
[
'href'
]).
to
eq
'http://localhost:3000'
end
end
%w(code a kbd)
.
each
do
|
elem
|
%w(code a kbd)
.
each
do
|
elem
|
it
"ignores links inside '
#{
elem
}
' element"
do
it
"ignores links inside '
#{
elem
}
' element"
do
body
=
get_section
(
'autolinkfilter'
)
expect
(
body
).
not_to
have_selector
(
"
#{
elem
}
a"
)
expect
(
body
).
not_to
have_selector
(
"
#{
elem
}
a"
)
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