Files
openfoodnetwork/spec/models/custom_tab_spec.rb
Maikel Linke d2e5087668 Remove redundant HTML sanitisation
We don't need to run the sanitiser each time we read an attribute. It's
a waste of time.
2024-10-24 08:47:11 +11:00

23 lines
574 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe CustomTab do
describe 'associations' do
it { is_expected.to belong_to(:enterprise).required }
end
describe 'validations' do
it { is_expected.to validate_presence_of(:title) }
it { is_expected.to validate_length_of(:title).is_at_most(20) }
end
describe "serialisation" do
it "sanitises HTML in content" do
subject.content = "Hello <script>alert</script> dearest <b>monster</b>."
expect(subject.content).to eq "Hello alert dearest <b>monster</b>."
end
end
end