【问题标题】:Rake test not working in Rails appRake 测试在 Rails 应用程序中不起作用
【发布时间】:2016-07-15 18:18:09
【问题描述】:

我试图在我的 Rails 库应用程序中运行 Minitests,当我运行 rake test 时,我收到一条错误消息 LoadError: cannot load such file -- rake/testtask

这是我的 rakefile:

require "bundler"
Bundler.setup

require 'rake/testtask'

desc 'Test the library.'
Rake::TestTask.new(:test) do |t|
  t.libs << 'lib' << 'test'
  t.pattern = 'test/**/*_test.rb'
  t.verbose = true
end

下面是我的gemfile:

source 'https://rubygems.org'

gemspec

gem 'minitest'
gem 'htmlentities'
gem 'aws-s3'
gem 'byebug', platforms: :mri
gem 'rake'

【问题讨论】:

  • 在命令行中使用rake --version 会得到什么?
  • @nikkypx,我得到rake, version 11.2.2

标签: ruby-on-rails ruby rake


【解决方案1】:

Rake 未加载。将gem 'rake' 添加到您的 Gemfile

【讨论】:

  • 不应该自动安装rake吗?我上传了我的 gemfile。
  • gem 'rake' 移动到源代码下方 Gemfile 的顶部,然后再试一次
  • 现在我收到一条错误消息gems/cliver-0.3.2/lib/cliver/dependency.rb:188: warning: instance variable @requirement not initialized
  • 这是一个新问题
猜你喜欢
  • 2012-10-21
  • 1970-01-01
  • 2015-07-05
  • 2017-07-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多