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.
@@ -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 "spork"
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) 2010 Tim Harper, released under the MIT license
132
+ Spork (c) 2011 Tim Harper, released under the MIT license
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/timcharper/projects/spork
3
3
  specs:
4
- spork (0.9.0.rc2)
4
+ spork (0.9.0.rc3)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -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 deprecated_version.match?(/^3/))
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
@@ -22,6 +22,10 @@ class Spork::RunStrategy
22
22
  raise NotImplementedError
23
23
  end
24
24
 
25
+ def assert_ready!
26
+ raise NotImplementedError
27
+ end
28
+
25
29
  def abort
26
30
  raise NotImplementedError
27
31
  end
@@ -29,4 +29,7 @@ class Spork::RunStrategy::Forking < Spork::RunStrategy
29
29
  @child && @child.running?
30
30
  end
31
31
 
32
- end
32
+ def assert_ready!
33
+ raise RuntimeError, "This process hasn't loaded the environment yet by loading the prefork block" unless Spork.using_spork?
34
+ end
35
+ end
@@ -138,4 +138,6 @@ class Spork::RunStrategy::Magazine < Spork::RunStrategy
138
138
  @running
139
139
  end
140
140
 
141
+ def assert_ready!
142
+ end
141
143
  end
@@ -2,7 +2,7 @@
2
2
  require 'drb'
3
3
  require 'rinda/ring'
4
4
  require 'rinda/tuplespace'
5
- require 'magazine_slave'
5
+ require './magazine_slave'
6
6
 
7
7
 
8
8
 
@@ -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
- raise RuntimeError, "you must call Spork.using_spork! before starting the server" unless Spork.using_spork?
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
- begin
13
- @step_mother = ::Cucumber::StepMother.new
14
- @step_mother.load_programming_language('rb')
15
- rescue NoMethodError => pre_cucumber_0_4 # REMOVE WHEN SUPPORT FOR PRE-0.4 IS DROPPED
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::Cli::Main.new(argv, stdout, stderr).execute!(@step_mother)
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: 15424131
4
+ hash: 15424141
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
9
  - 0
10
10
  - rc
11
- - 3
12
- version: 0.9.0.rc3
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-06 00:00:00 -07:00
21
+ date: 2011-02-25 00:00:00 -07:00
22
22
  default_executable: spork
23
23
  dependencies: []
24
24