我正在尝试将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任务。我还尝试在Rakefile
内定义自定义rake任务,并删除了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合作?
答案 0 :(得分:4)
确保您在:spec
中定义了Rakefile
任务,对于RSpec 2,它看起来像这样:
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)