travis-conditions 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44def53002f2ed6d40172c6769ec8c3388259093
4
- data.tar.gz: b0d13d10372c48781e3716077720897f72b22387
3
+ metadata.gz: 45ed752f8af131a4a0121e1a7016895f60a17743
4
+ data.tar.gz: 1abb2cd96e820aaf4f8e6786ff05956994838fde
5
5
  SHA512:
6
- metadata.gz: c1f2495506782f4dc028359e4cd61bccecf612cc95ac251d1e27a961cee17e2f4542bd59a1b2dc79829ad4c42c8334d29fc810455ed509164fc2e41edf3c0341
7
- data.tar.gz: a15b303d2b1adbf10fcf720ca4cbfa371e8aa92f3e06a5116ea8c988a89e2b70ef1983e4c17c9835744dd12747958e48e5086a4ae8efdfffdca8fb3912526236
6
+ metadata.gz: d5a2a1e2a7f9522d25e72726e05496b7a6ab6c719aef674ef3c2f7ea193867e0b2b47c6c950fdc39051bb7d0f38e97f7747fb6f5cfd1c94705561a608f716e06
7
+ data.tar.gz: ce2070be5d3cd20a36ac89d732aa32feb691203d391d4aa6f46b33ee2910a828e1aa635491967906ec3cd6b2dd7a529e320d0cadb84252809f9db661660a1597
@@ -83,7 +83,7 @@ module Travis
83
83
  end
84
84
 
85
85
  def present(value)
86
- value.respond_to?(:empty?) && !value.empty?
86
+ value.respond_to?(:empty?) ? !value.empty? : !!value
87
87
  end
88
88
 
89
89
  def blank(value)
@@ -1,5 +1,5 @@
1
1
  module Travis
2
2
  module Conditions
3
- VERSION = '1.0.8'
3
+ VERSION = '1.0.9'
4
4
  end
5
5
  end
data/spec/v1/eval_spec.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  describe Travis::Conditions::V1, 'eval' do
2
+ let(:data) { { branch: 'master', tag: tag, env: env } }
3
+ let(:env) { { foo: 'foo', bar: false } }
2
4
  let(:tag) { nil }
3
- let(:data) { { branch: 'master', tag: tag, env: { foo: 'foo', bar: false } } }
4
5
  subject { described_class.eval(str, data) }
5
6
 
6
7
  context do
@@ -251,7 +252,36 @@ describe Travis::Conditions::V1, 'eval' do
251
252
 
252
253
  context do
253
254
  let(:str) { 'env(foo) IS present' }
254
- it { should be true }
255
+
256
+ describe 'given an env hash with a string value' do
257
+ let(:env) { { foo: 'foo' } }
258
+ it { should be true }
259
+ end
260
+
261
+ describe 'given an env hash with a numeric value' do
262
+ let(:env) { { foo: 1 } }
263
+ it { should be true }
264
+ end
265
+
266
+ describe 'given an env hash with a boolean value' do
267
+ let(:env) { { foo: true } }
268
+ it { should be true }
269
+ end
270
+
271
+ describe 'given an env strings array with a string value' do
272
+ let(:env) { ['foo=foo'] }
273
+ it { should be true }
274
+ end
275
+
276
+ describe 'given an env strings array with a numeric value' do
277
+ let(:env) { ['foo=1'] }
278
+ it { should be true }
279
+ end
280
+
281
+ describe 'given an env strings array with a boolean value' do
282
+ let(:env) { ['foo=true'] }
283
+ it { should be true }
284
+ end
255
285
  end
256
286
 
257
287
  context do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis-conditions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis CI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-30 00:00:00.000000000 Z
11
+ date: 2019-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parslet