Sha256: fd31f8802e43c0d2434b2a704e383673eed5818057b29e14ccbe375c50fd2124

Contents?: true

Size: 335 Bytes

Versions: 4

Compression:

Stored size: 335 Bytes

Contents

require 'mspec/guards/guard'

# If a spec depends on STDOUT being a tty, use this guard. For specs that may
# block if run as a background process, see BackgroundGuard.

class TTYGuard < SpecGuard
  def match?
    STDOUT.tty?
  end
end

class Object
  def with_tty
    g = TTYGuard.new
    yield if g.yield?
    g.unregister
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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