require 'spec_helper' module RevealCK describe Presentation do let :presentation do presentation = Presentation.new presentation.add double('content', html: 'first') presentation.add double('content', html: 'second') presentation end let :html do presentation.html end describe '#add' do it 'adds to a growing list of html' do expect(html).to include 'first' expect(html).to include 'second' expect(html.strip).to start_with 'first' expect(html.strip).to end_with 'second' end end describe '#html' do it 'returns the html, in order, added so far' do expect(html).to start_with 'first' expect(html).to end_with 'second' end end let :slides_haml do spec_data 'presentation', 'slides.haml' end describe '.from_template' do it 'loads presentation html from a template' do presentation = Presentation.from_template slides_haml html = presentation.html expect(html).to start_with '
' expect(html).to include 'slides.haml' expect(html).to include '
' end end let :slides_rb do spec_data 'presentation', 'slides.rb' end describe '.from_dsl' do it 'loads presentation html and metadata from a dsl' do presentation = Presentation.from_dsl slides_rb html = presentation.html expect(html).to start_with '
' expect(html).to include 'slides.rb' expect(html).to include '
' expect(presentation.theme).to eq 'night' end end describe '.load' do it 'can work with a .rb file' do presentation = Presentation.load slides_rb html = presentation.html expect(html).to start_with '
' end end describe '.load' do it 'can work with a template file' do presentation = Presentation.load slides_haml html = presentation.html expect(html).to start_with '
' end end end end