Sha256: 44ede074717895cee6ddfcda218cdc8371ace443e8e2f93dd50816ce2c64ec43

Contents?: true

Size: 538 Bytes

Versions: 4

Compression:

Stored size: 538 Bytes

Contents

require 'pork/executor'

module Kernel
  def should *args, &block
    stat = Thread.current.group.list.find{ |t| t[:pork_stat] }[:pork_stat]
    Pork::Expect.new(stat, self, *args, &block)
  end
end

module Pork
  module Should
    def execute mode, stat=Stat.new, *args
      thread = Thread.current
      original_group, group = thread.group, ThreadGroup.new
      group.add(thread)
      thread[:pork_stat] = stat
      super(mode, stat, *args)
    ensure
      original_group.add(thread)
    end
  end

  Executor.extend(Should)
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pork-1.2.3 lib/pork/more/should.rb
pork-1.2.2 lib/pork/more/should.rb
pork-1.2.1 lib/pork/more/should.rb
pork-1.2.0 lib/pork/more/should.rb