spork 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -51,7 +51,7 @@ module Spork
51
51
  def expanded_caller(caller_line)
52
52
  file, line = caller_line.split(":")
53
53
  line.gsub(/:.+/, '')
54
- File.expand_path(Dir.pwd, file) + ":" + line
54
+ File.expand_path(file, Dir.pwd) + ":" + line
55
55
  end
56
56
 
57
57
  def trap_method(klass, method_name)
@@ -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
- # spec/rails is very aggressive about overriding RAILS_ENV and will switch it back to test after the cucumber env was loaded
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
@@ -55,4 +55,8 @@ describe Spork do
55
55
  Spork.each_run { }
56
56
  spec_helper_simulator.should == [:prefork, :each_run]
57
57
  end
58
+
59
+ it "expands a caller line, preserving the line number" do
60
+ Spork.expanded_caller("/boo/../yah.rb:31").should == "/yah.rb:31"
61
+ end
58
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Harper