Sha256: c08a512c1bfb9be201d589416edd19ca00695f8b164fca7596e53acc360f5be7

Contents?: true

Size: 1.42 KB

Versions: 8

Compression:

Stored size: 1.42 KB

Contents

require File.expand_path('../../spec_helper', __FILE__)
module Noe
  describe "Config.new" do
    
    context 'without argument' do
      subject{ Config.new }
      
      it 'should create a default configuration' do
        subject.should be_kind_of(Config)
        subject.noe_version.should == Noe::VERSION
        subject.file.should_not be_nil
      end
      
    end # without argument
    
    context 'with a hash' do
      let(:hash){ {'config_file' => File.expand_path("../config1.yaml", __FILE__)} }
      subject{ Config.new(hash) }
      
      it 'should create a configuration instance' do
        subject.file.should_not be_nil
      end
      
      it 'should have merged the default config' do
        subject.noe_version.should == Noe::VERSION
      end
      
    end # with a hash
    
    context 'with an invalid file' do
      
      it 'should raise a Noe::Error' do
        file = File.expand_path("../unexistsing.yaml", __FILE__)
        lambda{ Config.new(file) }.should raise_error(Noe::Error)
      end
      
    end # with an invalid file
    
    context 'with an valid file' do
      let(:file){ File.expand_path("../config1.yaml", __FILE__) }
      subject{ Config.new(file) }
      
      it 'should create a valid configuration' do
        subject.should be_kind_of(Config)
        subject.noe_version.should == "1.0.0"
        subject.file.should == file
      end
      
    end # with an valid file
    
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
noe-1.7.3 spec/unit/config/new_spec.rb
noe-1.7.2 spec/unit/config/new_spec.rb
noe-1.7.1 spec/unit/config/new_spec.rb
noe-1.7.0 spec/unit/config/new_spec.rb
noe-1.6.0 spec/unit/config/new_spec.rb
noe-1.5.1 spec/unit/config/new_spec.rb
noe-1.5.0 spec/unit/config/new_spec.rb
noe-1.4.0 spec/unit/config/new_spec.rb