Sha256: 2e2d4ac5165ac739ede818131f05465ea1b7e8c1ff13cd75deb706f6c644fa5a

Contents?: true

Size: 757 Bytes

Versions: 4

Compression:

Stored size: 757 Bytes

Contents

require 'generative'
require 'rspec/core/rake_task'

module Generative
  class RakeTask < RSpec::Core::RakeTask
    def initialize(*args, &task_block)
      super

      self.name = :generative if name == :spec

      desc "Run Generative specs" unless Rake.application.last_comment

      options = %w[
        --require generative
        --format Generative::Formatter
        --tag generative
      ]

      self.rspec_opts = options.join(' ')

      task name, *args do |_, task_args|
        RakeFileUtils.send(:verbose, verbose) do
          ENV['GENERATIVE_COUNT'] ||= Generative::DEFAULT_COUNT
          task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
          run_task verbose
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
generative-0.2.3 lib/generative/rake_task.rb
generative-0.2.2 lib/generative/rake_task.rb
generative-0.2.0 lib/generative/rake_task.rb
generative-0.2.0.pre3 lib/generative/rake_task.rb