[rspec-users] rspec with CI

Esad Hajdarevic
2007-04-17T05:27:46Z

Hi Alex,

Alex Edwards wrote:
> I am trying to use rspec in conjunction with CruiseControlrb.
>
How are you running the specs? I''m using cruise.task in lib/tasks and
it
works perfectly.
Here it is:

(Note that it''s a bit complicated because we run firewatir specs too
that need some preparations)

task ''cruise'' do
  puts "This is cruise rake task running within the #{RAILS_ENV}
environment"

  Rake::Task[''db:migrate''].invoke
  Rake::Task[''db:test:clone_structure'']

  puts "Executing model specs.."
  Rake::Task[''spec:models''].invoke

  puts "Executing controller specs.."
  Rake::Task[''spec:controllers''].invoke

  puts "Loading fixtures to the database.."
  # load fixtures
  Rake::Task[''spec:db:fixtures:load''].invoke

  # restart server
  puts "Restarting server/FCGI.."
  puts `ruby #{File.dirname(__FILE__)+''/../../script/process/reaper -a
kill''}`

  begin
    start_firefox
    puts "Running spec:watir.."
    Rake::Task[''spec:watir''].invoke
  rescue
    raise "Watir spec failed!"
  ensure
    stop_firefox
  end
end

Greetings,

Esad