# frozen_string_literal: true describe PrettyText do let(:post) { Fabricate(:post) } def n(html) html.strip end it "can spoil blocks" do md = PrettyText.cook("[spoiler]\nmy tests fail\n[/spoiler]") html = "
\n

my tests fail

\n
" expect(md).to eq(html) end it "can spoil inline" do md = PrettyText.cook("I like watching [spoiler]my tests fail[/spoiler]") html = '

I like watching my tests fail

' expect(md).to eq(html) end it "can replace spoilers in emails" do md = PrettyText.cook("I like watching [spoiler]my tests fail[/spoiler]") md = PrettyText.format_for_email(md, post) html = "

I like watching spoiler

" expect(md).to eq(html) end end