Sha256: 8ca77790797184877e68c9f5b044327b5fa227ee4bea2233eb75ce419491d503

Contents?: true

Size: 1.53 KB

Versions: 9

Compression:

Stored size: 1.53 KB

Contents

require "rspec/core/rake_task"
require "rake/clean"

CLOBBER.include("coverage", "specdoc")

namespace :spec do
  RSpec::Core::RakeTask.new(:rcov) do |t|
    t.pattern = FileList['spec/**/*_spec.rb']
    t.rspec_opts = ['--color', '--format', 'documentation']

    t.rcov_opts = [
      '--exclude', 'lib\\/compat',
      '--exclude', 'spec',
      '--exclude', '\\.rvm\\/gems',
      '--exclude', '1\\.8\\/gems',
      '--exclude', '1\\.9\\/gems',
      '--exclude', '\\.rvm',
      '--exclude', '\\/Library\\/Ruby'
    ]
  end

  RSpec::Core::RakeTask.new(:normal) do |t|
    t.pattern = FileList['spec/**/*_spec.rb'].exclude(/compat/)
    t.rspec_opts = ['--color', '--format', 'documentation']
  end

  RSpec::Core::RakeTask.new(:all) do |t|
    t.pattern = FileList['spec/**/*_spec.rb']
    t.rspec_opts = ['--color', '--format', 'documentation']
  end

  desc "Generate HTML Specdocs for all specs"
  RSpec::Core::RakeTask.new(:specdoc) do |t|
    specdoc_path = File.expand_path(
      File.join(File.dirname(__FILE__), '..', 'documentation')
    )
    Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)

    output_file = File.join(specdoc_path, 'index.html')
    t.pattern = FileList['spec/**/*_spec.rb']
    t.rspec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
    t.fail_on_error = false
  end

  namespace :rcov do
    desc "Browse the code coverage report."
    task :browse => "spec:rcov" do
      require "launchy"
      Launchy::Browser.run("coverage/index.html")
    end
  end
end

desc "Alias to spec:normal"
task "spec" => "spec:normal"

Version data entries

9 entries across 9 versions & 5 rubygems

Version Path
uuidtools-3.0.0 tasks/rspec.rake
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/uuidtools-2.2.0/tasks/rspec.rake
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/uuidtools-2.2.0/tasks/rspec.rake
uuidtools-2.2.0 tasks/rspec.rake
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/uuidtools-2.1.5/tasks/rspec.rake
vagrant-cloudstack-1.2.0 vendor/bundle/gems/uuidtools-2.1.5/tasks/rspec.rake
vagrant-cloudstack-1.1.0 vendor/bundle/gems/uuidtools-2.1.5/tasks/rspec.rake
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/uuidtools-2.1.5/tasks/rspec.rake
uuidtools-2.1.5 tasks/rspec.rake