forked from aeolus-incubator/thor-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config file may now include logging options. Also adds support to set…
… config file by env variable. Fixes aeolus-incubator#17
- Loading branch information
Showing
5 changed files
with
138 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require 'aeolus_cli/main' | ||
|
||
describe "loading configuration-file by environment variable" do | ||
|
||
before do | ||
config_file = File.expand_path("spec/sample/aeolus-cli-config") | ||
ENV['AEOLUS_CLI_CONF'] = config_file | ||
end | ||
|
||
describe 'with no command line overrides' do | ||
before do | ||
AeolusCli::Provider.start | ||
end | ||
it 'the configuration file should be loaded' do | ||
AeolusCli::Model::Base.site.to_s.should == 'http://example.com:3013/api' | ||
AeolusCli::Model::Base.user.to_s.should == 'master' | ||
AeolusCli::Model::Base.password.to_s.should == 'ofuniverse' | ||
ActiveResource::Base.logger.level.should == Logger::DEBUG | ||
end | ||
end | ||
|
||
describe 'with --username override' do | ||
before do | ||
AeolusCli::Provider.start(["--username", "override-user"]) | ||
end | ||
it 'the configuration file should be loaded' do | ||
AeolusCli::Model::Base.user.to_s.should == 'override-user' | ||
end | ||
end | ||
|
||
describe 'with --password override' do | ||
before do | ||
AeolusCli::Provider.start(["--password", "override-password"]) | ||
end | ||
it 'the configuration file should be loaded' do | ||
AeolusCli::Model::Base.password.to_s.should == 'override-password' | ||
end | ||
end | ||
|
||
describe 'with --conductor-url override' do | ||
before do | ||
AeolusCli::Provider.start(["--conductor-url", | ||
"https://localhost/conductor/api"]) | ||
end | ||
it 'the configuration file should be loaded' do | ||
AeolusCli::Model::Base.site.to_s.should == | ||
'https://localhost/conductor/api' | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Sample aeolus-cli config file | ||
:conductor: | ||
:url: http://example.com:3013/api | ||
:username: master | ||
:password: ofuniverse | ||
:logging: | ||
:level: DEBUG | ||
:log-file: STDERR |