require 'rails_helper' describe WYSIWYGSanitizer do subject { described_class.new } describe '#sanitize' do it 'returns an html_safe string' do expect(subject.sanitize('hello')).to be_html_safe end it 'allows basic html formatting' do html = '

This is a paragraph

' expect(subject.sanitize(html)).to eq(html) end it 'filters out dangerous tags' do html = '

This is

' expect(subject.sanitize(html)).to eq('

This is alert("dangerous");

') end end end