Sha256: 1b8c5bcd28e515b2ba8ac2b7c81a3c90faa7caa9ea0e48ec85ef2f5d0bb64340

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'
module Noe
  describe "Config#templates_dir" do
    
    subject{ config.templates_dir }
    
    context 'on default config' do
      let(:config){ Config.new }
      
      it "should be Noe's template dir" do
        subject.should == $noe_root/"templates"
      end
      
    end # on default config
    
    context 'when a relative path is used' do
      let(:file)  { Path.relative("config1.yaml") }
      let(:config){ Config.new(file)                              }
      
      it "should be an absolute path" do
        subject.should == Path.relative("templates")
      end
      
    end # relative path
    
    context 'when an absolute path is used' do
      let(:file) { Path.relative("config1.yaml") }
      let(:tdir) { Path.relative("templates")    }
      let(:hash) { { "config_file" => file, "templates-dir" => tdir } }
      let(:config){ Config.new(hash) }
      
      it "should stay an absolute path" do
        subject.should == tdir
      end
      
    end
    
  end # Config#templates_dir
end # module Noe

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
noe-1.7.6 spec/unit/config/templates_dir_spec.rb
noe-1.7.5 spec/unit/config/templates_dir_spec.rb
noe-1.7.4 spec/unit/config/templates_dir_spec.rb