spork 0.9.2 → 1.0.0rc0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/Gemfile +3 -1
  2. data/README.rdoc +22 -18
  3. data/features/diagnostic_mode.feature +1 -2
  4. data/features/support/bundler_helpers.rb +2 -8
  5. data/features/support/env.rb +7 -94
  6. data/features/support/spork_world.rb +84 -0
  7. data/features/unknown_app_framework.feature +5 -7
  8. data/lib/spork.rb +3 -10
  9. data/lib/spork/app_framework.rb +16 -30
  10. data/lib/spork/app_framework/unknown.rb +5 -1
  11. data/lib/spork/diagnoser.rb +1 -1
  12. data/lib/spork/run_strategy/magazine.rb +0 -0
  13. data/lib/spork/run_strategy/magazine/magazine_slave.rb +0 -0
  14. data/lib/spork/run_strategy/magazine/magazine_slave_provider.rb +0 -0
  15. data/lib/spork/run_strategy/magazine/ring_server.rb +0 -0
  16. data/lib/spork/runner.rb +1 -1
  17. data/lib/spork/test/cucumber_helpers.rb +5 -0
  18. data/lib/spork/test/test_helpers.rb +2 -0
  19. data/lib/spork/test_framework.rb +9 -9
  20. data/spec/spec_helper.rb +7 -88
  21. data/spec/spork/app_framework_spec.rb +0 -7
  22. data/spec/spork/diagnoser_spec.rb +0 -1
  23. data/spec/spork/test_framework_spec.rb +3 -3
  24. data/spec/support/fake_framework.rb +3 -1
  25. data/spec/support/should_include_a_string_like.rb +31 -0
  26. data/spec/support/test_io_streams.rb +17 -0
  27. data/spec/support/tmp_project_helpers.rb +30 -0
  28. metadata +24 -33
  29. data/assets/bootstrap.rb +0 -49
  30. data/features/cucumber_rails_integration.feature +0 -107
  31. data/features/gemfiles/rails3.0/Gemfile +0 -14
  32. data/features/gemfiles/rails3.0/Gemfile.lock +0 -139
  33. data/features/rails_delayed_loading_workarounds.feature +0 -177
  34. data/features/rspec_rails_integration.feature +0 -92
  35. data/features/steps/rails_steps.rb +0 -67
  36. data/lib/spork/app_framework/padrino.rb +0 -22
  37. data/lib/spork/app_framework/rails.rb +0 -82
  38. data/lib/spork/ext/rails-reloader.rb +0 -14
  39. data/lib/spork/gem_helpers.rb +0 -38
  40. data/spec/spork/app_framework/rails_spec.rb +0 -22
@@ -1,49 +0,0 @@
1
- require 'rubygems'
2
- require 'spork'
3
- #uncomment the following line to use spork with the debugger
4
- #require 'spork/ext/ruby-debug'
5
-
6
- Spork.prefork do
7
- # Loading more in this block will cause your tests to run faster. However,
8
- # if you change any configuration or code from libraries loaded here, you'll
9
- # need to restart spork for it take effect.
10
-
11
- end
12
-
13
- Spork.each_run do
14
- # This code will be run each time you run your specs.
15
-
16
- end
17
-
18
- # --- Instructions ---
19
- # Sort the contents of this file into a Spork.prefork and a Spork.each_run
20
- # block.
21
- #
22
- # The Spork.prefork block is run only once when the spork server is started.
23
- # You typically want to place most of your (slow) initializer code in here, in
24
- # particular, require'ing any 3rd-party gems that you don't normally modify
25
- # during development.
26
- #
27
- # The Spork.each_run block is run each time you run your specs. In case you
28
- # need to load files that tend to change during development, require them here.
29
- # With Rails, your application modules are loaded automatically, so sometimes
30
- # this block can remain empty.
31
- #
32
- # Note: You can modify files loaded *from* the Spork.each_run block without
33
- # restarting the spork server. However, this file itself will not be reloaded,
34
- # so if you change any of the code inside the each_run block, you still need to
35
- # restart the server. In general, if you have non-trivial code in this file,
36
- # it's advisable to move it into a separate file so you can easily edit it
37
- # without restarting spork. (For example, with RSpec, you could move
38
- # non-trivial code into a file spec/support/my_helper.rb, making sure that the
39
- # spec/support/* files are require'd from inside the each_run block.)
40
- #
41
- # Any code that is left outside the two blocks will be run during preforking
42
- # *and* during each_run -- that's probably not what you want.
43
- #
44
- # These instructions should self-destruct in 10 seconds. If they don't, feel
45
- # free to delete them.
46
-
47
-
48
-
49
-
@@ -1,107 +0,0 @@
1
- Feature: Cucumber integration with rails
2
- As a developer using cucumber and rails
3
- I want to use Spork with Cucumber
4
- In order to eliminate the startup cost of my application each time I run them
5
-
6
- Background: Sporked env.rb
7
- Given I am in a fresh rails project named "test_rails_project"
8
- And the application has a model, observer, route, and application helper
9
- And a file named "features/support/env.rb" with:
10
- """
11
- require 'rubygems'
12
- require 'spork'
13
- ENV["RAILS_ENV"] ||= "test"
14
-
15
-
16
- Spork.prefork do
17
- # Loading more in this block will cause your tests to run faster. However,
18
- # if you change any configuration or code from libraries loaded here, you'll
19
- # need to restart spork for it take effect.
20
-
21
- # Sets up the Rails environment for Cucumber
22
- require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
23
-
24
- require 'cucumber'
25
- require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
26
- require 'rspec/rails'
27
- require 'cucumber/rails/rspec'
28
-
29
- #### this is for this test only #######
30
- $loaded_stuff << 'prefork block' ######
31
- #######################################
32
- end
33
-
34
- Spork.each_run do
35
- #### this is for this test only #######
36
- $loaded_stuff << 'each_run block' #####
37
- #######################################
38
- end
39
- """
40
- And a file named "features/cucumber_rails.feature" with:
41
- """
42
- Feature: cucumber rails
43
- Scenario: did it work?
44
- Then it should work
45
-
46
- Scenario: did it work again?
47
- Then it should work
48
- """
49
- And a file named "features/support/cucumber_rails_helper.rb" with:
50
- """
51
- $loaded_stuff << 'features/support/cucumber_rails_helper.rb'
52
- """
53
- And a file named "config/database.yml" with:
54
- """
55
- test:
56
- adapter: sqlite3
57
- database: db/test.sqlite3
58
- timeout: 5000
59
- """
60
- And a file named "features/step_definitions/cucumber_rails_steps.rb" with:
61
- """
62
- Then "it should work" do
63
- (Rails.respond_to?(:logger) ? Rails.logger : ActionController::Base.logger).info "hey there"
64
- $loaded_stuff.should include('ActiveRecord::Base.establish_connection')
65
- $loaded_stuff.should include('User')
66
- $loaded_stuff.should include('UserObserver')
67
- $loaded_stuff.should include('ApplicationHelper')
68
- $loaded_stuff.should include('config/routes.rb')
69
- $loaded_stuff.should include('features/support/cucumber_rails_helper.rb')
70
- $loaded_stuff.should include('each_run block')
71
- $loaded_stuff.should include('prefork block')
72
- puts "It worked!"
73
- end
74
-
75
- Alors /ca marche/ do
76
- end
77
- """
78
- Scenario: Analyzing files were preloaded
79
- When I run spork --diagnose
80
- Then the output should not contain "user_observer.rb"
81
- Then the output should not contain "user.rb"
82
- Then the output should not contain "app/controllers/application.rb"
83
- Then the output should not contain "app/controllers/application_controller.rb"
84
- Then the output should not contain "app/controllers/application_helper.rb"
85
- Then the output should not contain "features/step_definitions/cucumber_rails_steps.rb"
86
- Then the output should not contain "features/support/cucumber_rails_helper.rb"
87
-
88
- Scenario: Running spork with a rails app and no server
89
- When I run cucumber --drb features
90
- Then the error output should contain
91
- """
92
- WARNING: No DRb server is running. Running features locally
93
- """
94
-
95
- Scenario: Running spork with a rails app and observers
96
- When I fire up a spork instance with "spork cucumber"
97
- And I run cucumber --drb features
98
- Then the error output should be empty
99
- And the output should contain "It worked!"
100
- And the file "log/test.log" should include "hey there"
101
-
102
- Scenario: Running spork with a rails app and a non-standard port
103
- When I fire up a spork instance with "spork cucumber -p 9000"
104
- And I run cucumber --drb --port 9000 features
105
- Then the error output should be empty
106
- And the output should contain "It worked!"
107
- And the file "log/test.log" should include "hey there"
@@ -1,14 +0,0 @@
1
- source :gemcutter
2
- gem 'sqlite3-ruby', '1.2.5'
3
- gem 'cucumber', '~> 1.0.0'
4
- gem 'cucumber-rails', '~> 1.0.0'
5
- gem "rspec", "2.5.0"
6
- gem 'rspec-rails', "2.5.0"
7
- gem 'rails', '3.0.7'
8
-
9
- if RUBY_VERSION =~ /^1\.9/
10
- gem 'ruby-debug19'
11
- else
12
- gem 'ruby-debug', '>= 0.10.3'
13
- end
14
- gem 'spork', :path => File.expand_path("../../..", File.dirname(__FILE__))
@@ -1,139 +0,0 @@
1
- PATH
2
- remote: /Users/timcharper/projects/spork
3
- specs:
4
- spork (0.9.0.rc8)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- abstract (1.0.0)
10
- actionmailer (3.0.7)
11
- actionpack (= 3.0.7)
12
- mail (~> 2.2.15)
13
- actionpack (3.0.7)
14
- activemodel (= 3.0.7)
15
- activesupport (= 3.0.7)
16
- builder (~> 2.1.2)
17
- erubis (~> 2.6.6)
18
- i18n (~> 0.5.0)
19
- rack (~> 1.2.1)
20
- rack-mount (~> 0.6.14)
21
- rack-test (~> 0.5.7)
22
- tzinfo (~> 0.3.23)
23
- activemodel (3.0.7)
24
- activesupport (= 3.0.7)
25
- builder (~> 2.1.2)
26
- i18n (~> 0.5.0)
27
- activerecord (3.0.7)
28
- activemodel (= 3.0.7)
29
- activesupport (= 3.0.7)
30
- arel (~> 2.0.2)
31
- tzinfo (~> 0.3.23)
32
- activeresource (3.0.7)
33
- activemodel (= 3.0.7)
34
- activesupport (= 3.0.7)
35
- activesupport (3.0.7)
36
- arel (2.0.9)
37
- builder (2.1.2)
38
- capybara (1.0.0)
39
- mime-types (>= 1.16)
40
- nokogiri (>= 1.3.3)
41
- rack (>= 1.0.0)
42
- rack-test (>= 0.5.4)
43
- selenium-webdriver (~> 0.2.0)
44
- xpath (~> 0.1.4)
45
- childprocess (0.1.9)
46
- ffi (~> 1.0.6)
47
- columnize (0.3.2)
48
- cucumber (1.0.0)
49
- builder (>= 2.1.2)
50
- diff-lcs (>= 1.1.2)
51
- gherkin (~> 2.4.1)
52
- json (>= 1.4.6)
53
- term-ansicolor (>= 1.0.5)
54
- cucumber-rails (1.0.2)
55
- capybara (>= 1.0.0)
56
- cucumber (~> 1.0.0)
57
- nokogiri (>= 1.4.6)
58
- diff-lcs (1.1.2)
59
- erubis (2.6.6)
60
- abstract (>= 1.0.0)
61
- ffi (1.0.9)
62
- gherkin (2.4.1)
63
- json (>= 1.4.6)
64
- i18n (0.5.0)
65
- json (1.5.3)
66
- json_pure (1.5.3)
67
- linecache (0.43)
68
- mail (2.2.19)
69
- activesupport (>= 2.3.6)
70
- i18n (>= 0.4.0)
71
- mime-types (~> 1.16)
72
- treetop (~> 1.4.8)
73
- mime-types (1.16)
74
- nokogiri (1.4.6)
75
- polyglot (0.3.1)
76
- rack (1.2.2)
77
- rack-mount (0.6.14)
78
- rack (>= 1.0.0)
79
- rack-test (0.5.7)
80
- rack (>= 1.0)
81
- rails (3.0.7)
82
- actionmailer (= 3.0.7)
83
- actionpack (= 3.0.7)
84
- activerecord (= 3.0.7)
85
- activeresource (= 3.0.7)
86
- activesupport (= 3.0.7)
87
- bundler (~> 1.0)
88
- railties (= 3.0.7)
89
- railties (3.0.7)
90
- actionpack (= 3.0.7)
91
- activesupport (= 3.0.7)
92
- rake (>= 0.8.7)
93
- thor (~> 0.14.4)
94
- rake (0.8.7)
95
- rspec (2.5.0)
96
- rspec-core (~> 2.5.0)
97
- rspec-expectations (~> 2.5.0)
98
- rspec-mocks (~> 2.5.0)
99
- rspec-core (2.5.2)
100
- rspec-expectations (2.5.0)
101
- diff-lcs (~> 1.1.2)
102
- rspec-mocks (2.5.0)
103
- rspec-rails (2.5.0)
104
- actionpack (~> 3.0)
105
- activesupport (~> 3.0)
106
- railties (~> 3.0)
107
- rspec (~> 2.5.0)
108
- ruby-debug (0.10.4)
109
- columnize (>= 0.1)
110
- ruby-debug-base (~> 0.10.4.0)
111
- ruby-debug-base (0.10.4)
112
- linecache (>= 0.3)
113
- rubyzip (0.9.4)
114
- selenium-webdriver (0.2.2)
115
- childprocess (>= 0.1.9)
116
- ffi (>= 1.0.7)
117
- json_pure
118
- rubyzip
119
- sqlite3-ruby (1.2.5)
120
- term-ansicolor (1.0.5)
121
- thor (0.14.6)
122
- treetop (1.4.9)
123
- polyglot (>= 0.3.1)
124
- tzinfo (0.3.27)
125
- xpath (0.1.4)
126
- nokogiri (~> 1.3)
127
-
128
- PLATFORMS
129
- ruby
130
-
131
- DEPENDENCIES
132
- cucumber (~> 1.0.0)
133
- cucumber-rails (~> 1.0.0)
134
- rails (= 3.0.7)
135
- rspec (= 2.5.0)
136
- rspec-rails (= 2.5.0)
137
- ruby-debug (>= 0.10.3)
138
- spork!
139
- sqlite3-ruby (= 1.2.5)
@@ -1,177 +0,0 @@
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
-
5
- Background: Rails App with RSpec and Spork
6
-
7
- Given I am in a fresh rails project named "test_rails_project"
8
- And a file named "spec/spec_helper.rb" with:
9
- """
10
- require 'rubygems'
11
- require 'spork'
12
- require 'spork/ext/ruby-debug'
13
-
14
- Spork.prefork do
15
- require File.dirname(__FILE__) + '/../config/environment.rb'
16
- require 'rspec'
17
- require 'rspec/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
-
25
- Given the following code appears in "config/routes.rb" after /routes\.draw/:
26
- """
27
- resources :users
28
- """
29
- Given a file named "app/helpers/application_helper.rb" with:
30
- """
31
- require 'reverseatron'
32
- module ApplicationHelper
33
- include Reverseatron
34
- end
35
- """
36
- Given a file named "lib/reverseatron.rb" with:
37
- """
38
- module Reverseatron
39
- def reverse_text(txt)
40
- txt.reverse
41
- end
42
- end
43
- """
44
- Given a file named "app/controllers/users_controller.rb" with:
45
- """
46
- class UsersController < ApplicationController
47
- $loaded_stuff << 'UsersController'
48
- def index
49
- @users = []
50
- end
51
- end
52
- """
53
- Given a file named "app/helpers/misc_helper.rb" with:
54
- """
55
- module MiscHelper
56
- def misc_helper_method
57
- 'hello miscellaneous'
58
- end
59
- end
60
- """
61
- Given a file named "app/helpers/users_helper.rb" with:
62
- """
63
- module UsersHelper
64
- end
65
- """
66
- Given a file named "app/views/users/index.html.erb" with:
67
- """
68
- Original View
69
- """
70
- Scenario: respecting custom autoload paths
71
- Given the following code appears in "config/application.rb" after /class Application < Rails::Application/:
72
- """
73
- config.autoload_paths << 'app/models/non_standard'
74
- """
75
-
76
- And a file named "app/models/non_standard/boogie.rb" with:
77
- """
78
- class Boogie
79
- def boogie
80
- 'Boogie Robots!'
81
- end
82
- end
83
- """
84
- And a file named "spec/models/non_standard/boogie_spec.rb" with:
85
- """
86
- describe Boogie do
87
- it 'knows how to boogie' do
88
- Boogie.new.boogie.should include('Boogie')
89
- puts 'BOOGIE!!!'
90
- end
91
- end
92
- """
93
- When I fire up a spork instance with "spork rspec"
94
- And I run rspec --drb spec/models/non_standard/boogie_spec.rb
95
- Then the output should contain "BOOGIE!!!"
96
-
97
- Scenario: within a view rendered by a controller, calling helper methods from an included module in ApplicationHelper
98
- Given a file named "spec/controllers/users_controller_spec.rb" with:
99
- """
100
- require "spec_helper"
101
- describe UsersController do
102
- render_views
103
- it "renders a page, using a method inherited from ApplicationController" do
104
- get :index
105
- response.body.should_not include('Original View')
106
- puts "Views are not being cached when rendering from a controller"
107
-
108
- response.body.should include('listing users')
109
- puts "Controller stack is functioning when rendering from a controller"
110
-
111
- response.body.should include('hello miscellaneous')
112
- puts "All helper modules were included when rendering from a controller"
113
- end
114
- end
115
- """
116
- Given a file named "spec/views/index.html.erb_spec.rb" with:
117
- """
118
- require "spec_helper"
119
- describe "/users/index.html.erb" do
120
-
121
- it "renders the view" do
122
- render
123
- rendered.should_not include('Original View')
124
- puts "Views are not being cached when rendering directly"
125
-
126
- rendered.should include('listing users')
127
- puts "Controller stack is functioning when rendering directly"
128
-
129
- rendered.should include('hello miscellaneous')
130
- puts "All helper modules were included when rendering directly"
131
- end
132
- end
133
- """
134
- When I fire up a spork instance with "spork rspec"
135
- And the contents of "app/views/users/index.html.erb" are changed to:
136
- """
137
- <%= reverse_text('listing users'.reverse) %>
138
- <%= misc_helper_method rescue nil %>
139
- <p>Here is a list of users</p>
140
- """
141
-
142
- And I run rspec --drb spec/controllers/users_controller_spec.rb
143
- Then the output should contain "Controller stack is functioning when rendering from a controller"
144
- And the output should contain "Views are not being cached when rendering from a controller"
145
- And the output should contain "All helper modules were included when rendering from a controller"
146
-
147
- When I run rspec --drb spec/views/index.html.erb_spec.rb
148
- Then the output should contain "Controller stack is functioning when rendering directly"
149
- And the output should contain "Views are not being cached when rendering directly"
150
- And the output should contain "All helper modules were included when rendering directly"
151
-
152
- Given the contents of "app/helpers/application_helper.rb" are changed to:
153
- """
154
- module ApplicationHelper
155
- def make_it_loud(message)
156
- message.upcase
157
- end
158
- end
159
- """
160
- And the contents of "app/views/users/index.html.erb" are changed to:
161
- """
162
- <%= make_it_loud('listing users') %>
163
- """
164
- And the contents of "spec/controllers/users_controller_spec.rb" are changed to:
165
- """
166
- require "spec_helper"
167
- describe UsersController do
168
- render_views
169
- it "renders a page, using a method inherited from ApplicationController" do
170
- get :index
171
- response.body.should include('LISTING USERS')
172
- puts "Helpers aren't being cached"
173
- end
174
- end
175
- """
176
- When I run rspec --drb spec/controllers/users_controller_spec.rb
177
- Then the output should contain "Helpers aren't being cached"