diff --git a/plugins/poll/spec/lib/pretty_text_spec.rb b/plugins/poll/spec/lib/pretty_text_spec.rb index a1b834ac7c..7dbcd2e230 100644 --- a/plugins/poll/spec/lib/pretty_text_spec.rb +++ b/plugins/poll/spec/lib/pretty_text_spec.rb @@ -136,4 +136,21 @@ describe PrettyText do expect(onebox[:preview]).to include("A post with a poll") expect(onebox[:preview]).to include("poll") end + + it 'can reduce excerpts' do + post = Fabricate(:post, raw: <<~EOF) + A post with a poll + + [poll type=regular] + * Hello + * World + [/poll] + EOF + + excerpt = PrettyText.excerpt(post.cooked, SiteSetting.post_onebox_maxlength, post: post) + expect(excerpt).to eq("A post with a poll \npoll") + + excerpt = PrettyText.excerpt(post.cooked, SiteSetting.post_onebox_maxlength) + expect(excerpt).to eq("A post with a poll \npoll") + end end