spork 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,7 @@ Feature: Cucumber integration with rails
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
+
($loaded_stuff ||= []) << 'prefork block'
|
37
38
|
end
|
38
39
|
|
39
40
|
Spork.each_run do
|
@@ -42,6 +43,7 @@ Feature: Cucumber integration with rails
|
|
42
43
|
Cucumber::Rails.use_transactional_fixtures
|
43
44
|
Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
|
44
45
|
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
|
46
|
+
($loaded_stuff ||= []) << 'each_run block'
|
45
47
|
end
|
46
48
|
"""
|
47
49
|
And a file named "features/cucumber_rails.feature" with:
|
@@ -65,6 +67,8 @@ Feature: Cucumber integration with rails
|
|
65
67
|
$loaded_stuff.should include('ApplicationHelper')
|
66
68
|
$loaded_stuff.should include('config/routes.rb')
|
67
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')
|
68
72
|
puts "It worked!"
|
69
73
|
end
|
70
74
|
"""
|
@@ -15,11 +15,13 @@ Feature: Rails Integration
|
|
15
15
|
Spork.prefork do
|
16
16
|
ENV["RAILS_ENV"] = "testeroni"
|
17
17
|
$run_phase = :prefork
|
18
|
+
($loaded_stuff ||= []) << 'prefork block'
|
18
19
|
require File.dirname(__FILE__) + '/../config/environment.rb'
|
19
20
|
end
|
20
21
|
|
21
22
|
Spork.each_run do
|
22
23
|
$run_phase = :each_run
|
24
|
+
($loaded_stuff ||= []) << 'each_run block'
|
23
25
|
puts "I'm loading the stuff just for this run..."
|
24
26
|
end
|
25
27
|
|
@@ -54,6 +56,8 @@ Feature: Rails Integration
|
|
54
56
|
$loaded_stuff.should include('UserObserver')
|
55
57
|
$loaded_stuff.should include('ApplicationHelper')
|
56
58
|
$loaded_stuff.should include('config/routes.rb')
|
59
|
+
$loaded_stuff.should include('each_run block')
|
60
|
+
$loaded_stuff.should include('prefork block')
|
57
61
|
puts "Specs successfully run within spork, and all initialization files were loaded"
|
58
62
|
end
|
59
63
|
end
|
data/lib/spork.rb
CHANGED
@@ -63,7 +63,7 @@ class Spork::AppFramework::Rails < Spork::AppFramework
|
|
63
63
|
def auto_reestablish_db_connection
|
64
64
|
if Object.const_defined?(:ActiveRecord)
|
65
65
|
Spork.each_run do
|
66
|
-
#
|
66
|
+
# rails lib/test_help.rb is very aggressive about overriding RAILS_ENV and will switch it back to test after the cucumber env was loaded
|
67
67
|
reset_rails_env
|
68
68
|
ActiveRecord::Base.establish_connection
|
69
69
|
end
|
data/spec/spork_spec.rb
CHANGED