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
7c87dac5
Commit
7c87dac5
authored
Jun 09, 2016
by
Gabriel Mazetto
Committed by
Robert Speicher
Jun 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved SVG sanitizer specs to include smoke tests for clean.
parent
a9eaa20d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
svg_spec.rb
spec/lib/gitlab/sanitizers/svg_spec.rb
+16
-0
No files found.
spec/lib/gitlab/sanitizers/svg_spec.rb
View file @
7c87dac5
...
@@ -5,6 +5,22 @@ describe Gitlab::Sanitizers::SVG do
...
@@ -5,6 +5,22 @@ describe Gitlab::Sanitizers::SVG do
let
(
:namespace
)
{
double
(
Nokogiri
::
XML
::
Namespace
,
prefix:
'xlink'
,
href:
'http://www.w3.org/1999/xlink'
)
}
let
(
:namespace
)
{
double
(
Nokogiri
::
XML
::
Namespace
,
prefix:
'xlink'
,
href:
'http://www.w3.org/1999/xlink'
)
}
let
(
:namespaced_attr
)
{
double
(
Nokogiri
::
XML
::
Attr
,
name:
'href'
,
namespace:
namespace
,
value:
'#awesome_id'
)
}
let
(
:namespaced_attr
)
{
double
(
Nokogiri
::
XML
::
Attr
,
name:
'href'
,
namespace:
namespace
,
value:
'#awesome_id'
)
}
describe
'.clean'
do
let
(
:input_svg_path
)
{
File
.
join
(
Rails
.
root
,
'spec'
,
'fixtures'
,
'unsanitized.svg'
)
}
let
(
:data
)
{
open
(
input_svg_path
).
read
}
let
(
:sanitized_svg_path
)
{
File
.
join
(
Rails
.
root
,
'spec'
,
'fixtures'
,
'sanitized.svg'
)
}
let
(
:sanitized
)
{
open
(
sanitized_svg_path
).
read
}
it
'delegates sanitization to scrubber'
do
expect_any_instance_of
(
Gitlab
::
Sanitizers
::
SVG
::
Scrubber
).
to
receive
(
:scrub
).
at_least
(
:once
)
described_class
.
clean
(
data
)
end
it
'returns sanitized data'
do
expect
(
described_class
.
clean
(
data
)).
to
eq
(
sanitized
)
end
end
context
'scrubber'
do
context
'scrubber'
do
describe
'#scrub'
do
describe
'#scrub'
do
let
(
:invalid_element
)
{
double
(
Nokogiri
::
XML
::
Node
,
name:
'invalid'
,
value:
'invalid'
)
}
let
(
:invalid_element
)
{
double
(
Nokogiri
::
XML
::
Node
,
name:
'invalid'
,
value:
'invalid'
)
}
...
...
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