Sha256: 61bcaa7edad7495bb7c3a437855963625fefa28d5e7f54e21ef64fc6440853e1

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

require 'spec_helper'
require 'tmpdir'
require 'rake'

module RevealCK
  module Builders
    describe CreateIndexHtml do
      it 'creates a reveal.js index.html' do
        Dir.mktmpdir do |dir|
          Dir.chdir(dir) do

            slides_html = 'slides.html'
            File.open(slides_html, 'w') do |file|
              file.puts('<section>')
              file.puts('<h1>Slides</h1>')
              file.puts('</section>')
            end

            index_html_erb =
              RevealCK.template_path('index.html',
                                     'index.html.erb')

            application = Rake::Application.new
            create_index_html =
              CreateIndexHtml.new(slides_html: slides_html,
                                  template: index_html_erb,
                                  output_dir: dir,
                                  config: Config.new,
                                  application: application)

            create_index_html.prepare
            application['create_index_html'].invoke

            expect(File.exist?('index.html')).to be true
            content = File.open('index.html', 'r').read
            expect(content).to include '<h1>Slides</h1>'
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
reveal-ck-0.6.0 spec/lib/reveal-ck/builders/create_index_html_spec.rb
reveal-ck-0.5.1 spec/lib/reveal-ck/builders/create_index_html_spec.rb
reveal-ck-0.5.0 spec/lib/reveal-ck/builders/create_index_html_spec.rb
reveal-ck-0.4.2 spec/lib/reveal-ck/builders/create_index_html_spec.rb
reveal-ck-0.4.1 spec/lib/reveal-ck/builders/create_index_html_spec.rb
reveal-ck-0.4.0 spec/lib/reveal-ck/builders/create_index_html_spec.rb