RSpec Rake 文件并且没有要加载的此类文件 -- rake/tasklib
我正在尝试编写一个规范 rake 任务来加载捆绑器,但无论是否加载捆绑器,我都会得到:
no such file to load -- rake/tasklib
下面是 Rakefile
require 'rake'
require "rubygems"
require "bundler"
Bundler.setup(:default, :test)
task :spec do
begin
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
看来罪魁祸首是 require 'rspec/core/rake_task'
任何建议?
我仍然可以使用 rspec spec
或 bundle exec rspec spec
来运行我的规范,但我更愿意为此使用 rake 任务。
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
begin
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哎哟!
好的,非常简单。 Bundler 的目的是隔离应用程序的 Gem。
这就是 Gemfile 中所需的全部内容
Doh!
Ok, pretty straight forward. Bundler's purpose is to isolate your app's Gems.
Thats all that was needed in the Gemfile