RSpec.describe StringToHtmlHelper, type: :helper do
describe "#string_to_html" do
subject { string_to_html(description) }
context "with some simple texte" do
let(:description) { "1er ligne \n 2ieme ligne" }
it { is_expected.to eq("
1er ligne \n
2ieme ligne
") }
end
context "with a link" do
let(:description) { "https://d-s.fr" }
it { is_expected.to eq("https://d-s.fr
") }
end
context "with empty decription" do
let(:description) { nil }
it { is_expected.to eq('') }
end
context "with a bad script" do
let(:description) { '' }
it { is_expected.to eq('bad
') }
end
end
end