I have a rake task for a series of rspecs as follows...
require 'spec/rake/spectask'
require 'joliscrapper'
namespace :spec do
desc "Web scraping files"
task :scrapers => :environment do
Spec::Rake::SpecTask.new do |t|
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
t.spec_files = FileList['spec/scrapers/*_spec.rb']
puts t
end
end
end
My question is how to get out put as usual from an Rspec... now it outputs nothing... I'd like to find any errors and generate an email if one occu开发者_StackOverflowrs.
adding:
t.warning = true
t.verbose = true
does't seem to have the desired effect either.
http://rspec.rubyforge.org/rspec/1.1.12/classes/Spec/Rake/SpecTask.html
Your code as written will create the spec task when rake spec:scrapers
is called and be finished, which isn't what you want I think.
Try:
namespace :spec do
desc "Web scraping files"
Spec::Rake::SpecTask.new :scrapers do |t| #creates the spec task with the name :scrapers
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
t.spec_files = FileList['spec/scrapers/*_spec.rb']
end
task :scrapers => :environment #adds environment as a prereq
end
精彩评论