spork 0.9.0.rc3 → 0.9.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +19 -8
- data/features/gemfiles/rails3.0/Gemfile.lock +1 -1
- data/lib/spork/app_framework/rails.rb +1 -1
- data/lib/spork/run_strategy.rb +4 -0
- data/lib/spork/run_strategy/forking.rb +4 -1
- data/lib/spork/run_strategy/magazine.rb +2 -0
- data/lib/spork/run_strategy/magazine/magazine_slave_provider.rb +1 -1
- data/lib/spork/server.rb +3 -2
- data/lib/spork/test_framework/cucumber.rb +20 -6
- metadata +4 -4
data/README.rdoc
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
== SYNOPSIS:
|
10
10
|
|
11
|
-
Spork is Tim Harper's implementation of test server (similar to the script/spec_server that used to be provided by rspec-rails), except rather than using the Rails constant unloading to reload your files, it forks a copy of the server each time you run your tests. The result? Spork runs more solid: it doesn't get corrupted over time, and it properly handles modules and any voodoo meta programming you may have put in your app.
|
11
|
+
Spork is Tim Harper's implementation of test server (similar to the script/spec_server that used to be provided by rspec-rails), except rather than using the Rails constant unloading to reload your files, it forks a copy of the server each time you run your tests. The result? Spork runs more solid: it doesn't get corrupted over time, it can work with any ruby framework, and it properly handles modules and any voodoo meta programming you may have put in your app.
|
12
12
|
|
13
13
|
Spork runs on POSIX systems using fork. It also runs on windows by pre-populating a pool of ready processes (referred to here as the "magazine" strategy).
|
14
14
|
|
@@ -18,8 +18,6 @@ Spork runs on POSIX systems using fork. It also runs on windows by pre-populatin
|
|
18
18
|
* Cucumber
|
19
19
|
* Test::Unit (via 'gem install spork-testunit')
|
20
20
|
|
21
|
-
And more to come! Vote for your favorite at http://github.com/timcharper/spork/issues
|
22
|
-
|
23
21
|
== Supported Application Frameworks
|
24
22
|
|
25
23
|
Actually, Spork ~can~ work with any application framework. But, it ships with hooks and helpers to make an "out of the box" experience.
|
@@ -31,13 +29,21 @@ Actually, Spork ~can~ work with any application framework. But, it ships with h
|
|
31
29
|
|
32
30
|
=== rubygems:
|
33
31
|
|
34
|
-
[sudo] gem install spork
|
32
|
+
[sudo] gem install spork --prerelease
|
33
|
+
|
34
|
+
(Rails 2.x)
|
35
|
+
|
36
|
+
[sudo] gem install spork --version 0.8.4
|
35
37
|
|
36
38
|
=== bundler:
|
37
39
|
|
38
40
|
Add to your Gemfile:
|
39
41
|
|
40
|
-
gem
|
42
|
+
gem 'spork', '~> 0.9.0.rc'
|
43
|
+
|
44
|
+
(Rails 2.x, use this)
|
45
|
+
|
46
|
+
gem 'spork', '~> 0.8'
|
41
47
|
|
42
48
|
== Usage
|
43
49
|
|
@@ -57,11 +63,13 @@ Finally, run spork. A spec DRb server will be running!
|
|
57
63
|
|
58
64
|
Initially, you may find that a few files don't reload automatically. This is because they are being loaded during Spork startup. To identify which project files are being pre-loaded, and why, run:
|
59
65
|
|
60
|
-
spork --diagnose
|
66
|
+
spork --diagnose | less
|
61
67
|
(or spork -d, for short)
|
62
68
|
|
63
69
|
It will output a lot of stuff. At the top you'll find a summary of all project files loaded. Down below, the stack trace for each file (how it got loaded). Spork hooks into Rails and does some magic (TM) to prevent ApplicationController observers, etc from pre-loading. Similar hooks for other ruby frameworks may come as support demands.
|
64
70
|
|
71
|
+
You may find this wiki page useful for common ways to battle a variety of common pre-loading issues: http://github.com/timcharper/spork/wiki/Spork.trap_method-Jujutsu
|
72
|
+
|
65
73
|
== Running specs over Spork
|
66
74
|
|
67
75
|
=== RSpec
|
@@ -82,7 +90,7 @@ Or, you could add the following flag to your +spec.opts+ file.
|
|
82
90
|
|
83
91
|
Cucumber has DRb support (see http://wiki.github.com/aslakhellesoy/cucumber/spork-and-drb )
|
84
92
|
|
85
|
-
cucumber --drb
|
93
|
+
cucumber --drb features/my.feature
|
86
94
|
|
87
95
|
Use this as a guideline when "Sporking" your features/support/env.rb file
|
88
96
|
|
@@ -117,5 +125,8 @@ See http://wiki.github.com/timcharper/spork/troubleshooting
|
|
117
125
|
* Ben Mabey - help with documentation, testing, suggestions, patches, and bringing Cucumber support.
|
118
126
|
* David Chelimsky - for the fine RSpec testing framework, and the original rspec-rails spec_server implementation, which Spork has built upon.
|
119
127
|
* LeadTune - just for being an awesome place to work.
|
128
|
+
* Alan Aslak - for the fine Cucumber testing framework, and for much collaboration getting cucumber working with spork.
|
129
|
+
* Roger Pack - JRuby support / Windows
|
130
|
+
* Donald Parish - Windows support (Magazine strategy)
|
120
131
|
|
121
|
-
Spork (c)
|
132
|
+
Spork (c) 2011 Tim Harper, released under the MIT license
|
@@ -41,7 +41,7 @@ class Spork::AppFramework::Rails < Spork::AppFramework
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def preload_rails
|
44
|
-
if deprecated_version && (not
|
44
|
+
if deprecated_version && (not /^3/.match(deprecated_version))
|
45
45
|
puts "This version of spork only supports Rails 3.0. To use spork with rails 2.3.x, downgrade to spork 0.8.x."
|
46
46
|
exit 1
|
47
47
|
end
|
data/lib/spork/run_strategy.rb
CHANGED
data/lib/spork/server.rb
CHANGED
@@ -22,7 +22,7 @@ class Spork::Server
|
|
22
22
|
|
23
23
|
# Sets up signals and starts the DRb service. If it's successful, it doesn't return. Not ever. You don't need to override this.
|
24
24
|
def listen
|
25
|
-
|
25
|
+
@run_strategy.assert_ready!
|
26
26
|
trap("SIGINT") { sig_int_received }
|
27
27
|
trap("SIGTERM") { abort; exit!(0) }
|
28
28
|
trap("USR2") { abort; restart } if Signal.list.has_key?("USR2")
|
@@ -45,8 +45,9 @@ class Spork::Server
|
|
45
45
|
# When implementing a test server, don't override this method: override run_tests instead.
|
46
46
|
def run(argv, stderr, stdout)
|
47
47
|
puts "Running tests with args #{argv.inspect}..."
|
48
|
-
run_strategy.run(argv, stderr, stdout)
|
48
|
+
result = run_strategy.run(argv, stderr, stdout)
|
49
49
|
puts "Done.\n\n"
|
50
|
+
result
|
50
51
|
end
|
51
52
|
|
52
53
|
def abort
|
@@ -9,16 +9,30 @@ class Spork::TestFramework::Cucumber < Spork::TestFramework
|
|
9
9
|
|
10
10
|
def preload
|
11
11
|
require 'cucumber'
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
@step_mother = Spork::Server::Cucumber.mother_object
|
12
|
+
if ::Cucumber::VERSION >= '0.9.0'
|
13
|
+
# nothing to do nowadays
|
14
|
+
else
|
15
|
+
preload_legacy_cucumbers
|
17
16
|
end
|
18
17
|
super
|
19
18
|
end
|
20
19
|
|
21
20
|
def run_tests(argv, stderr, stdout)
|
22
|
-
::Cucumber::
|
21
|
+
if ::Cucumber::VERSION >= '0.9.0'
|
22
|
+
::Cucumber::Cli::Main.new(argv, stdout, stderr).execute!
|
23
|
+
else
|
24
|
+
::Cucumber::Cli::Main.new(argv, stdout, stderr).execute!(@step_mother)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def preload_legacy_cucumbers
|
31
|
+
begin
|
32
|
+
@step_mother = ::Cucumber::Runtime.new
|
33
|
+
@step_mother.load_programming_language('rb')
|
34
|
+
rescue NoMethodError => pre_cucumber_0_4 # REMOVE WHEN SUPPORT FOR PRE-0.4 IS DROPPED
|
35
|
+
@step_mother = Spork::Server::Cucumber.mother_object
|
36
|
+
end
|
23
37
|
end
|
24
38
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15424141
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
9
|
- 0
|
10
10
|
- rc
|
11
|
-
-
|
12
|
-
version: 0.9.0.
|
11
|
+
- 4
|
12
|
+
version: 0.9.0.rc4
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Tim Harper
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-02-
|
21
|
+
date: 2011-02-25 00:00:00 -07:00
|
22
22
|
default_executable: spork
|
23
23
|
dependencies: []
|
24
24
|
|