spec/slide_spec.rb in deckrb-0.5.0 vs spec/slide_spec.rb in deckrb-0.5.1
- old
+ new
@@ -4,10 +4,17 @@
require "deck/slide"
module Deck
describe Slide do
+ def assert_html_like actual, expected
+ actual = actual.strip.gsub("\n\n", "\n")
+ expected = expected.strip.gsub("\n\n", "\n")
+ assert { actual == expected }
+ end
+
+
describe "classes" do
it "by default" do
assert {Slide.new.classes == ["slide"]}
end
@@ -244,11 +251,11 @@
<li>bar</li>
<li>baz</li>
</ul>
</section>
HTML
- assert { html == expected_html }
+ assert_html_like html, expected_html
end
it "with only a underline-style header, leaving a solo H1 as an H1" do
html = slide_from(<<-MARKDOWN).to_pretty
foo
@@ -257,11 +264,11 @@
expected_html = <<-HTML
<section class="slide" id="foo">
<h1>foo</h1>
</section>
HTML
- assert { html == expected_html }
+ assert_html_like html, expected_html
end
it "converts a non-solo underline-style H1 into an H2 for deck.js style compatibility)" do
html = slide_from(<<-MARKDOWN).to_pretty
foo
@@ -277,11 +284,11 @@
<li>bar</li>
<li>baz</li>
</ul>
</section>
HTML
- assert { html == expected_html }
+ assert_html_like html, expected_html
end
it "skips notes" do
source = "foo\n.notes bar\nbaz"
expected = <<-HTML
@@ -289,11 +296,11 @@
<p>foo
baz</p>
</section>
HTML
- assert { slide_from(source).to_pretty == expected }
+ assert_html_like slide_from(source).to_pretty, expected
end
end
describe "slide classes" do
@@ -312,11 +319,11 @@
<li>bar</li>
<li>baz</li>
</ul>
</section>
HTML
- assert { html == expected_html }
+ assert_html_like html, expected_html
end
end
describe "!VIDEO" do
it "embeds a YouTube video" do
@@ -334,10 +341,10 @@
<ul>
<li>bar</li>
</ul>
</section>
HTML
- assert { html == expected_html }
+ assert_html_like html, expected_html
end
end
describe "==" do
it "a slide is equal to itself" do