rspec_multi_env 1.0.0 → 2.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: 64eba1573f751be9b6d7c2f11794223faecdb4f3
4
- data.tar.gz: 6d9a81243528d3b751276383ade1b589652f08b0
3
+ metadata.gz: f2477a605777ba09423cd216acdb09f2a8c5e08d
4
+ data.tar.gz: d232c4e70beb399d3513584c7fc0689db89566c7
5
5
  SHA512:
6
- metadata.gz: 3ad016b210ae04119274931ad8eec8b2b47b8e6c7b36e86aee4891ed3733aec7ba9baae93fe328a2b878be93c11ffcd7266323f59d0e9b625ef2308a7fc9b10f
7
- data.tar.gz: 87cd64eda77720633ed05bcf1191222600e176bf61fa02e1a34aba489e965c477fe0fc2ccc3af3df938eec957e9cc58eee8ef3c472ac85c1b99b26050b94de96
6
+ metadata.gz: 9d4baf8c8103c49f1f7e20c1596e12100ccd857948f2b3450952e47f00735823b550dcc1e53533c6af9d34f1632eeb60215a88cdace91a0df974ef056fdad046
7
+ data.tar.gz: b54c85b5f3b9638285c810fa125b2bebe9042ed6e75932b4b940e02444be730e83dd1f4b945090b23a395b1bd3a36f1321a0e9464ad8c9bac88a30f1d6fa7ac7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec_multi_env (1.0.0)
4
+ rspec_multi_env (2.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -24,17 +24,17 @@ Or install it yourself as:
24
24
  ## Usage
25
25
 
26
26
  ```ruby
27
- describe 'Your Test' do
28
- before(:all) do
29
- environment :sandboxed do
30
- #... custom code/configuration
31
- end
32
-
33
- environment :staging do
34
- #... custom code/configuration
35
- end
27
+ RspecMultiEnv.setup do |env|
28
+ env.when :sandboxed do
29
+ #... custom code/configuration
36
30
  end
37
31
 
32
+ env.when :staging do
33
+ #... custom code/configuration
34
+ end
35
+ end
36
+
37
+ describe 'Your Test' do
38
38
  # rest of your tests that use the env specific config
39
39
  end
40
40
  ```
@@ -5,6 +5,14 @@ module RspecMultiEnv
5
5
 
6
6
  def reset
7
7
  @environments = []
8
+ self
9
+ end
10
+
11
+ def when(name, &block)
12
+ register(name)
13
+ if current?(name)
14
+ yield
15
+ end
8
16
  end
9
17
 
10
18
  def register(name)
@@ -1,15 +1,7 @@
1
1
  RSpec.configure do |config|
2
- config.include RspecMultiEnv::DSL
3
-
4
- config.before(:all) do
5
- RspecMultiEnv::EnvironmentConfiguration.instance.reset
6
- end
7
-
8
- config.around(:example) do |example|
9
- if RspecMultiEnv::EnvironmentConfiguration.instance.current_environment_registered?
10
- example.run
11
- else
12
- example.skip
2
+ config.before :context do |context|
3
+ unless RspecMultiEnv::EnvironmentConfiguration.instance.current_environment_registered?
4
+ context.skip
13
5
  end
14
6
  end
15
7
  end
@@ -1,3 +1,3 @@
1
1
  module RspecMultiEnv
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -1,7 +1,9 @@
1
1
  require "rspec_multi_env/version"
2
2
  require "rspec_multi_env/environment_configuration"
3
- require "rspec_multi_env/dsl"
4
3
  require "rspec_multi_env/hooks"
5
4
 
6
5
  module RspecMultiEnv
6
+ def self.setup(&block)
7
+ yield RspecMultiEnv::EnvironmentConfiguration.instance.reset
8
+ end
7
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_multi_env
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - smsohan
@@ -56,7 +56,6 @@ files:
56
56
  - bin/console
57
57
  - bin/setup
58
58
  - lib/rspec_multi_env.rb
59
- - lib/rspec_multi_env/dsl.rb
60
59
  - lib/rspec_multi_env/environment_configuration.rb
61
60
  - lib/rspec_multi_env/hooks.rb
62
61
  - lib/rspec_multi_env/version.rb
@@ -1,10 +0,0 @@
1
- module RspecMultiEnv
2
- module DSL
3
- def environment(env_name)
4
- EnvironmentConfiguration.instance.register env_name
5
- if EnvironmentConfiguration.instance.current?(env_name)
6
- yield
7
- end
8
- end
9
- end
10
- end