vault-test-tools 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,7 @@ module Vault::Test::EnvironmentHelpers
|
|
2
2
|
# Override an ENV variable for the current test. The original value will be
|
3
3
|
# restored automatically when the test finishes.
|
4
4
|
def set_env(key, value)
|
5
|
-
|
6
|
-
overrides[key] = ENV[key]
|
5
|
+
overrides[key] = ENV[key] unless overrides[key]
|
7
6
|
ENV[key] = value
|
8
7
|
end
|
9
8
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class EnvironmentHelpersTest < Vault::TestCase
|
4
|
+
|
5
|
+
include Vault::Test::EnvironmentHelpers
|
6
|
+
|
7
|
+
def test_set_env_ovverides_env
|
8
|
+
ENV['FOO'] = 'bar'
|
9
|
+
set_env('FOO', 'baz')
|
10
|
+
assert_equal('baz', ENV['FOO'])
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_teardown_restores_env_to_original_value
|
14
|
+
ENV['FOO'] = 'bar'
|
15
|
+
set_env('FOO', 'baz')
|
16
|
+
assert_equal('baz', ENV['FOO'])
|
17
|
+
set_env('FOO', 'buzz')
|
18
|
+
assert_equal('buzz', ENV['FOO'])
|
19
|
+
teardown
|
20
|
+
assert_equal('bar', ENV['FOO'])
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vault-test-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: turn
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- lib/vault-test-tools/spec.rb
|
169
169
|
- lib/vault-test-tools/test_case.rb
|
170
170
|
- lib/vault-test-tools/version.rb
|
171
|
+
- test/environment_helpers_test.rb
|
171
172
|
- test/helper.rb
|
172
173
|
- test/test_spec.rb
|
173
174
|
- vault-test-tools.gemspec
|
@@ -185,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
186
|
version: '0'
|
186
187
|
segments:
|
187
188
|
- 0
|
188
|
-
hash:
|
189
|
+
hash: 1086311466377128168
|
189
190
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
191
|
none: false
|
191
192
|
requirements:
|
@@ -194,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
195
|
version: '0'
|
195
196
|
segments:
|
196
197
|
- 0
|
197
|
-
hash:
|
198
|
+
hash: 1086311466377128168
|
198
199
|
requirements: []
|
199
200
|
rubyforge_project:
|
200
201
|
rubygems_version: 1.8.23
|
@@ -202,6 +203,7 @@ signing_key:
|
|
202
203
|
specification_version: 3
|
203
204
|
summary: Test classes and stuff you want in your dev, but not prod, environment.
|
204
205
|
test_files:
|
206
|
+
- test/environment_helpers_test.rb
|
205
207
|
- test/helper.rb
|
206
208
|
- test/test_spec.rb
|
207
209
|
has_rdoc:
|