rspec-isolation 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.mkd CHANGED
@@ -1,16 +1,16 @@
1
1
  Running Your Test Cases in Isolation
2
2
  ====================================
3
3
 
4
- The RSpec examples are generally run in a single ruby process. It dosen't matter until your code introduces some **global variables**, which would **be polluted between examples**. A common solution is to reset them in the `after` hook, but it broken the DRY rule and would bring a lots of extra works. The best way is to **run them in separated sub processes**. This gem would help you to achieve this within a single method call.
4
+ The RSpec examples are generally run in a single ruby process. It dosen't matter until your code introduces some **global variables**, which would **be polluted between examples**. A common solution is to reset them in the after hook, but it breaks the DRY rule and would brings a lots of extra works. The best way is to **run them in separated sub processes**. This gem would help you to achieve this within a single method call.
5
5
 
6
6
  Dependency
7
7
  ----------
8
- This gem is depended on Rspec 2.0 and above. You should have it installed before using this gem.
8
+ This gem depends on Rspec 2.0 and above. You should have it installed before using this gem.
9
9
 
10
10
  Installation
11
11
  ------------
12
12
 
13
- sudo gem install rspec-isolation
13
+ sudo gem install rspec-isolation
14
14
 
15
15
  **Note:** The installation would NOT automatically install the rspec 2.0.
16
16
 
@@ -20,69 +20,67 @@ Image a spec file exists:
20
20
 
21
21
  $greeting = "Hello, world!"
22
22
 
23
- describe "Test with global vars" do
24
- it "should be replace with my name" do
25
- $greeting.gsub!(/\bworld\b/, "Kevin")
26
- $greeting.should == "Hello, Kevin!"
27
- end
28
-
29
- it "should be replace with my hometown name" do
30
- $greeting.gsub!(/\bworld\b/, "Wuhan")
31
- $greeting.should == "Hello, Wuhan!"
32
- end
33
- end
23
+ describe "Test with global vars" do
24
+ it "should be replaced with my name" do
25
+ $greeting.gsub!(/\bworld\b/, "Kevin")
26
+ $greeting.should == "Hello, Kevin!"
27
+ end
28
+
29
+ it "should be replaced with my hometown name" do
30
+ $greeting.gsub!(/\bworld\b/, "Wuhan")
31
+ $greeting.should == "Hello, Wuhan!"
32
+ end
33
+ end
34
34
 
35
35
  The `$greeting` is polluted in the first example and the second example would failed.
36
36
 
37
37
  Now we require this gem:
38
38
 
39
- require 'rspec/isolation'
39
+ require 'rspec/isolation'
40
40
 
41
41
  Then you can choose one of the following ways to enable the isolation:
42
42
 
43
- 1. Using `iso_it`:
43
+ **1. Using `iso_it`:**
44
44
 
45
- require 'rspec/isolation'
46
- $greeting = "Hello, world!"
47
-
48
- describe "Test with global vars" do
49
- iso_it "should be replace with my name" do
50
- $greeting.gsub!(/\bworld\b/, "Kevin")
51
- $greeting.should == "Hello, Kevin!"
52
- end
45
+ require 'rspec/isolation'
46
+ $greeting = "Hello, world!"
53
47
 
54
- it "should be replace with my hometown name" do
55
- $greeting.gsub!(/\bworld\b/, "Wuhan")
56
- $greeting.should == "Hello, Wuhan!"
57
- end
58
- end
48
+ describe "Test with global vars" do
49
+ iso_it "should be replaced with my name" do
50
+ $greeting.gsub!(/\bworld\b/, "Kevin")
51
+ $greeting.should == "Hello, Kevin!"
52
+ end
53
+
54
+ it "should be replaced with my hometown name" do
55
+ $greeting.gsub!(/\bworld\b/, "Wuhan")
56
+ $greeting.should == "Hello, Wuhan!"
57
+ end
58
+ end
59
59
 
60
- This would run the first example in a sub process.
60
+ Now the first example would be run in a sub process.
61
61
 
62
- 2. Using `run_in_isolation` in `before(:each)` hook:
63
-
64
- require 'rspec/isolation'
65
- $greeting = "Hello, world!"
66
-
67
- describe "Test with global vars" do
68
- before(:each) do
69
- run_in_isolation
70
- end
71
- it "should be replace with my name" do
72
- $greeting.gsub!(/\bworld\b/, "Kevin")
73
- $greeting.should == "Hello, Kevin!"
74
- end
75
-
76
- it "should be replace with my hometown name" do
77
- $greeting.gsub!(/\bworld\b/, "Wuhan")
78
- $greeting.should == "Hello, Wuhan!"
79
- end
80
- end
62
+ **2. Using `run_in_isolation` in `before(:each)` hook:**
63
+
64
+ require 'rspec/isolation'
65
+ $greeting = "Hello, world!"
66
+
67
+ describe "Test with global vars" do
68
+ before(:each) do
69
+ run_in_isolation
70
+ end
71
+ it "should be replaced with my name" do
72
+ $greeting.gsub!(/\bworld\b/, "Kevin")
73
+ $greeting.should == "Hello, Kevin!"
74
+ end
75
+
76
+ it "should be replaced with my hometown name" do
77
+ $greeting.gsub!(/\bworld\b/, "Wuhan")
78
+ $greeting.should == "Hello, Wuhan!"
79
+ end
80
+ end
81
81
 
82
- This would run all examples in separated sub process. Note: It does not work
83
- if you put `run_in_isolation` in a `before(:all)` hook.
82
+ Now all examples would be run in separated sub processes. **Note: It won't work if you put `run_in_isolation` in a `before(:all)` hook.**
84
83
 
85
84
  Author
86
85
  ------
87
- Kevin Fu, corntrace@gmail.com, @corntrace. If you like and use this gem, please feel free to give me any
88
- recommandation.
86
+ Kevin Fu, corntrace@gmail.com, @corntrace. If you like and use this gem, please feel free to give me any recommandation.
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Isolation
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
- end
5
+ end
@@ -9,17 +9,18 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["Kevin Fu"]
10
10
  s.email = ["corntrace@gmail.com"]
11
11
  s.homepage = "http://rubygems.org/gems/rspec-isolation"
12
- s.summary = "Make rspec examples executed in separated processes."
13
- s.description = "Make rspec examples executed in separated processes. \
12
+ s.summary = "Make rspec examples run in separated processes."
13
+ s.description = "Make rspec examples run in separated processes. \
14
14
  Especially used in framework development."
15
15
 
16
16
  s.required_rubygems_version = ">= 1.3.6"
17
17
 
18
- s.add_development_dependency "bundler", ">= 1.0.0.rc.5"
18
+ s.add_development_dependency "bundler", ">= 1.0.2"
19
+ s.add_development_dependency "rspec", ">=2.0.0"
19
20
 
20
21
  s.files = `git ls-files`.split("\n")
21
22
  s.executables = `git ls-files`.split("\n").select{|f| f =~ /^bin/}
22
23
  s.require_path = 'lib'
23
24
 
24
- s.add_dependency("rspec", ["~> 2.0.0"])
25
- end
25
+ # s.add_dependency("rspec", ["~> 2.0.0"])
26
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kevin Fu
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-16 00:00:00 +08:00
17
+ date: 2010-10-17 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -28,10 +28,8 @@ dependencies:
28
28
  segments:
29
29
  - 1
30
30
  - 0
31
- - 0
32
- - rc
33
- - 5
34
- version: 1.0.0.rc.5
31
+ - 2
32
+ version: 1.0.2
35
33
  type: :development
36
34
  version_requirements: *id001
37
35
  - !ruby/object:Gem::Dependency
@@ -40,16 +38,16 @@ dependencies:
40
38
  requirement: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
42
40
  requirements:
43
- - - ~>
41
+ - - ">="
44
42
  - !ruby/object:Gem::Version
45
43
  segments:
46
44
  - 2
47
45
  - 0
48
46
  - 0
49
47
  version: 2.0.0
50
- type: :runtime
48
+ type: :development
51
49
  version_requirements: *id002
52
- description: Make rspec examples executed in separated processes. Especially used in framework development.
50
+ description: Make rspec examples run in separated processes. Especially used in framework development.
53
51
  email:
54
52
  - corntrace@gmail.com
55
53
  executables: []
@@ -102,6 +100,6 @@ rubyforge_project:
102
100
  rubygems_version: 1.3.7
103
101
  signing_key:
104
102
  specification_version: 3
105
- summary: Make rspec examples executed in separated processes.
103
+ summary: Make rspec examples run in separated processes.
106
104
  test_files: []
107
105