Sha256: fed64c3e06bd528a08bddda70b7ac5eccd95d60f3ddff6b013d82a88405f005a

Contents?: true

Size: 977 Bytes

Versions: 5

Compression:

Stored size: 977 Bytes

Contents

require 'pork/executor'

module Pork
  module API
    module_function
    def before █ Executor.before(&block); end
    def after  █ Executor.after( &block); end
    def copy     desc=:default, █ Executor.copy(    desc, &block); end
    def paste    desc=:default, *args ; Executor.paste(   desc, *args ); end
    def describe desc=:default, &suite; Executor.describe(desc, &suite); end
    def would    desc=:default, &test ; Executor.would(   desc, &test ); end
  end

  # default to :execute while eliminating warnings for uninitialized ivar
  def self.execute_mode execute=nil
    @execute = execute || @execute ||= :execute
  end

  def self.autorun auto=true
    @auto = auto
    @autorun ||= at_exit do
      next unless @auto
      require "pork/mode/#{execute_mode}" unless execute_mode == :execute
      stat = Executor.public_send(execute_mode)
      stat.report
      exit stat.failures.size + stat.errors.size + ($! && 1).to_i
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pork-1.0.4 lib/pork.rb
pork-1.0.3 lib/pork.rb
pork-1.0.2 lib/pork.rb
pork-1.0.1 lib/pork.rb
pork-1.0.0 lib/pork.rb