Question

I'm trying to use CruiseControl.rb (ver. 2.0.0pre1) with RSpec for my Ruby on Rails 3 app. The cruise_config.rb for my project looks like this:

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

But when I try to run a build with CruiseControl, it says:

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

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

It can't find the spec rake task to run the RSpec tests. I also tried to define a custom rake task inside my Rakefile and removed the project.rake_task = 'db:migrate db:test:prepare spec' line inside the 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

If i do so, CruiseControl says

rake aborted!
ActiveRecord::ConnectionNotEstablished

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

Does anybody have CruiseControl.rb working with RSpec?

Was it helpful?

Solution

Ensure that you have the :spec task defined in your Rakefile, for RSpec 2, it looks like this:

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top