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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8e758319734b5da9b536cc9473bbf3df09fe5bc
4
- data.tar.gz: c54e9db35ca61e3a4c00e687a4c38619c4123656
3
+ metadata.gz: 301581436581f47f4c5561574b3f1495bbf85263
4
+ data.tar.gz: 209854541eb38ade33c07b7d2bc6eb3c268103f3
5
5
  SHA512:
6
- metadata.gz: ef0a3c4fc2e9795df7d3f069836896d4e73e46752c027c0a166df67c24a5676426aac80ef949915c4ec3d475a31899ebaea9fe30a2ed1221be2c0b6dc4459c94
7
- data.tar.gz: 7431b52773ff6a11763b899c2ee1a3968939fda5b7412b54ccd1b211528406be4f363d335af950d2a496feee5f1a896b25e0e4cdb9fe0203879c2bada3491380
6
+ metadata.gz: 28eeec36341e77fc515c21cefc7ad283d994bc310ee56a7afbb2bdd39c259740a0b5715b654d2b8ae3ed65a18ddd7b46a64c801a7eec89f09b455b1cd4438083
7
+ data.tar.gz: da8fe6b042d976fd9cda2abbdf8042be91864216f68fdf0c1fd9006a11eda7ee02b226c8d2d34ee6ff3a5cee3aa802fa5be5dc3afcd3be50479e95ef40e6fc04
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # FakeEnv
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/fake_env.svg)](http://badge.fury.io/rb/fake_env)
4
+ [![Build Status](https://travis-ci.org/rosylilly/fake_env.svg)](https://travis-ci.org/rosylilly/fake_env)
5
+
3
6
  A fake `ENV` for your tests.
4
7
 
5
8
  ## Usage
File without changes
data/bin/setup CHANGED
File without changes
@@ -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, :fake, :actual_get_method, :actual_set_method
5
+ attr_reader :actual
7
6
 
8
7
  def activate!
9
- @actual = ENV.clone
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
- class << ENV
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
@@ -1,3 +1,3 @@
1
1
  module FakeEnv
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
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.0.0
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-03-21 00:00:00.000000000 Z
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.6
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.