require 'spec_helper' require 'tempfile' module RevealCK module Markdown describe SlideMarkdownTemplate do def render_markdown(markdown) tmp_file = Tempfile.new(['test', '.md']) File.open(tmp_file, 'w') do |test_md| test_md.puts(markdown) end template = Tilt.new(tmp_file.path) template.render end it 'does not turn _s within a single emoji into s' do output = render_markdown <<-eos :money_with_wings: eos expect(output).to include ':money_with_wings:' end it 'does not turn _s between two emojis into s' do output = render_markdown <<-eos :blue_heart: :blue_heart: eos expect(output).to include ':blue_heart: :blue_heart:' end it 'uses "---" to create "
"s' do output = render_markdown <<-eos # h1 Slide --- ## h2 Slide eos expect(output).to include '

h1 Slide

' expect(output).to include "
\n
" expect(output).to include '

h2 Slide

' end it 'wraps ``` code in a
 and ' do
        output = render_markdown <<-eos
```
def adder(a, b); a + b; end
```
eos
        expect(output).to include '
'
        expect(output).to include '
' expect(output).to include 'a + b' end it 'converts special characters in ``` block to entity references' do output = render_markdown <<-eos ```

"&"

``` eos expect(output).to include '
'
        expect(output).to include '
' expect(output).to include '<p>"&"</p>' end it 'wraps ```ruby code in a
 and ' do
        output = render_markdown <<-eos
```ruby
def adder(a, b); a + b; end
```
eos
        expect(output).to include '
'
        expect(output).to include '
' expect(output).to include 'a + b' end it 'creates an