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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
spec/lib/gitlab/sanitizers/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
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'
)
}
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
describe
'#scrub'
do
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