Sha256: 29739bbb29d23e3895c3a467dde3a06348306ca001973d4dcb78ed1fc7c377da

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 Bytes

Contents

require_relative '../../../test_helper'

module Troo
  describe Template do
    let(:described_class) { Template }
    let(:object) { stub(value: 'Hello from variable!') }
    let(:template_path) { '/../../../test/support/template.erb' }

    describe '#parse' do
      subject { described_class.new(object, template_path).parse }

      context 'when the template file can be found' do
        it 'parses the template' do
          subject.must_match(/This is the test template/)
          subject.must_match(/Hello from variable!/)
        end
      end

      context 'when the template file cannot be found' do
        let(:template_path) { '/some/wrong/path/template.erb' }

        it 'raises an exception' do
          proc { subject }.must_raise(Errno::ENOENT)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
troo-0.0.9 test/lib/troo/presentation/template_test.rb