_explication: display champ.description instead of champ.value
This commit is contained in:
parent
902cd1b4d9
commit
28c4dde96d
4 changed files with 39 additions and 4 deletions
29
spec/helpers/champ_helper_spec.rb
Normal file
29
spec/helpers/champ_helper_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
RSpec.describe ChampHelper, type: :helper do
|
||||
describe "#html_formatted_description" do
|
||||
subject { html_formatted_description(description) }
|
||||
|
||||
context "with some simple texte" do
|
||||
let(:description) { "1er ligne \n 2ieme ligne" }
|
||||
|
||||
it { is_expected.to eq("<p>1er ligne \n<br> 2ieme ligne</p>") }
|
||||
end
|
||||
|
||||
context "with a link" do
|
||||
let(:description) { "https://d-s.fr" }
|
||||
|
||||
it { is_expected.to eq("<p><a target=\"_blank\" href=\"https://d-s.fr\">https://d-s.fr</a></p>") }
|
||||
end
|
||||
|
||||
context "with empty decription" do
|
||||
let(:description) { nil }
|
||||
|
||||
it { is_expected.to eq('<p></p>') }
|
||||
end
|
||||
|
||||
context "with a bad script" do
|
||||
let(:description) { '<script>bad</script>' }
|
||||
|
||||
it { is_expected.to eq('<p>bad</p>') }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue