fake_env 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/lib/fake_env.rb +3 -25
- data/lib/fake_env/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 301581436581f47f4c5561574b3f1495bbf85263
|
4
|
+
data.tar.gz: 209854541eb38ade33c07b7d2bc6eb3c268103f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28eeec36341e77fc515c21cefc7ad283d994bc310ee56a7afbb2bdd39c259740a0b5715b654d2b8ae3ed65a18ddd7b46a64c801a7eec89f09b455b1cd4438083
|
7
|
+
data.tar.gz: da8fe6b042d976fd9cda2abbdf8042be91864216f68fdf0c1fd9006a11eda7ee02b226c8d2d34ee6ff3a5cee3aa802fa5be5dc3afcd3be50479e95ef40e6fc04
|
data/README.md
CHANGED
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/lib/fake_env.rb
CHANGED
@@ -1,37 +1,15 @@
|
|
1
|
-
require 'thread'
|
2
1
|
require 'fake_env/version'
|
3
2
|
|
4
3
|
module FakeEnv
|
5
4
|
class << self
|
6
|
-
attr_reader :actual
|
5
|
+
attr_reader :actual
|
7
6
|
|
8
7
|
def activate!
|
9
|
-
@actual = ENV.
|
10
|
-
@fake = Hash.new do |fake, key|
|
11
|
-
val = @actual[key]
|
12
|
-
|
13
|
-
fake[key] = val ? val : val.clone
|
14
|
-
end
|
15
|
-
|
16
|
-
@actual_get_method ||= ENV.method(:[])
|
17
|
-
@actual_set_method ||= ENV.method(:[]=)
|
18
|
-
|
19
|
-
class << ENV
|
20
|
-
def [](key)
|
21
|
-
FakeEnv.fake[key]
|
22
|
-
end
|
23
|
-
|
24
|
-
def []=(key, val)
|
25
|
-
FakeEnv.fake[key] = val.freeze
|
26
|
-
end
|
27
|
-
end
|
8
|
+
@actual = ENV.to_h
|
28
9
|
end
|
29
10
|
|
30
11
|
def deactivate!
|
31
|
-
|
32
|
-
define_method(:[], FakeEnv.actual_get_method)
|
33
|
-
define_method(:[]=, FakeEnv.actual_set_method)
|
34
|
-
end
|
12
|
+
ENV.replace(@actual)
|
35
13
|
end
|
36
14
|
|
37
15
|
def within
|
data/lib/fake_env/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
93
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.4.
|
94
|
+
rubygems_version: 2.4.5.1
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: A fake ENV for your tests.
|