Class: RStack::RSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/rstack/tasks/rspec.rb

Class Method Summary collapse

Class Method Details

.define_tasks(configuration) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rstack/tasks/rspec.rb', line 3

def self.define_tasks(configuration)
  ::Spec::Rake::SpecTask.new do |t|        
    t.spec_opts = if File.exist?('spec/spec.opts')
      ['-O', 'spec/spec.opts' ]
    else
      ['--format', 'specdoc', '--diff', '--color']
    end
    t.spec_files = configuration.spec_files
  end
  
  desc "Run specs through RCov and generate HTML reports"
  ::Spec::Rake::SpecTask.new('spec:with_coverage') do |t|
    t.rcov_dir      = File.join(configuration.outpath, 'coverage')
    t.spec_files    = configuration.spec_files
    t.spec_opts     = ["--format", "html:#{configuration.outpath}/spec_report.html", "--diff"]
    t.fail_on_error = false
    t.rcov          = true
    t.rcov_opts << '--no-rcovrt' # required or rcov will fail
  end      
end