Sha256: 1fab2d9e830c4132e604942c9ffe710526c12c0237c7215792e7a2e2ab411398

Contents?: true

Size: 441 Bytes

Versions: 175

Compression:

Stored size: 441 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
    g.name = :process_is_foreground
    yield if g.yield? true
  ensure
    g.unregister
  end
end

Version data entries

175 entries across 151 versions & 4 rubygems

Version Path
rhodes-1.4.1 spec/framework_spec/app/mspec/guards/background.rb
rhodes-1.4.0 spec/framework_spec/app/mspec/guards/background.rb
rhodes-1.4.0 res/generators/templates/spec/app/mspec/guards/background.rb
mspec-1.5.16 lib/mspec/guards/background.rb
mspec-1.5.15 lib/mspec/guards/background.rb
mspec-1.5.14 lib/mspec/guards/background.rb
mspec-1.5.13 lib/mspec/guards/background.rb
rhodes-1.2.2 spec/app/mspec/guards/background.rb
rhodes-framework-1.2.1 spec/app/mspec/guards/background.rb
rhodes-framework-1.2.0 spec/app/mspec/guards/background.rb
mspec-1.5.11 lib/mspec/guards/background.rb
mspec-1.5.10 lib/mspec/guards/background.rb
mspec-1.5.12 lib/mspec/guards/background.rb
rhodes-framework-1.1.1 spec/app/mspec/guards/background.rb
rhodes-framework-1.1.0 spec/app/mspec/guards/background.rb