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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e984c60b1b8fbc0cd8015a87e3439cc049bd56e
4
- data.tar.gz: e9f4c98f09faa8bb31cf724483ee23a3ebda0255
3
+ metadata.gz: 3dee0a0059a23e394d8dbc2996f1b9727331df53
4
+ data.tar.gz: 8df413bdaf214c541c0451d5c2c5bc58e2f9bf5a
5
5
  SHA512:
6
- metadata.gz: 5002702e4fdb65d02eb2cc991bbb44d7da3054bd7f03c0dd4369c4a9eb09f6207942fa1931283ef6214e675e74924cb020d442143197b60559bd94853cfadb4b
7
- data.tar.gz: 3cf0c8ccfea7c1da905cca816a67b4b71c446f2ba492181a21df681702a3505477e2cada51009e718ecb4694a0ff1ed478664184faee50114401527ef073f7af
6
+ metadata.gz: 1fae17eb245231d5ba7574bf6e63d7f2cb5fe0d3b648ce66f3041963ff4819737441bb7d927c03a705c4bf2711e7a5528d47b8b1b4a9086e4051dffd0cdedf76
7
+ data.tar.gz: 5e722af7eb190b0aff2855523bb78e63050dc34f34ba84fa925d64f58c0e3148a4f9209fdfc7c49abed1225bb6934eac7bc8aa6d7310b48c286cfd2ef2245d68
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec_multi_env (2.5.0)
4
+ rspec_multi_env (3.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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.setup do |env|
32
- env.when :sandboxed do
33
- #... custom code/configuration
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module RspecMultiEnv
2
- VERSION = "2.5.0"
2
+ VERSION = "3.0.0"
3
3
  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: 2.5.0
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-21 00:00:00.000000000 Z
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
@@ -1,7 +0,0 @@
1
- RSpec.configure do |config|
2
- config.before :context do |context|
3
- unless RspecMultiEnv::EnvironmentConfiguration.instance.current_environment_registered?
4
- context.skip
5
- end
6
- end
7
- end