require "rails_helper"
describe AdminLegislationSanitizer do
let(:sanitizer) { AdminLegislationSanitizer.new }
describe "#sanitize" do
it "allows images" do
html = 'Dangerous
image'
expect(sanitizer.sanitize(html)).to eq(html)
end
it "allows h1 to h6" do
html = '
| id | name | age | gender |
|---|---|---|---|
| 1 | Roberta | 39 | M |
| 2 | Oliver | 25 | F |
image'
expect(sanitizer.sanitize(html)).to eq(html)
end
it "doesn't allow style" do
html = 'Dangerous
image'
expect(sanitizer.sanitize(html)).not_to eq(html)
end
it "doesn't allow class" do
html = 'Dangerous
image'
expect(sanitizer.sanitize(html)).not_to eq(html)
end
end
end