0

我正在尝试将 CruiseControl.rb(版本 2.0.0pre1)与 RSpec 一起用于我的 Ruby on Rails 3 应用程序。我的cruise_config.rb项目看起来像这样:

Project.configure do |project|
  project.rake_task = 'db:migrate db:test:prepare spec'
  project.scheduler.polling_interval = 1.hour
  project.scheduler.always_build = false
end

但是当我尝试使用 CruiseControl 运行构建时,它会说:

rake aborted!
Custom rake task(s) 'spec' not defined

Tasks: TOP => cc:build
(See full trace by running task with --trace)

它找不到运行 RSpec 测试的 spec rake 任务。我还尝试在我的内部定义一个自定义 rake 任务,Rakefile并删除了project.rake_task = 'db:migrate db:test:prepare spec'内部的行cruise_config.rb

desc "Custom Task for CruiseControl.rb"
task :cruise do
  puts "Custom Rake task"
  Rake::Task['db:migrate'].execute
  Rake::Task['db:test:prepare'].execute
  Rake::Task['spec'].execute
end

如果我这样做,CruiseControl 会说

rake aborted!
ActiveRecord::ConnectionNotEstablished

Tasks: TOP => cruise
(See full trace by running task with --trace)
[CruiseControl] Invoking Rake task "cruise"
Custom Rake task

有人有 CruiseControl.rb 与 RSpec 合作吗?

4

1 回答 1

4

确保您在 RSpec 2:spec中定义了任务Rakefile,它看起来像这样:

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)
于 2012-02-24T15:00:48.507 回答