require "rails_helper" describe AdminLegislationSanitizer do let(:sanitizer) { AdminLegislationSanitizer.new } describe "#sanitize" do it "allows images" do html = 'DangerousSmile image' expect(sanitizer.sanitize(html)).to eq(html) end it "allows h1 to h6" do html = '

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6
' expect(sanitizer.sanitize(html)).to eq(html) end it "allows tables" do html = '
id name age gender
1 Roberta 39 M
2 Oliver 25 F
' expect(sanitizer.sanitize(html)).to eq(html) end it "allows alt src and id" do html = 'DangerousSmile image' expect(sanitizer.sanitize(html)).to eq(html) end it "doesn't allow style" do html = 'DangerousSmile image' expect(sanitizer.sanitize(html)).not_to eq(html) end it "doesn't allow class" do html = 'DangerousSmile image' expect(sanitizer.sanitize(html)).not_to eq(html) end end end