Skip to content

Instantly share code, notes, and snippets.

@indirect
Created October 9, 2011 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indirect/8f59bedcd961c3da1c28 to your computer and use it in GitHub Desktop.
Save indirect/8f59bedcd961c3da1c28 to your computer and use it in GitHub Desktop.
rspec doesn't need bundle exec
# Gemfile with just rspec and rack in it
$ cat Gemfile
gem "rspec"
gem "rack"
# Rakefile with RSpec set to skip bundler
$ cat Rakefile
require 'bundler/setup'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |s|
s.skip_bundler = true
end
# Show the ENV and try to require one bundled gem and one non-bundled gem
$ cat spec/bundled_spec.rb
puts "RUBYOPT", ENV["RUBYOPT"].inspect
puts "BUNDLE_GEMFILE", ENV["BUNDLE_GEMFILE"].inspect
puts "requiring rack..."
puts require('rack').inspect
puts "requiring json..."
puts require('json').inspect
# Run the spec (alternatively, this could be `bundle exec rake` and the Rakefile wouldn't need to invoke Bundler)
$ rake spec
(in /Users/andre/sw/gems/bundler-testcases/dchelimsky)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -S rspec ./spec/bundled_spec.rb
RUBYOPT
"-I/Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib -rbundler/setup"
BUNDLE_GEMFILE
"/Users/andre/sw/gems/bundler-testcases/dchelimsky/Gemfile"
requiring rack...
true
requiring json...
/Users/andre/sw/gems/bundler-testcases/dchelimsky/spec/bundled_spec.rb:7:in `require': no such file to load -- json (LoadError)
from /Users/andre/sw/gems/bundler-testcases/dchelimsky/spec/bundled_spec.rb:7
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `map'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in `load_spec_files'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/command_line.rb:18:in `run'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:80:in `run_in_process'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:69:in `run'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.6.4/lib/rspec/core/runner.rb:11:in `autorun'
from /Library/Ruby/Gems/1.8/bin/rspec:19
rake aborted!
ruby -S rspec ./spec/bundled_spec.rb failed
(See full trace by running task with --trace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment