Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Mazetto <gabriel@gitlab.com>2016-06-03 22:08:43 +0300
committerRobert Speicher <rspeicher@gmail.com>2016-06-13 04:05:58 +0300
commita9eaa20dcb3da119a2d5f2efca615f2273533015 (patch)
treee1f4b822266aea84261f723999bd44fb4b501971 /spec/lib/gitlab/sanitizers
parent388f6eaaa6d97a09de6162c457042f491d42f96e (diff)
Refactored SVG sanitizer
Diffstat (limited to 'spec/lib/gitlab/sanitizers')
-rw-r--r--spec/lib/gitlab/sanitizers/svg_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/lib/gitlab/sanitizers/svg_spec.rb b/spec/lib/gitlab/sanitizers/svg_spec.rb
index 061b759bac0..e1b040d6c64 100644
--- a/spec/lib/gitlab/sanitizers/svg_spec.rb
+++ b/spec/lib/gitlab/sanitizers/svg_spec.rb
@@ -56,5 +56,23 @@ describe Gitlab::Sanitizers::SVG do
expect(scrubber.unsafe_href?(namespaced_attr)).to be_falsey
end
end
+
+ describe '#data_attribute?' do
+ let(:data_attr) { double(Nokogiri::XML::Attr, name: 'data-gitlab', namespace: nil, value: 'gitlab is awesome') }
+ let(:namespaced_attr) { double(Nokogiri::XML::Attr, name: 'data-gitlab', namespace: namespace, value: 'gitlab is awesome') }
+ let(:other_attr) { double(Nokogiri::XML::Attr, name: 'something', namespace: nil, value: 'content') }
+
+ it 'returns true if is a valid data attribute' do
+ expect(scrubber.data_attribute?(data_attr)).to be_truthy
+ end
+
+ it 'returns false if attribute is namespaced' do
+ expect(scrubber.data_attribute?(namespaced_attr)).to be_falsey
+ end
+
+ it 'returns false if not a data attribute' do
+ expect(scrubber.data_attribute?(other_attr)).to be_falsey
+ end
+ end
end
end