milhouse-spork 0.7.5 → 0.7.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +19 -19
- data/README.rdoc +99 -99
- data/assets/bootstrap.rb +29 -29
- data/bin/spork +20 -20
- data/features/cucumber_rails_integration.feature +118 -118
- data/features/diagnostic_mode.feature +40 -40
- data/features/rails_delayed_loading_workarounds.feature +115 -115
- data/features/rspec_rails_integration.feature +93 -93
- data/features/spork_debugger.feature +108 -108
- data/features/steps/general_steps.rb +3 -3
- data/features/steps/rails_steps.rb +52 -52
- data/features/steps/sandbox_steps.rb +115 -115
- data/features/support/background_job.rb +63 -63
- data/features/support/env.rb +111 -111
- data/features/unknown_app_framework.feature +41 -41
- data/geminstaller.yml +9 -9
- data/lib/spork/app_framework/rails.rb +157 -157
- data/lib/spork/app_framework/rails_stub_files/application.rb +1 -1
- data/lib/spork/app_framework/rails_stub_files/application_controller.rb +22 -22
- data/lib/spork/app_framework/rails_stub_files/application_helper.rb +2 -2
- data/lib/spork/app_framework/unknown.rb +5 -5
- data/lib/spork/app_framework.rb +73 -73
- data/lib/spork/custom_io_streams.rb +24 -24
- data/lib/spork/diagnoser.rb +103 -103
- data/lib/spork/ext/ruby-debug.rb +150 -150
- data/lib/spork/forker.rb +70 -70
- data/lib/spork/run_strategy/forking.rb +29 -29
- data/lib/spork/run_strategy/magazine/magazine_slave.rb +0 -0
- data/lib/spork/run_strategy/magazine/magazine_slave_provider.rb +0 -0
- data/lib/spork/run_strategy/magazine/ring_server.rb +0 -0
- data/lib/spork/run_strategy/magazine.rb +0 -0
- data/lib/spork/run_strategy.rb +44 -44
- data/lib/spork/runner.rb +90 -90
- data/lib/spork/server.rb +74 -74
- data/lib/spork/test_framework/cucumber.rb +24 -24
- data/lib/spork/test_framework/rspec.rb +14 -14
- data/lib/spork/test_framework.rb +167 -167
- data/lib/spork.rb +126 -126
- data/spec/spec_helper.rb +108 -108
- data/spec/spork/app_framework/rails_spec.rb +22 -22
- data/spec/spork/app_framework/unknown_spec.rb +12 -12
- data/spec/spork/app_framework_spec.rb +16 -16
- data/spec/spork/diagnoser_spec.rb +105 -105
- data/spec/spork/forker_spec.rb +44 -44
- data/spec/spork/run_strategy/forking_spec.rb +38 -38
- data/spec/spork/runner_spec.rb +50 -50
- data/spec/spork/server_spec.rb +15 -15
- data/spec/spork/test_framework/cucumber_spec.rb +11 -11
- data/spec/spork/test_framework/rspec_spec.rb +10 -10
- data/spec/spork/test_framework_spec.rb +114 -114
- data/spec/spork_spec.rb +151 -151
- data/spec/support/fake_framework.rb +15 -15
- data/spec/support/fake_run_strategy.rb +21 -21
- metadata +19 -20
@@ -1,115 +1,115 @@
|
|
1
|
-
Feature: Rails Delayed Work arounds
|
2
|
-
To allow a rails developer to update as many parts of his application as possible without needing to restart Spork
|
3
|
-
Spork automatically tells rails to delay loading certain parts of the application until after the fork occurs
|
4
|
-
Providing work arounds
|
5
|
-
|
6
|
-
Background: Rails App with RSpec and Spork
|
7
|
-
|
8
|
-
Given I am in a fresh rails project named "test_rails_project"
|
9
|
-
And a file named "spec/spec_helper.rb" with:
|
10
|
-
"""
|
11
|
-
require 'rubygems'
|
12
|
-
require 'spork'
|
13
|
-
|
14
|
-
Spork.prefork do
|
15
|
-
require File.dirname(__FILE__) + '/../config/environment.rb'
|
16
|
-
require 'spec'
|
17
|
-
require 'spec/rails'
|
18
|
-
end
|
19
|
-
|
20
|
-
Spork.each_run do
|
21
|
-
end
|
22
|
-
"""
|
23
|
-
And the application has a model, observer, route, and application helper
|
24
|
-
Given a file named "app/helpers/application_helper.rb" with:
|
25
|
-
"""
|
26
|
-
module ApplicationHelper
|
27
|
-
include Reverseatron
|
28
|
-
end
|
29
|
-
"""
|
30
|
-
Given a file named "lib/reverseatron.rb" with:
|
31
|
-
"""
|
32
|
-
module Reverseatron
|
33
|
-
def reverse_text(txt)
|
34
|
-
txt.reverse
|
35
|
-
end
|
36
|
-
end
|
37
|
-
"""
|
38
|
-
Given a file named "app/controllers/users_controller.rb" with:
|
39
|
-
"""
|
40
|
-
class UsersController < ApplicationController
|
41
|
-
$loaded_stuff << 'UsersController'
|
42
|
-
def index
|
43
|
-
@users = []
|
44
|
-
end
|
45
|
-
end
|
46
|
-
"""
|
47
|
-
Given a file named "app/helpers/misc_helper.rb" with:
|
48
|
-
"""
|
49
|
-
module MiscHelper
|
50
|
-
def misc_helper_method
|
51
|
-
'hello miscellaneous'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
"""
|
55
|
-
Given a file named "app/helpers/users_helper.rb" with:
|
56
|
-
"""
|
57
|
-
module UsersHelper
|
58
|
-
end
|
59
|
-
"""
|
60
|
-
Given a file named "app/views/users/index.html.erb" with:
|
61
|
-
"""
|
62
|
-
Original View
|
63
|
-
"""
|
64
|
-
Scenario: within a view rendered by a controller, calling helper methods from an included module in ApplicationHelper
|
65
|
-
Given a file named "spec/controllers/users_controller_spec.rb" with:
|
66
|
-
"""
|
67
|
-
describe UsersController do
|
68
|
-
integrate_views
|
69
|
-
it "renders a page, using a method inherited from ApplicationController" do
|
70
|
-
get :index
|
71
|
-
response.body.should_not include('Original View')
|
72
|
-
puts "Views are not being cached when rendering from a controller"
|
73
|
-
|
74
|
-
response.body.should include('listing users')
|
75
|
-
puts "Controller stack is functioning when rendering from a controller"
|
76
|
-
|
77
|
-
response.body.should include('hello miscellaneous')
|
78
|
-
puts "All helper modules were included when rendering from a controller"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
"""
|
82
|
-
Given a file named "spec/views/index.html.erb_spec.rb" with:
|
83
|
-
"""
|
84
|
-
describe "/users/index.html.erb" do
|
85
|
-
|
86
|
-
it "renders the view" do
|
87
|
-
render
|
88
|
-
response.body.should_not include('Original View')
|
89
|
-
puts "Views are not being cached when rendering directly"
|
90
|
-
|
91
|
-
response.body.should include('listing users')
|
92
|
-
puts "Controller stack is functioning when rendering directly"
|
93
|
-
|
94
|
-
response.body.should include('hello miscellaneous')
|
95
|
-
puts "All helper modules were included when rendering directly"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
"""
|
99
|
-
When I fire up a spork instance with "spork rspec"
|
100
|
-
And the contents of "app/views/users/index.html.erb" are changed to:
|
101
|
-
"""
|
102
|
-
<%= reverse_text('listing users'.reverse) %>
|
103
|
-
<%= misc_helper_method rescue nil %>
|
104
|
-
<p>Here is a list of users</p>
|
105
|
-
"""
|
106
|
-
|
107
|
-
And I run spec --drb spec/controllers/users_controller_spec.rb
|
108
|
-
Then the output should contain "Controller stack is functioning when rendering from a controller"
|
109
|
-
Then the output should contain "Views are not being cached when rendering from a controller"
|
110
|
-
Then the output should contain "All helper modules were included when rendering from a controller"
|
111
|
-
|
112
|
-
And I run spec --drb spec/views/index.html.erb_spec.rb
|
113
|
-
Then the output should contain "Controller stack is functioning when rendering directly"
|
114
|
-
Then the output should contain "Views are not being cached when rendering directly"
|
115
|
-
Then the output should contain "All helper modules were included when rendering directly"
|
1
|
+
Feature: Rails Delayed Work arounds
|
2
|
+
To allow a rails developer to update as many parts of his application as possible without needing to restart Spork
|
3
|
+
Spork automatically tells rails to delay loading certain parts of the application until after the fork occurs
|
4
|
+
Providing work arounds
|
5
|
+
|
6
|
+
Background: Rails App with RSpec and Spork
|
7
|
+
|
8
|
+
Given I am in a fresh rails project named "test_rails_project"
|
9
|
+
And a file named "spec/spec_helper.rb" with:
|
10
|
+
"""
|
11
|
+
require 'rubygems'
|
12
|
+
require 'spork'
|
13
|
+
|
14
|
+
Spork.prefork do
|
15
|
+
require File.dirname(__FILE__) + '/../config/environment.rb'
|
16
|
+
require 'spec'
|
17
|
+
require 'spec/rails'
|
18
|
+
end
|
19
|
+
|
20
|
+
Spork.each_run do
|
21
|
+
end
|
22
|
+
"""
|
23
|
+
And the application has a model, observer, route, and application helper
|
24
|
+
Given a file named "app/helpers/application_helper.rb" with:
|
25
|
+
"""
|
26
|
+
module ApplicationHelper
|
27
|
+
include Reverseatron
|
28
|
+
end
|
29
|
+
"""
|
30
|
+
Given a file named "lib/reverseatron.rb" with:
|
31
|
+
"""
|
32
|
+
module Reverseatron
|
33
|
+
def reverse_text(txt)
|
34
|
+
txt.reverse
|
35
|
+
end
|
36
|
+
end
|
37
|
+
"""
|
38
|
+
Given a file named "app/controllers/users_controller.rb" with:
|
39
|
+
"""
|
40
|
+
class UsersController < ApplicationController
|
41
|
+
$loaded_stuff << 'UsersController'
|
42
|
+
def index
|
43
|
+
@users = []
|
44
|
+
end
|
45
|
+
end
|
46
|
+
"""
|
47
|
+
Given a file named "app/helpers/misc_helper.rb" with:
|
48
|
+
"""
|
49
|
+
module MiscHelper
|
50
|
+
def misc_helper_method
|
51
|
+
'hello miscellaneous'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
"""
|
55
|
+
Given a file named "app/helpers/users_helper.rb" with:
|
56
|
+
"""
|
57
|
+
module UsersHelper
|
58
|
+
end
|
59
|
+
"""
|
60
|
+
Given a file named "app/views/users/index.html.erb" with:
|
61
|
+
"""
|
62
|
+
Original View
|
63
|
+
"""
|
64
|
+
Scenario: within a view rendered by a controller, calling helper methods from an included module in ApplicationHelper
|
65
|
+
Given a file named "spec/controllers/users_controller_spec.rb" with:
|
66
|
+
"""
|
67
|
+
describe UsersController do
|
68
|
+
integrate_views
|
69
|
+
it "renders a page, using a method inherited from ApplicationController" do
|
70
|
+
get :index
|
71
|
+
response.body.should_not include('Original View')
|
72
|
+
puts "Views are not being cached when rendering from a controller"
|
73
|
+
|
74
|
+
response.body.should include('listing users')
|
75
|
+
puts "Controller stack is functioning when rendering from a controller"
|
76
|
+
|
77
|
+
response.body.should include('hello miscellaneous')
|
78
|
+
puts "All helper modules were included when rendering from a controller"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
"""
|
82
|
+
Given a file named "spec/views/index.html.erb_spec.rb" with:
|
83
|
+
"""
|
84
|
+
describe "/users/index.html.erb" do
|
85
|
+
|
86
|
+
it "renders the view" do
|
87
|
+
render
|
88
|
+
response.body.should_not include('Original View')
|
89
|
+
puts "Views are not being cached when rendering directly"
|
90
|
+
|
91
|
+
response.body.should include('listing users')
|
92
|
+
puts "Controller stack is functioning when rendering directly"
|
93
|
+
|
94
|
+
response.body.should include('hello miscellaneous')
|
95
|
+
puts "All helper modules were included when rendering directly"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
"""
|
99
|
+
When I fire up a spork instance with "spork rspec"
|
100
|
+
And the contents of "app/views/users/index.html.erb" are changed to:
|
101
|
+
"""
|
102
|
+
<%= reverse_text('listing users'.reverse) %>
|
103
|
+
<%= misc_helper_method rescue nil %>
|
104
|
+
<p>Here is a list of users</p>
|
105
|
+
"""
|
106
|
+
|
107
|
+
And I run spec --drb spec/controllers/users_controller_spec.rb
|
108
|
+
Then the output should contain "Controller stack is functioning when rendering from a controller"
|
109
|
+
Then the output should contain "Views are not being cached when rendering from a controller"
|
110
|
+
Then the output should contain "All helper modules were included when rendering from a controller"
|
111
|
+
|
112
|
+
And I run spec --drb spec/views/index.html.erb_spec.rb
|
113
|
+
Then the output should contain "Controller stack is functioning when rendering directly"
|
114
|
+
Then the output should contain "Views are not being cached when rendering directly"
|
115
|
+
Then the output should contain "All helper modules were included when rendering directly"
|
@@ -1,93 +1,93 @@
|
|
1
|
-
Feature: Rails Integration
|
2
|
-
To get a developer up and running quickly
|
3
|
-
Spork automatically integrates with rails
|
4
|
-
Providing default hooks and behaviors
|
5
|
-
|
6
|
-
Background: Rails App with RSpec and Spork
|
7
|
-
|
8
|
-
Given I am in a fresh rails project named "test_rails_project"
|
9
|
-
And a file named "spec/spec_helper.rb" with:
|
10
|
-
"""
|
11
|
-
require 'rubygems'
|
12
|
-
require 'spork'
|
13
|
-
|
14
|
-
Spork.prefork do
|
15
|
-
# Loading more in this block will cause your specs to run faster. However,
|
16
|
-
# if you change any configuration or code from libraries loaded here, you'll
|
17
|
-
# need to restart spork for it take effect.
|
18
|
-
require File.dirname(__FILE__) + '/../config/environment.rb'
|
19
|
-
require 'spec'
|
20
|
-
require 'spec/rails'
|
21
|
-
|
22
|
-
#### this is for this test only #######
|
23
|
-
$loaded_stuff << 'prefork block' ######
|
24
|
-
#######################################
|
25
|
-
end
|
26
|
-
|
27
|
-
Spork.each_run do
|
28
|
-
# This code will be run each time you run your specs.
|
29
|
-
|
30
|
-
#### this is for this test only #######
|
31
|
-
$loaded_stuff << 'each_run block' #####
|
32
|
-
#######################################
|
33
|
-
end
|
34
|
-
"""
|
35
|
-
And the application has a model, observer, route, and application helper
|
36
|
-
Scenario: Analyzing files were preloaded
|
37
|
-
When I run spork --diagnose
|
38
|
-
Then the output should not contain "user_observer.rb"
|
39
|
-
Then the output should not contain "user.rb"
|
40
|
-
Then the output should not contain "app/controllers/application.rb"
|
41
|
-
Then the output should not contain "app/controllers/application_controller.rb"
|
42
|
-
Then the output should not contain "app/controllers/application_helper.rb"
|
43
|
-
Then the output should not contain "config/routes.rb"
|
44
|
-
|
45
|
-
Scenario: Running spork with a rails app and observers
|
46
|
-
Given a file named "spec/did_it_work_spec.rb" with:
|
47
|
-
"""
|
48
|
-
describe "Did it work?" do
|
49
|
-
it "checks to see if all worked" do
|
50
|
-
Spork.state.should == :using_spork
|
51
|
-
(Rails.respond_to?(:logger) ? Rails.logger : ActionController::Base.logger).info "hey there"
|
52
|
-
$loaded_stuff.should include('ActiveRecord::Base.establish_connection')
|
53
|
-
$loaded_stuff.should include('User')
|
54
|
-
$loaded_stuff.should include('UserObserver')
|
55
|
-
$loaded_stuff.should include('ApplicationHelper')
|
56
|
-
$loaded_stuff.should include('config/routes.rb')
|
57
|
-
$loaded_stuff.should include('each_run block')
|
58
|
-
$loaded_stuff.should include('prefork block')
|
59
|
-
puts "Specs successfully run within spork, and all initialization files were loaded"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
"""
|
63
|
-
When I fire up a spork instance with "spork rspec"
|
64
|
-
And I run spec --drb spec/did_it_work_spec.rb
|
65
|
-
Then the error output should be empty
|
66
|
-
And the output should contain "Specs successfully run within spork, and all initialization files were loaded"
|
67
|
-
And the file "log/test.log" should include "hey there"
|
68
|
-
|
69
|
-
|
70
|
-
Scenario: Running spork with a rails app and a non-standard port
|
71
|
-
Given this scenario is pending until rspec releases a version that supports --port
|
72
|
-
Given a file named "spec/did_it_work_spec.rb" with:
|
73
|
-
"""
|
74
|
-
describe "Did it work?" do
|
75
|
-
it "checks to see if all worked" do
|
76
|
-
Spork.state.should == :using_spork
|
77
|
-
(Rails.respond_to?(:logger) ? Rails.logger : ActionController::Base.logger).info "hey there"
|
78
|
-
$loaded_stuff.should include('ActiveRecord::Base.establish_connection')
|
79
|
-
$loaded_stuff.should include('User')
|
80
|
-
$loaded_stuff.should include('UserObserver')
|
81
|
-
$loaded_stuff.should include('ApplicationHelper')
|
82
|
-
$loaded_stuff.should include('config/routes.rb')
|
83
|
-
$loaded_stuff.should include('each_run block')
|
84
|
-
$loaded_stuff.should include('prefork block')
|
85
|
-
puts "Specs successfully run within spork, and all initialization files were loaded"
|
86
|
-
end
|
87
|
-
end
|
88
|
-
"""
|
89
|
-
When I fire up a spork instance with "spork rspec --port 7000"
|
90
|
-
And I run spec --drb --port 7000 spec/did_it_work_spec.rb
|
91
|
-
Then the error output should be empty
|
92
|
-
And the output should contain "Specs successfully run within spork, and all initialization files were loaded"
|
93
|
-
And the file "log/test.log" should include "hey there"
|
1
|
+
Feature: Rails Integration
|
2
|
+
To get a developer up and running quickly
|
3
|
+
Spork automatically integrates with rails
|
4
|
+
Providing default hooks and behaviors
|
5
|
+
|
6
|
+
Background: Rails App with RSpec and Spork
|
7
|
+
|
8
|
+
Given I am in a fresh rails project named "test_rails_project"
|
9
|
+
And a file named "spec/spec_helper.rb" with:
|
10
|
+
"""
|
11
|
+
require 'rubygems'
|
12
|
+
require 'spork'
|
13
|
+
|
14
|
+
Spork.prefork do
|
15
|
+
# Loading more in this block will cause your specs to run faster. However,
|
16
|
+
# if you change any configuration or code from libraries loaded here, you'll
|
17
|
+
# need to restart spork for it take effect.
|
18
|
+
require File.dirname(__FILE__) + '/../config/environment.rb'
|
19
|
+
require 'spec'
|
20
|
+
require 'spec/rails'
|
21
|
+
|
22
|
+
#### this is for this test only #######
|
23
|
+
$loaded_stuff << 'prefork block' ######
|
24
|
+
#######################################
|
25
|
+
end
|
26
|
+
|
27
|
+
Spork.each_run do
|
28
|
+
# This code will be run each time you run your specs.
|
29
|
+
|
30
|
+
#### this is for this test only #######
|
31
|
+
$loaded_stuff << 'each_run block' #####
|
32
|
+
#######################################
|
33
|
+
end
|
34
|
+
"""
|
35
|
+
And the application has a model, observer, route, and application helper
|
36
|
+
Scenario: Analyzing files were preloaded
|
37
|
+
When I run spork --diagnose
|
38
|
+
Then the output should not contain "user_observer.rb"
|
39
|
+
Then the output should not contain "user.rb"
|
40
|
+
Then the output should not contain "app/controllers/application.rb"
|
41
|
+
Then the output should not contain "app/controllers/application_controller.rb"
|
42
|
+
Then the output should not contain "app/controllers/application_helper.rb"
|
43
|
+
Then the output should not contain "config/routes.rb"
|
44
|
+
|
45
|
+
Scenario: Running spork with a rails app and observers
|
46
|
+
Given a file named "spec/did_it_work_spec.rb" with:
|
47
|
+
"""
|
48
|
+
describe "Did it work?" do
|
49
|
+
it "checks to see if all worked" do
|
50
|
+
Spork.state.should == :using_spork
|
51
|
+
(Rails.respond_to?(:logger) ? Rails.logger : ActionController::Base.logger).info "hey there"
|
52
|
+
$loaded_stuff.should include('ActiveRecord::Base.establish_connection')
|
53
|
+
$loaded_stuff.should include('User')
|
54
|
+
$loaded_stuff.should include('UserObserver')
|
55
|
+
$loaded_stuff.should include('ApplicationHelper')
|
56
|
+
$loaded_stuff.should include('config/routes.rb')
|
57
|
+
$loaded_stuff.should include('each_run block')
|
58
|
+
$loaded_stuff.should include('prefork block')
|
59
|
+
puts "Specs successfully run within spork, and all initialization files were loaded"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
"""
|
63
|
+
When I fire up a spork instance with "spork rspec"
|
64
|
+
And I run spec --drb spec/did_it_work_spec.rb
|
65
|
+
Then the error output should be empty
|
66
|
+
And the output should contain "Specs successfully run within spork, and all initialization files were loaded"
|
67
|
+
And the file "log/test.log" should include "hey there"
|
68
|
+
|
69
|
+
|
70
|
+
Scenario: Running spork with a rails app and a non-standard port
|
71
|
+
Given this scenario is pending until rspec releases a version that supports --port
|
72
|
+
Given a file named "spec/did_it_work_spec.rb" with:
|
73
|
+
"""
|
74
|
+
describe "Did it work?" do
|
75
|
+
it "checks to see if all worked" do
|
76
|
+
Spork.state.should == :using_spork
|
77
|
+
(Rails.respond_to?(:logger) ? Rails.logger : ActionController::Base.logger).info "hey there"
|
78
|
+
$loaded_stuff.should include('ActiveRecord::Base.establish_connection')
|
79
|
+
$loaded_stuff.should include('User')
|
80
|
+
$loaded_stuff.should include('UserObserver')
|
81
|
+
$loaded_stuff.should include('ApplicationHelper')
|
82
|
+
$loaded_stuff.should include('config/routes.rb')
|
83
|
+
$loaded_stuff.should include('each_run block')
|
84
|
+
$loaded_stuff.should include('prefork block')
|
85
|
+
puts "Specs successfully run within spork, and all initialization files were loaded"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
"""
|
89
|
+
When I fire up a spork instance with "spork rspec --port 7000"
|
90
|
+
And I run spec --drb --port 7000 spec/did_it_work_spec.rb
|
91
|
+
Then the error output should be empty
|
92
|
+
And the output should contain "Specs successfully run within spork, and all initialization files were loaded"
|
93
|
+
And the file "log/test.log" should include "hey there"
|
@@ -1,108 +1,108 @@
|
|
1
|
-
Feature: Spork Debugger integration
|
2
|
-
As a developer
|
3
|
-
I want to invoke the debugger my specs within Spork
|
4
|
-
In order to drill in and figure out what's wrong
|
5
|
-
|
6
|
-
Scenario: Invoking the debugger via 'debugger'
|
7
|
-
Given a file named "spec/spec_helper.rb" with:
|
8
|
-
"""
|
9
|
-
require 'rubygems'
|
10
|
-
require 'spork'
|
11
|
-
require 'spork/ext/ruby-debug'
|
12
|
-
|
13
|
-
Spork.prefork { require 'spec' }
|
14
|
-
Spork.each_run { }
|
15
|
-
"""
|
16
|
-
And a file named "spec/debugger_spec.rb" with:
|
17
|
-
"""
|
18
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
19
|
-
|
20
|
-
describe "Debugger" do
|
21
|
-
it "should debug" do
|
22
|
-
2.times do |count|
|
23
|
-
@message = "count = #{count}"
|
24
|
-
debugger
|
25
|
-
@message = nil
|
26
|
-
end
|
27
|
-
puts "it worked!"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
"""
|
31
|
-
|
32
|
-
When I fire up a spork instance with "spork rspec"
|
33
|
-
And I run this in the background: spec --drb spec/debugger_spec.rb
|
34
|
-
|
35
|
-
Then the spork window should output a line containing "Debug Session Started"
|
36
|
-
|
37
|
-
When I type this in the spork window: "e @message"
|
38
|
-
Then the spork window should output a line containing "count = 0"
|
39
|
-
|
40
|
-
When I type this in the spork window: "continue"
|
41
|
-
|
42
|
-
When I type this in the spork window: "e @message"
|
43
|
-
Then the spork window should output a line containing "count = 1"
|
44
|
-
|
45
|
-
When I type this in the spork window: "continue"
|
46
|
-
|
47
|
-
Then the spork window should output a line containing "Debug Session Terminated"
|
48
|
-
And the output should contain "it worked!"
|
49
|
-
|
50
|
-
Scenario: When ruby-debug is already required and started.
|
51
|
-
Given a file named "spec/spec_helper.rb" with:
|
52
|
-
"""
|
53
|
-
require 'rubygems'
|
54
|
-
require 'spork'
|
55
|
-
require 'ruby-debug'
|
56
|
-
Debugger.start
|
57
|
-
|
58
|
-
require 'spork/ext/ruby-debug'
|
59
|
-
|
60
|
-
Spork.prefork { require 'spec' }
|
61
|
-
Spork.each_run { }
|
62
|
-
"""
|
63
|
-
|
64
|
-
And a file named "spec/debugger_spec.rb" with:
|
65
|
-
"""
|
66
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
67
|
-
|
68
|
-
describe "Debugger" do
|
69
|
-
it "should debug" do
|
70
|
-
@message = "yup"
|
71
|
-
debugger
|
72
|
-
puts "it worked!"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
"""
|
76
|
-
|
77
|
-
When I fire up a spork instance with "spork rspec"
|
78
|
-
And I run this in the background: spec --drb spec/debugger_spec.rb
|
79
|
-
|
80
|
-
Then the spork window should output a line containing "Debug Session Started"
|
81
|
-
|
82
|
-
When I type this in the spork window: "e @message"
|
83
|
-
Then the spork window should output a line containing "yup"
|
84
|
-
|
85
|
-
When I type this in the spork window: "continue"
|
86
|
-
|
87
|
-
Then the spork window should output a line containing "Debug Session Terminated"
|
88
|
-
And the output should contain "it worked!"
|
89
|
-
|
90
|
-
Scenario: When ruby-debug is invoked during preload
|
91
|
-
Given a file named "spec/spec_helper.rb" with:
|
92
|
-
"""
|
93
|
-
require 'rubygems'
|
94
|
-
require 'spork'
|
95
|
-
require 'spork/ext/ruby-debug'
|
96
|
-
|
97
|
-
STDERR.puts("Spork is ready and listening") # trick out the start spork step to believe spork is ready... naughty, but effective.
|
98
|
-
@message = "it worked"
|
99
|
-
debugger
|
100
|
-
Spork.prefork { require 'spec' }
|
101
|
-
Spork.each_run { }
|
102
|
-
"""
|
103
|
-
|
104
|
-
When I fire up a spork instance with "spork rspec"
|
105
|
-
Then the spork window should output a line containing "spec_helper.rb"
|
106
|
-
When I type this in the spork window: "e @message"
|
107
|
-
Then the spork window should output a line containing "it worked"
|
108
|
-
When I type this in the spork window: "continue"
|
1
|
+
Feature: Spork Debugger integration
|
2
|
+
As a developer
|
3
|
+
I want to invoke the debugger my specs within Spork
|
4
|
+
In order to drill in and figure out what's wrong
|
5
|
+
|
6
|
+
Scenario: Invoking the debugger via 'debugger'
|
7
|
+
Given a file named "spec/spec_helper.rb" with:
|
8
|
+
"""
|
9
|
+
require 'rubygems'
|
10
|
+
require 'spork'
|
11
|
+
require 'spork/ext/ruby-debug'
|
12
|
+
|
13
|
+
Spork.prefork { require 'spec' }
|
14
|
+
Spork.each_run { }
|
15
|
+
"""
|
16
|
+
And a file named "spec/debugger_spec.rb" with:
|
17
|
+
"""
|
18
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
19
|
+
|
20
|
+
describe "Debugger" do
|
21
|
+
it "should debug" do
|
22
|
+
2.times do |count|
|
23
|
+
@message = "count = #{count}"
|
24
|
+
debugger
|
25
|
+
@message = nil
|
26
|
+
end
|
27
|
+
puts "it worked!"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
"""
|
31
|
+
|
32
|
+
When I fire up a spork instance with "spork rspec"
|
33
|
+
And I run this in the background: spec --drb spec/debugger_spec.rb
|
34
|
+
|
35
|
+
Then the spork window should output a line containing "Debug Session Started"
|
36
|
+
|
37
|
+
When I type this in the spork window: "e @message"
|
38
|
+
Then the spork window should output a line containing "count = 0"
|
39
|
+
|
40
|
+
When I type this in the spork window: "continue"
|
41
|
+
|
42
|
+
When I type this in the spork window: "e @message"
|
43
|
+
Then the spork window should output a line containing "count = 1"
|
44
|
+
|
45
|
+
When I type this in the spork window: "continue"
|
46
|
+
|
47
|
+
Then the spork window should output a line containing "Debug Session Terminated"
|
48
|
+
And the output should contain "it worked!"
|
49
|
+
|
50
|
+
Scenario: When ruby-debug is already required and started.
|
51
|
+
Given a file named "spec/spec_helper.rb" with:
|
52
|
+
"""
|
53
|
+
require 'rubygems'
|
54
|
+
require 'spork'
|
55
|
+
require 'ruby-debug'
|
56
|
+
Debugger.start
|
57
|
+
|
58
|
+
require 'spork/ext/ruby-debug'
|
59
|
+
|
60
|
+
Spork.prefork { require 'spec' }
|
61
|
+
Spork.each_run { }
|
62
|
+
"""
|
63
|
+
|
64
|
+
And a file named "spec/debugger_spec.rb" with:
|
65
|
+
"""
|
66
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
67
|
+
|
68
|
+
describe "Debugger" do
|
69
|
+
it "should debug" do
|
70
|
+
@message = "yup"
|
71
|
+
debugger
|
72
|
+
puts "it worked!"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
"""
|
76
|
+
|
77
|
+
When I fire up a spork instance with "spork rspec"
|
78
|
+
And I run this in the background: spec --drb spec/debugger_spec.rb
|
79
|
+
|
80
|
+
Then the spork window should output a line containing "Debug Session Started"
|
81
|
+
|
82
|
+
When I type this in the spork window: "e @message"
|
83
|
+
Then the spork window should output a line containing "yup"
|
84
|
+
|
85
|
+
When I type this in the spork window: "continue"
|
86
|
+
|
87
|
+
Then the spork window should output a line containing "Debug Session Terminated"
|
88
|
+
And the output should contain "it worked!"
|
89
|
+
|
90
|
+
Scenario: When ruby-debug is invoked during preload
|
91
|
+
Given a file named "spec/spec_helper.rb" with:
|
92
|
+
"""
|
93
|
+
require 'rubygems'
|
94
|
+
require 'spork'
|
95
|
+
require 'spork/ext/ruby-debug'
|
96
|
+
|
97
|
+
STDERR.puts("Spork is ready and listening") # trick out the start spork step to believe spork is ready... naughty, but effective.
|
98
|
+
@message = "it worked"
|
99
|
+
debugger
|
100
|
+
Spork.prefork { require 'spec' }
|
101
|
+
Spork.each_run { }
|
102
|
+
"""
|
103
|
+
|
104
|
+
When I fire up a spork instance with "spork rspec"
|
105
|
+
Then the spork window should output a line containing "spec_helper.rb"
|
106
|
+
When I type this in the spork window: "e @message"
|
107
|
+
Then the spork window should output a line containing "it worked"
|
108
|
+
When I type this in the spork window: "continue"
|
@@ -1,3 +1,3 @@
|
|
1
|
-
Given /^this scenario is pending.+/ do
|
2
|
-
pending
|
3
|
-
end
|
1
|
+
Given /^this scenario is pending.+/ do
|
2
|
+
pending
|
3
|
+
end
|