Skip to content

Commit

Permalink
Ignore nil values in config.env
Browse files Browse the repository at this point in the history
  • Loading branch information
drogus committed Aug 20, 2012
1 parent b992e40 commit 1f5365b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/travis/model/env_helpers.rb
Expand Up @@ -3,7 +3,7 @@ module Model
module EnvHelpers
def obfuscate_env(vars)
vars = [vars] unless vars.is_a?(Array)
vars.map do |var|
vars.compact.map do |var|
repository.key.secure.decrypt(var) do |decrypted|
Travis::Helpers.obfuscate_env_vars(decrypted)
end
Expand Down
7 changes: 7 additions & 0 deletions spec/travis/model/build_spec.rb
Expand Up @@ -224,6 +224,13 @@
}
end

it 'works with nil values' do
build = Build.new(:repository => Factory(:repository))
build.config = { :rvm => ['1.8.7'] }
build.config[:env] = [[nil, {:secure => ''}]]
build.obfuscated_config.should == { :rvm => ['1.8.7'], :env => [''] }
end

it 'does not make an empty env key an array but leaves it empty' do
build = Build.new(:repository => Factory(:repository))
build.config = { :rvm => ['1.8.7'], :env => nil }
Expand Down

0 comments on commit 1f5365b

Please sign in to comment.