Commit the pile of initial work. Largely taken from company internal

repos, allowed to be newly released.  Portions already in production,
coverage still needs to be boosted.  Enjoy.

FossilOrigin-Name: 0f17fa483f55467bdf9e8f99dace58e6a90f5a8a7e595bdd79dfda5c92d16b7f
This commit is contained in:
Mahlon E. Smith 2014-04-22 00:21:43 +00:00
commit b18647f6a5
23 changed files with 2639 additions and 0 deletions

View file

@ -0,0 +1,66 @@
#!/usr/bin/env rspec
require_relative '../helpers'
describe Symphony::Metronome do
before( :each ) do
ENV.delete( 'METRONOME_CONFIG' )
end
it "will load a default config file if none is specified" do
config_object = double( "Configurability::Config object" )
expect( Configurability ).to receive( :gather_defaults ).
and_return( {} )
expect( Configurability::Config ).to receive( :load ).
with( described_class::DEFAULT_CONFIG_FILE, {} ).
and_return( config_object )
expect( config_object ).to receive( :install )
described_class.load_config
end
it "will load a config file given in an environment variable if none is specified" do
ENV['METRONOME_CONFIG'] = '/usr/local/etc/config.yml'
config_object = double( "Configurability::Config object" )
expect( Configurability ).to receive( :gather_defaults ).
and_return( {} )
expect( Configurability::Config ).to receive( :load ).
with( '/usr/local/etc/config.yml', {} ).
and_return( config_object )
expect( config_object ).to receive( :install )
described_class.load_config
end
it "will load a config file and install it if one is given" do
config_object = double( "Configurability::Config object" )
expect( Configurability ).to receive( :gather_defaults ).
and_return( {} )
expect( Configurability::Config ).to receive( :load ).
with( 'a/configfile.yml', {} ).
and_return( config_object )
expect( config_object ).to receive( :install )
described_class.load_config( 'a/configfile.yml' )
end
it "will override default values when loading the config if they're given" do
config_object = double( "Configurability::Config object" )
expect( Configurability ).to_not receive( :gather_defaults )
expect( Configurability::Config ).to receive( :load ).
with( 'a/different/configfile.yml', {database: {dbname: 'test'}} ).
and_return( config_object )
expect( config_object ).to receive( :install )
described_class.load_config( 'a/different/configfile.yml', database: {dbname: 'test'} )
end
end