Sha256: a8706a8fa8441887993753efcf3eef180e24f1017d65c5a2e548b04ea473de09

Contents?: true

Size: 1.76 KB

Versions: 2

Compression:

Stored size: 1.76 KB

Contents

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 'uses "---" to create "<section>"s' do
        output = render_markdown <<-eos
# h1 Slide
---
## h2 Slide
eos
        expect(output).to include '<h1>h1 Slide</h1>'
        expect(output).to include "</section>\n<section>"
        expect(output).to include '<h2>h2 Slide</h2>'
      end

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

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

      it 'creates an <aside class="notes"> when it sees a ```notes' do
        output = render_markdown <<-eos
```notes
This is a note
```
eos
        expect(output).to include "<aside class='notes'"
        expect(output).to include 'This is a note'
      end

      it 'creates an <aside class="notes"> when it sees a ```note' do
        output = render_markdown <<-eos
```note
This is a note
```
eos
        expect(output).to include "<aside class='notes'"
        expect(output).to include 'This is a note'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reveal-ck-0.4.1 spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb
reveal-ck-0.4.0 spec/lib/reveal-ck/markdown/slide_markdown_template_spec.rb