# frozen_string_literal: true RSpec.describe PrettyText do def n(html) html.strip end it "supports multi choice polls" do cooked = PrettyText.cook <<~MD [poll type=multiple min=1 max=3 public=true] * option 1 * option 2 * option 3 [/poll] MD expect(cooked).to include( '
" expect(cooked).to include '' end it "supports polls in quotes" do cooked = PrettyText.cook <<~MD > [poll] > * Strawberry > * Raspberry > * Blueberry > [/poll] MD expect(cooked).to include "" expect(cooked).to include '' end it "supports polls in details" do cooked = PrettyText.cook <<~MD [details=please vote] [poll] * Strawberry * Raspberry * Blueberry [/poll] [/details] MD expect(cooked).to include "" expect(cooked).to include '' end it "does not break when there are headings before/after a poll with a title" do cooked = PrettyText.cook <<~MD # Pre-heading [poll] # What's your favorite *berry*? :wink: https://google.com/ * Strawberry * Raspberry * Blueberry [/poll] # Post-heading MD expect(cooked).to include <<~HTMLWhat’s your favorite berry? https://google.com/HTML expect(cooked).to include( 'Pre-heading
', ) expect(cooked).to include( 'Post-heading
', ) end it "does not break when there are headings before/after a poll without a title" do cooked = PrettyText.cook <<~MD # Pre-heading [poll] * Strawberry * Raspberry * Blueberry [/poll] # Post-heading MD expect(cooked).to_not include('