【问题标题】:run rspec while running test/unit tests在运行测试/单元测试时运行 rspec
【发布时间】:2012-11-28 12:43:33
【问题描述】:

在我们当前的应用程序中,我们只运行 Test::Unit 测试。所以我们执行rake test 并运行所有被测测试。 我也在添加一个 rspec 目录,我希望 rspecs 在我执行 rake test 时运行,而不是手动执行 rspec spec。

知道如何在rake test 下将两者结合起来吗?

我们在宝石下有我们的TestTask,例如vendor/gems/shoulda-2.10.3/Rakefile:Rake::TestTask.new do |t| ...

在application.rb 我们有

config.generators do |g|
  g.test_framework :shoulda
  g.fallbacks[:shoulda] = :test_unit
  g.fixture_replacement :factory_girl
end

【问题讨论】:

    标签: ruby-on-rails ruby rspec


    【解决方案1】:

    在 Rakefile 中添加以下行,当您执行 rake test 时,它将运行 spec 和 test 任务

    task :test => :spec
    

    【讨论】:

      【解决方案2】:

      RSpec 实际上可以为您运行您的 Test::Unit 案例,只需 require 'spec/test/unit'

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-31
        相关资源
        最近更新 更多