Sha256: b8332697ed158656a1c523fb77b5fb6d3500992b0c3e323b15c17958f3f0374f

Contents?: true

Size: 892 Bytes

Versions: 1

Compression:

Stored size: 892 Bytes

Contents

require 'test_helper'

describe Lotus::View do
  describe 'root' do
    before do
      Lotus::View.root = Pathname.new __dir__ + '/fixtures/templates'
    end

    it 'exposes the path where to lookup for templates' do
      expected = Pathname.new __dir__ + '/fixtures/templates'
      Lotus::View.root.must_equal expected
    end

    it 'is inherited' do
      HelloWorldView.root.must_equal Lotus::View.root
    end

    it 'can be customized for each view' do
      expected = Pathname.new __dir__ + '/fixtures/templates/app'
      AppView.root.must_equal expected
    end

    describe 'when not set' do
      before do
        @root = Lotus::View.root
        Lotus::View.root = nil
      end

      after do
        Lotus::View.root = @root
      end

      it 'sets the current directory as root' do
        Lotus::View.root.must_equal Pathname.new('.')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lotus-view-0.1.0 test/root_test.rb