require 'spec_helper' require 'tmpdir' module RevealCK module Builders describe SlidesBuilder do it 'creates a reveal.js presentation' do Dir.mktmpdir do |dir| Dir.chdir(dir) do slides_file = 'slides.md' File.open(slides_file, 'w') do |file| file.puts('# Slides') end File.open('config.yml', 'w') do |file| file.puts('author: Configured Author') end FileUtils.mkdir('css') custom_css = File.join('css', 'custom.css') File.open(custom_css, 'w') do |file| file.puts('body { background: "red" }') end args = { user_dir: dir, gem_dir: RevealCK.path, output_dir: 'presentation', slides_file: slides_file } slides_builder = RevealCK::Builders::SlidesBuilder.new(args) slides_builder.prepare slides_builder.build # The output directory was created expect(File.directory?('presentation')).to be true # The slides_file was transformed into HTML, and copied # into the output directory at slides.html slides_html = File.join('presentation', 'slides.html') slides_html_content = File.open(slides_html, 'r').read expect(slides_html_content).to include '