Sha256: 0c34f55ad7964d807b86f00d23553ce43b7324e719d23bf7303624c02340e390
Contents?: true
Size: 1.82 KB
Versions: 3
Compression:
Stored size: 1.82 KB
Contents
require 'spec_helper' describe Hue::Config::Application do mock_application_config_path after(:all) do create_test_application_config end it 'should report the config file location' do described_class.file_path.should == TEST_CONFIG_APPLICATION_PATH end it "should throw and error if a named config doesn't exist" do lambda do described_class.named('not_default') end.should raise_error(Hue::Config::NotFound, /Config named (.*) not found/) end context 'with a config file, containing a default' do config = described_class.default it "should give the default config and report it's values" do config.name == described_class::STRING_DEFAULT config.bridge_id == TEST_CONFIG_APPLICATION[config.name][described_class::STRING_BRIDGE_ID] config.id == TEST_CONFIG_APPLICATION[config.name][described_class::STRING_ID] end it 'should allow deleting the default config from the file' do config.delete YAML.load_file(described_class.file_path)[described_class::STRING_DEFAULT].should be_nil end end context 'given an new config' do config = described_class.new('http://someip/api', 'some_id', 'not_default') it 'should report the values' do config.name == 'not_default' config.bridge_id == 'http://someip/api' config.id == 'not_default' end it 'should allow writing the new config to file' do config.write YAML.load_file(described_class.file_path)['not_default'].should be_a(Hash) end it 'should allow fetching that name config' do named_config = described_class.named('not_default') named_config.should == config end it 'should allow deleting that named config from the file' do config.delete YAML.load_file(described_class.file_path)['not_default'].should be_nil end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hue-lib-0.7.1 | spec/hue/config/application_spec.rb |
hue-lib-0.7.0 | spec/hue/config/application_spec.rb |
hue-lib-0.6.0 | spec/hue/config/application_spec.rb |