Sha256: efc8a10376506318167d205156f84fa43da37de153cd18369fb913aa6972fd6b

Contents?: true

Size: 1.42 KB

Versions: 75

Compression:

Stored size: 1.42 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(Vedeu::Error::MissingRequired) }
        end

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

          before { File.stubs(:exist?).returns(false) }

          it { proc { subject }.must_raise(Vedeu::Error::MissingRequired) }
        end

        context 'when the path exists' do
          let(:path) { '/tmp/vedeu_exists' }
          let(:expected) { "This is a test.\n" }

          before do
            File.stubs(:exist?).returns(true)
            File.stubs(:read).returns(expected)
          end

          it { subject.must_equal(expected) }
        end
      end

      describe '#parse' do
        it { instance.must_respond_to(:parse) }
      end

    end # Templating

  end # Template

end # Vedeu

Version data entries

75 entries across 75 versions & 1 rubygems

Version Path
vedeu-0.6.16 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.15 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.14 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.13 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.12 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.11 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.10 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.9 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.8 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.7 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.6 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.5 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.4 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.3 test/lib/vedeu/templating/template_test.rb
vedeu-0.6.2 test/lib/vedeu/templating/template_test.rb