rspec_multi_env 2.5.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +7 -11
- data/lib/rspec_multi_env.rb +4 -12
- data/lib/rspec_multi_env/environment_configuration.rb +0 -24
- data/lib/rspec_multi_env/version.rb +1 -1
- metadata +2 -3
- data/lib/rspec_multi_env/hooks.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dee0a0059a23e394d8dbc2996f1b9727331df53
|
4
|
+
data.tar.gz: 8df413bdaf214c541c0451d5c2c5bc58e2f9bf5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fae17eb245231d5ba7574bf6e63d7f2cb5fe0d3b648ce66f3041963ff4819737441bb7d927c03a705c4bf2711e7a5528d47b8b1b4a9086e4051dffd0cdedf76
|
7
|
+
data.tar.gz: 5e722af7eb190b0aff2855523bb78e63050dc34f34ba84fa925d64f58c0e3148a4f9209fdfc7c49abed1225bb6934eac7bc8aa6d7310b48c286cfd2ef2245d68
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,18 +28,14 @@ Or install it yourself as:
|
|
28
28
|
RspecMultiEnv.use ENV['TEST_ENV'].to_sym
|
29
29
|
|
30
30
|
# some_spec.rb
|
31
|
-
RspecMultiEnv.
|
32
|
-
|
33
|
-
|
31
|
+
describe 'Your Test', if: RspecMultiEnv.on(:sandboxed, :staging) do
|
32
|
+
before :all do
|
33
|
+
if RspecMultiEnv.current? :sandboxed
|
34
|
+
#... custom code/configuration
|
35
|
+
elsif RspecMultiEnv.current? :staging
|
36
|
+
#... custom code/configuration:
|
37
|
+
end
|
34
38
|
end
|
35
|
-
|
36
|
-
env.when :staging do
|
37
|
-
#... custom code/configuration
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
describe 'Your Test' do
|
42
|
-
# rest of your tests that use the env specific config
|
43
39
|
end
|
44
40
|
```
|
45
41
|
|
data/lib/rspec_multi_env.rb
CHANGED
@@ -1,19 +1,7 @@
|
|
1
1
|
require "rspec_multi_env/version"
|
2
2
|
require "rspec_multi_env/environment_configuration"
|
3
|
-
require "rspec_multi_env/hooks"
|
4
3
|
|
5
4
|
module RspecMultiEnv
|
6
|
-
def self.setup(*envs)
|
7
|
-
if block_given?
|
8
|
-
yield RspecMultiEnv::EnvironmentConfiguration.instance.reset
|
9
|
-
else
|
10
|
-
RspecMultiEnv::EnvironmentConfiguration.instance.reset
|
11
|
-
envs.each do |env|
|
12
|
-
RspecMultiEnv::EnvironmentConfiguration.instance.register(env)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
5
|
def self.use(env_name)
|
18
6
|
RspecMultiEnv::EnvironmentConfiguration.instance.use env_name
|
19
7
|
end
|
@@ -21,4 +9,8 @@ module RspecMultiEnv
|
|
21
9
|
def self.current?(env_name)
|
22
10
|
RspecMultiEnv::EnvironmentConfiguration.instance.current? env_name
|
23
11
|
end
|
12
|
+
|
13
|
+
def self.on?(*envs)
|
14
|
+
envs.any?{|env| RspecMultiEnv::EnvironmentConfiguration.instance.current?(env)}
|
15
|
+
end
|
24
16
|
end
|
@@ -3,34 +3,10 @@ module RspecMultiEnv
|
|
3
3
|
include Singleton
|
4
4
|
attr_accessor :environments
|
5
5
|
|
6
|
-
def reset
|
7
|
-
@environments = []
|
8
|
-
self
|
9
|
-
end
|
10
|
-
|
11
|
-
def when(name, &block)
|
12
|
-
register(name)
|
13
|
-
if current?(name)
|
14
|
-
yield
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def register(name)
|
19
|
-
@environments << name
|
20
|
-
end
|
21
|
-
|
22
|
-
def registered?(name)
|
23
|
-
@environments.include?(name)
|
24
|
-
end
|
25
|
-
|
26
6
|
def current?(env)
|
27
7
|
current == env.to_sym
|
28
8
|
end
|
29
9
|
|
30
|
-
def current_environment_registered?
|
31
|
-
registered?(current)
|
32
|
-
end
|
33
|
-
|
34
10
|
def current
|
35
11
|
@current
|
36
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_multi_env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- smsohan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,7 +57,6 @@ files:
|
|
57
57
|
- bin/setup
|
58
58
|
- lib/rspec_multi_env.rb
|
59
59
|
- lib/rspec_multi_env/environment_configuration.rb
|
60
|
-
- lib/rspec_multi_env/hooks.rb
|
61
60
|
- lib/rspec_multi_env/version.rb
|
62
61
|
- rspec_multi_env.gemspec
|
63
62
|
homepage: https://github.com/smsohan/rspec_multi_env
|