Sha256: d2339ecc7563e6700d50bd72c4e6d9864df8ab58ff80f31ff8294356b667f65c

Contents?: true

Size: 891 Bytes

Versions: 27

Compression:

Stored size: 891 Bytes

Contents

require 'spec_helper'

describe Lazyman::Config do
	before do
		@valid_file = config_file('config.yml')
		@wrong_format = config_file('wrong_config.yml')
		@content = {host: 'www.example.com'}
	end

	it 'should raise error when initialized with a missing file' do
		lambda {Lazyman::Config.new('not_exist_file')}.should raise_error(Lazyman::ConfigFileMissingError)
	end

	it 'should NOT raise error when initialized with an exist file' do
		lambda {Lazyman::Config.new(@valid_file)}.should_not raise_error(Lazyman::ConfigFileMissingError)
	end

	it 'should load yaml file correctly' do
		Lazyman::Config.new(@valid_file).hash_content['host'].should eql('www.example.com')
	end

	it 'should init an OpenStruct object correctly' do
		c = Lazyman::Config.new(@valid_file).content
		c.host.should eql('www.example.com')
		c.is_a?(OpenStruct).should be_true
	end

end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
lazyman-0.1.14 spec/lazy_config_spec.rb
magicspec-0.0.14 spec/magicspec_config_spec.rb
magicspec-0.0.11 spec/magicspec_config_spec.rb
magicspec-0.0.10 spec/magicspec_config_spec.rb
magicspec-0.0.9 spec/magicspec_config_spec.rb
magicspec-0.0.8 spec/magicspec_config_spec.rb
magicspec-0.0.7 spec/magicspec_config_spec.rb
magicspec-0.0.6 spec/magicspec_config_spec.rb
magicspec-0.0.5 spec/magicspec_config_spec.rb
magicspec-0.0.4 spec/magicspec_config_spec.rb
magicspec-0.0.3 spec/magicspec_config_spec.rb
magicspec-0.0.2 spec/magicspec_config_spec.rb
magicspec-0.0.1 spec/magicspec_config_spec.rb
lazyman-0.1.13 spec/lazy_config_spec.rb
lazyman-0.1.12 spec/lazy_config_spec.rb
lazyman-0.1.11 spec/lazy_config_spec.rb
lazyman-0.1.10 spec/lazy_config_spec.rb
lazyman-0.1.9 spec/lazy_config_spec.rb
lazyman-0.1.8 spec/lazy_config_spec.rb
lazyman-0.1.7 spec/lazy_config_spec.rb