ruby - bundle exec rake test 什么都不做

标签 ruby tdd bundler rake-task

我正试图让我的头脑“弄脏”TDD,但出于某种原因,当我在命令行上运行 bundle exec rake test 时,没有任何反应。

这是我的 RakeFile:

require 'rake/testtask'

Rake::TestTask.new do |test|
  test.libs << 'test'
end

desc "Run Tests"
task :default => :test

这是我的测试文件:

require 'test/unit'

class TestMygem < Test::Unit::TestCase
  def test_silly_example
    assert_equal 2+2, 5
  end
end

最佳答案

我忘了将这一行添加到我的 RakeFile

test.test_files = FileList['tests/test_*.rb']

总而言之,这是我的最终RakeFile

require 'rake/testtask'

Rake::TestTask.new(:test) do |test|
  test.libs << 'test'
  test.test_files = FileList['tests/test_*.rb']
end

desc "Run Tests"
task :default => :test

关于ruby - bundle exec rake test 什么都不做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14362944/

相关文章:

javascript - Rails 4 ExecJS::Listings#index 中的程序错误

ios - 如何测试在 viewcontroller 单元测试中设置私有(private)变量的方法?

ios - 无法在 IOS 上运行简单的 React Native 项目 fatal error 'config.h' 打印条目 'CFBundleIndentifier' 不存在

ruby-on-rails - ruby/ruby on rails 内存泄漏检测

ruby - 使用散列从数组中获取值的更优雅/更短的方法?

ruby - 在 $USER 中使用空间安装 RVM

c# - TDD 是否意味着不考虑类设计?

c# - 逐步的功能测试自动化

ruby-on-rails - 在 Gemfile 中使用 'gemspec' 时,我该怎么做 :require => 'foo'

bundler 错误消息 "Revision master does not exist in the repository"