Permalink
Browse files

Run cucumber in context of bundle when shelling out.

  • Loading branch information...
dchelimsky committed Jul 10, 2010
1 parent 26ea38f commit 298e9c3287e9a78d5529772e2cafdf5f8861b734
Showing with 13 additions and 32 deletions.
  1. +13 −13 Rakefile
  2. +0 −19 features/support/env.rb
View
@@ -3,7 +3,10 @@ Bundler.setup
$LOAD_PATH << File.expand_path("../lib", __FILE__)
require 'rake'
+require 'rake/rdoctask'
require 'rspec/expectations/version'
+require 'rspec/core/rake_task'
+require 'cucumber/rake/task'
begin
require 'jeweler'
@@ -40,25 +43,22 @@ namespace :gem do
end
end
-begin
- require 'rspec/core/rake_task'
- RSpec::Core::RakeTask.new(:spec)
-rescue LoadError
- puts "RSpec core or one of its dependencies is not installed. Install it with: gem install rspec-core"
-end
+RSpec::Core::RakeTask.new(:spec)
-begin
- require 'cucumber/rake/task'
- Cucumber::Rake::Task.new do |t|
- t.cucumber_opts = %w{--format progress}
+class Cucumber::Rake::Task::ForkedCucumberRunner
+ # When cucumber shells out, we still need it to run in the context of our
+ # bundle.
+ def run
+ sh "bundle exec #{RUBY} " + args.join(" ")
end
-rescue LoadError
- puts "Cucumber or one of its dependencies is not installed. Install it with: gem install cucumber"
+end
+
+Cucumber::Rake::Task.new do |t|
+ t.cucumber_opts = %w{--format progress}
end
task :default => [:check_dependencies, :spec, :cucumber]
-require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
if File.exist?('VERSION.yml')
config = YAML.load(File.read('VERSION.yml'))
View
@@ -1,20 +1 @@
-require 'bundler'
-Bundler.setup
-
require 'aruba'
-require 'rspec/expectations'
-
-module ArubaOverrides
- def detect_ruby_script(cmd)
- if cmd =~ /^rspec /
- "bundle exec ../../../rspec-core/bin/#{cmd}"
- elsif cmd =~ /^ruby /
- "bundle exec #{cmd}"
- else
- super(cmd)
- end
- end
-end
-
-World(ArubaOverrides)
-

0 comments on commit 298e9c3

Please sign in to comment.