[rspec-users] rspec with CI

Alex Edwards alex.edwards at workingmouse.com
Tue Apr 17 04:14:33 EDT 2007


I think I tracked it down.  It seems like the:
 t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]

was causing my spec.opts to be read, and the use of --drb in my 
spec.opts resulted in spec failures not causing build failures.  Not 
sure why??

I fixed it by writing my own rake task that did not set any spec opts
desc "run specs"
Spec::Rake::SpecTask.new('my_specs') do |t|
#  t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
  t.spec_files = FileList['spec/**/*_spec.rb']
end


Now my build fails when it is supposed to.  I guess it is not so 
important if I don't use --drb on my build server, as performance there 
is not really an issue.

Any further thoughts?

Esad Hajdarevic wrote:
> 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
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070417/28c4f646/attachment-0001.html 


More information about the rspec-users mailing list