Sha256: bf0039288b977ad95bc1ac73bcc26ee85c374bcd6422dae7be1354ff6065cb46

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

require 'test_helper'

module Vedeu

  module Templating

    describe Template do

      let(:described) { Vedeu::Templating::Template }
      let(:instance)  { described.new(object, path) }
      let(:object)    {}
      let(:path)      {}

      describe '#initialize' do
        it { instance.must_be_instance_of(described) }
        it { instance.instance_variable_get('@object').must_equal(object) }
        it { instance.instance_variable_get('@path').must_equal('') }
      end

      describe '.parse' do
        subject { described.parse(object, path) }

        context 'when the path is empty' do
          let(:path) { '' }

          it { proc { subject }.must_raise(MissingRequired) }
        end

        context 'when the path is does not exist' do
          let(:path) { '/tmp/vedeu_does_not_exist' }

          it { proc { subject }.must_raise(MissingRequired) }
        end

        context 'when the path exists' do
          let(:path) { 'test/support/templates/inline.erb' }

          it { subject.must_equal("This is a test.\n") }
        end
      end

    end # Templating

  end # Template

end # Vedeu

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.4.60 test/lib/vedeu/templating/template_test.rb
vedeu-0.4.59 test/lib/vedeu/templating/template_test.rb
vedeu-0.4.58 test/lib/vedeu/templating/template_test.rb
vedeu-0.4.57 test/lib/vedeu/templating/template_test.rb
vedeu-0.4.56 test/lib/vedeu/templating/template_test.rb
vedeu-0.4.55 test/lib/vedeu/templating/template_test.rb