add/refactor normalize_pod_services so configured services is always defined regardless if SERVICES are set up
This commit is contained in:
parent
2757cbb149
commit
408bafca09
2 changed files with 18 additions and 3 deletions
|
|
@ -107,14 +107,13 @@ HELP
|
|||
end
|
||||
|
||||
def self.normalize_pod_services
|
||||
self['configured_services'] = []
|
||||
if defined?(SERVICES)
|
||||
configured_services = []
|
||||
SERVICES.keys.each do |service|
|
||||
unless SERVICES[service].keys.any?{|service_key| SERVICES[service][service_key].blank?}
|
||||
configured_services << service
|
||||
self['configured_services'] << service
|
||||
end
|
||||
end
|
||||
self['configured_services'] = configured_services
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -175,6 +175,22 @@ describe AppConfig do
|
|||
end
|
||||
end
|
||||
|
||||
describe '.normalize_services' do
|
||||
before do
|
||||
@services = SERVICES
|
||||
Object.send(:remove_const, :SERVICES)
|
||||
end
|
||||
|
||||
after do
|
||||
SERVICES = @services
|
||||
end
|
||||
|
||||
it 'sets configured_services to an empty array if SERVICES is not defined' do
|
||||
AppConfig.normalize_pod_services
|
||||
AppConfig.configured_services.should == []
|
||||
end
|
||||
end
|
||||
|
||||
describe ".[]=" do
|
||||
describe "when setting pod_url" do
|
||||
context "with a symbol" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue