Sha256: 10d4dc781ae8c1a5c94c2bacb398df91c522797a98858182e82a1ce0e0775873

Contents?: true

Size: 396 Bytes

Versions: 4

Compression:

Stored size: 396 Bytes

Contents

require 'mspec/guards/guard'

# Some specs, notably those for Readline, will block under certain
# circumstances when run as background or subprocesses. Use this guard for
# such specs.

class BackgroundGuard < SpecGuard
  def match?
    MSpec.mode? :background
  end
end

class Object
  def process_is_foreground
    g = BackgroundGuard.new
    yield if g.yield? true
    g.unregister
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mspec-1.5.6 lib/mspec/guards/background.rb
mspec-1.5.7 lib/mspec/guards/background.rb
mspec-1.5.8 lib/mspec/guards/background.rb
mspec-1.5.9 lib/mspec/guards/background.rb