RSpec Rake file and no such file to load -- rake/tasklib
I'm trying to write a spec rake task to load bundler, but regardless of loading bundler or not I get:
no such file to load -- rake/tasklib
Below is the Rakefile
require 'rake'
require "rubygems"
require "bundler"
Bundler.setup(:default, :test)
task :spec do
beg开发者_StackOverflow社区in
require 'rspec/core/rake_task'
desc "Run the specs under spec/"
RSpec::Core::RakeTask.new do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
end
rescue NameError, LoadError => e
puts e
end
end
It seems the culprit is require 'rspec/core/rake_task'
Any advice?
I can still run my specs by using rspec spec
or bundle exec rspec spec
but I would prefer to use a rake task for this.
Doh!
Ok, pretty straight forward. Bundler's purpose is to isolate your app's Gems.
gem 'rake'
Thats all that was needed in the Gemfile
精彩评论