Sha256: 10f45d23d5c58cd194f57b5b90a7777460263f376160961c6bf7aa7ac83288b5

Contents?: true

Size: 946 Bytes

Versions: 4

Compression:

Stored size: 946 Bytes

Contents

require "spec_helper"

describe Nachos::Config do

  describe "repo_root" do
    before { Nachos::Config.any_instance.stubs(:config_exists?).returns(false) }

    it "prefers configured path" do
      config = Nachos::Config.new
      config.config.repo_root = "/here/is/configured/path"
      config.repo_root.should == Pathname("/here/is/configured/path")
    end

    it "uses default path if not otherwise configured" do 
      config = Nachos::Config.new
      config.repo_root.should == Pathname(ENV["HOME"]).join("src")
    end
  end

  describe "config" do
    it "uses 'nil' config if no config found" do
      YAML.stubs(:load_config).returns(nil)
      Nachos::Config.new.config.anything.should == nil
    end
    
    it "wraps loaded yaml in a mashie thing" do
      YAML.stubs(:load_config).returns({:somethign => "foo"})
      config = Nachos::Config.new
      config.config.should be_instance_of(Hashie::Mash)
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nachos-0.0.5 spec/nachos/config_spec.rb
nachos-0.0.4 spec/nachos/config_spec.rb
nachos-0.0.3 spec/nachos/config_spec.rb
nachos-0.0.2 spec/nachos/config_spec.rb