require "rails_helper" describe Legislation::DraftVersion do let(:legislation_draft_version) { build(:legislation_draft_version) } it_behaves_like "acts as paranoid", :legislation_draft_version it_behaves_like "globalizable", :legislation_draft_version it "is valid" do expect(legislation_draft_version).to be_valid end it "renders and saves the html from the markdown body field" do legislation_draft_version.body = body_markdown legislation_draft_version.save! expect(legislation_draft_version.body_html).to eq(body_html) expect(legislation_draft_version.toc_html).to eq(toc_html) end it "renders and saves the html from the markdown body field with alternative translation" do legislation_draft_version.title_fr = "Français" legislation_draft_version.body_fr = body_markdown legislation_draft_version.save! expect(legislation_draft_version.body_html_fr).to eq(body_html) expect(legislation_draft_version.toc_html_fr).to eq(toc_html) end def body_markdown <<-BODY_MARKDOWN # Title 1 Some paragraph. A list: - item 1 - item 2 ## Subtitle Another paragraph. # Title 2 Something about this. BODY_MARKDOWN end def body_html <<-BODY_HTML
Some paragraph.
A list:
Another paragraph.
Something about this.
BODY_HTML end def toc_html <<-TOC_HTML TOC_HTML end end