Skip to content

Commit

Permalink
Support cucumber 1.3.2 and rspec 2.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sahilm committed Jul 6, 2013
1 parent ae2022e commit 38ab44f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
gemspec
gem 'cucumber', '~> 1.0.0'
gem 'rspec', '~> 2.8'
gem 'cucumber', '~>1.3.2'
gem 'rspec', '~>2.13.0'
gem 'rake'
gem "spork", :path => File.expand_path("../", __FILE__)

Expand Down
42 changes: 20 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,39 @@ PATH
GEM
remote: https://rubygems.org/
specs:
builder (3.0.0)
builder (3.2.2)
columnize (0.3.6)
cucumber (1.0.6)
cucumber (1.3.2)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.4.18)
json (>= 1.4.6)
term-ansicolor (>= 1.0.6)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12.0)
multi_json (~> 1.3)
debugger (1.6.0)
columnize (>= 0.3.1)
debugger-linecache (~> 1.2.0)
debugger-ruby_core_source (~> 1.2.1)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.2.3)
diff-lcs (1.1.3)
gherkin (2.4.21)
json (>= 1.4.6)
json (1.6.5)
rake (0.9.2.2)
rspec (2.8.0)
rspec-core (~> 2.8.0)
rspec-expectations (~> 2.8.0)
rspec-mocks (~> 2.8.0)
rspec-core (2.8.0)
rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.8.0)
term-ansicolor (1.0.7)
diff-lcs (1.2.4)
gherkin (2.12.0)
multi_json (~> 1.3)
multi_json (1.7.7)
rake (10.1.0)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)

PLATFORMS
ruby

DEPENDENCIES
cucumber (~> 1.0.0)
cucumber (~> 1.3.2)
debugger
rake
rspec (~> 2.8)
rspec (~> 2.13.0)
spork!
10 changes: 7 additions & 3 deletions features/support/spork_world.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ def run(command)
stderr_file = Tempfile.new('spork')
stderr_file.close
in_current_dir do
gemfile = ENV['BUNDLE_GEMFILE']
Bundler.with_clean_env do
ENV['BUNDLE_GEMFILE'] = gemfile
if command.start_with?("rails new")
@last_stdout = `bundle exec #{command} 2> #{stderr_file.path}`
else
gemfile = ENV['BUNDLE_GEMFILE']
Bundler.with_clean_env do
ENV['BUNDLE_GEMFILE'] = gemfile
@last_stdout = `bundle exec #{command} 2> #{stderr_file.path}`
end
end
@last_exit_status = $?.exitstatus
end
Expand Down
14 changes: 8 additions & 6 deletions lib/spork/forker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# sleep 3
# "success"
# end
#
#
# forker.result # => "success"
class Spork::Forker

# Raised if the fork died (was killed) before it sent it's response back.
class ForkDiedException < Exception; end
def initialize(&block)
Expand All @@ -23,16 +23,18 @@ def initialize(&block)
master_response = Marshal.load(@child_io)
rescue EOFError
nil
rescue SystemExit => e
puts "Error: exit code #{e.status}" unless e.status == 0
rescue Exception => e
puts "Exception encountered: #{e.inspect}\nbacktrace:\n#{e.backtrace * %(\n)}"
end

# terminate, skipping any at_exit blocks.
exit!(0)
end
@child_io.close
end

# Wait for the fork to finish running, and then return its return value.
#
# If the fork was aborted, then result returns nil.
Expand All @@ -52,7 +54,7 @@ def result
@child_pid = nil
@result
end

# abort the current running fork
def abort
if running?
Expand All @@ -61,7 +63,7 @@ def abort
true
end
end

def running?
return false unless @child_pid
Process.getpgid(@child_pid)
Expand Down

0 comments on commit 38ab44f

Please sign in to comment.