Sha256: 1cd9a9c80e3ea4d6bfa8897020e1e4c7ec4bbd50ea22c9ed2507c9fb8f9a6863

Contents?: true

Size: 588 Bytes

Versions: 1

Compression:

Stored size: 588 Bytes

Contents

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 stat=Stat.new, *args
      thread = Thread.current
      original_group, group = thread.group, ThreadGroup.new
      original_stat = thread[:pork_stat]
      group.add(thread)
      thread[:pork_stat] = stat
      super(stat, *args)
    ensure
      thread[:pork_stat] = original_stat
      original_group.add(thread)
    end
  end

  execute_extensions << Should
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pork-2.0.0 lib/pork/more/should.rb