require 'rails_helper' require 'html_normalize' describe PrettyText do def n(html) HtmlNormalize.normalize(html) 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('class="poll"') expect(cooked).to include('data-poll-status="open"') expect(cooked).to include('data-poll-name="poll"') expect(cooked).to include('data-poll-type="multiple"') expect(cooked).to include('data-poll-min="1"') expect(cooked).to include('data-poll-max="3"') expect(cooked).to include('data-poll-public="true"') end it 'can dynamically generate a poll' do cooked = PrettyText.cook <<~MD [poll type=number min=1 max=20 step=1] [/poll] MD expect(cooked.scan('
0 voters
Choose up to 2 options