class GemOf::TestTasks

unit testing tasks

Public Class Methods

new() click to toggle source

instance unit tasks in namespace :test @api public @example TestTasks.new

# File lib/gem_of/rake_tasks.rb, line 201
def initialize
  namespace :test do
    begin
      # this will produce the 'test:spec' task
      require "rspec/core/rake_task"
      desc "Run unit tests"
      RSpec::Core::RakeTask.new do |t|
        t.rspec_opts = ["--color"]
        t.pattern = ENV["SPEC_PATTERN"]
      end
      # if rspec isn't available, we can still use this Rakefile
      # rubocop:disable Lint/HandleExceptions
    rescue LoadError
    end

    task spec: [:check_spec]

    desc "" # empty description so it doesn't show up in rake -T
    rototiller_task :check_spec do |t|
      t.add_env(name: "SPEC_PATTERN", default: "spec/",
                message: "The pattern RSpec will use to find tests")
    end
  end
end