Sha256: eff41fd3321c9b48602a46f4aaad4d970118a813bc2612f523847f5376297a1b

Contents?: true

Size: 1.05 KB

Versions: 12

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'

module Vedeu

  describe Template do

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

    describe '#initialize' do
      it { instance.must_be_instance_of(Vedeu::Template) }
      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) }

      before { File.stubs(:read).returns('') }

      context 'when the path is empty' do
        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) { '/tmp/vedeu_does_exist' }

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

        it { subject.must_equal('') }
      end
    end

  end # Template

end # Vedeu

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vedeu-0.4.17 test/lib/vedeu/support/template_test.rb
vedeu-0.4.16 test/lib/vedeu/support/template_test.rb
vedeu-0.4.15 test/lib/vedeu/support/template_test.rb
vedeu-0.4.14 test/lib/vedeu/support/template_test.rb
vedeu-0.4.13 test/lib/vedeu/support/template_test.rb
vedeu-0.4.12 test/lib/vedeu/support/template_test.rb
vedeu-0.4.11 test/lib/vedeu/support/template_test.rb
vedeu-0.4.10 test/lib/vedeu/support/template_test.rb
vedeu-0.4.9 test/lib/vedeu/support/template_test.rb
vedeu-0.4.8 test/lib/vedeu/support/template_test.rb
vedeu-0.4.7 test/lib/vedeu/support/template_test.rb
vedeu-0.4.6 test/lib/vedeu/support/template_test.rb