Thoughts Heap

A Blog by Roman Gonzalez.-

RSS
Mar
7th
Sat
permalink

Creating custom Spec Rake tasks

Normally I always finding myself looking at the rSpec rdoc’s files, just to check out how do I do to create my customs tasks for executing rSpec code.

In the first place, you will need to use the Spec::Rake::SpecTask class. This class receives some configuration directives on the constructor block method. The parameters of the constructor is the name of the task, followed by it’s dependencies (Just like a normal task invocation).

 
Spec::Rake::SpecTask.new(:task_name => [:some, :dependencies]) do |t|
  t.spec_opts = ['--options', File.dirname(__FILE__) + '/spec/spec.opts']
  t.spec_files = FileList["spec/special_dir/**/*_spec.rb"] 
end

There are other options that can be found here

blog comments powered by Disqus