Sha256: b39bbd6d061b28be8d19170529aa4cb8f2021c8abb5628c1a83bd4058e907e3d

Contents?: true

Size: 826 Bytes

Versions: 4

Compression:

Stored size: 826 Bytes

Contents

require 'spec_helper'

describe Simplexframe::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 {Simplexframe::Config.new('not_exist_file')}.should raise_error()
	end

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

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

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simplexframe-0.0.04 spec/simple_config_spec.rb
simplexframe-0.0.03 spec/simple_config_spec.rb
simplexframe-0.0.02 spec/simple_config_spec.rb
simplexframe-0.0.01 spec/simple_config_spec.rb