Sha256: eb81fcbbab711833d2d923302d4843a41e407306fc136971b81e70ef170c6fa5

Contents?: true

Size: 367 Bytes

Versions: 175

Compression:

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

Version data entries

175 entries across 151 versions & 4 rubygems

Version Path
rhodes-5.5.18 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-5.5.17 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-5.5.15 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-5.5.0.22 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-5.5.2 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-5.5.0.7 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-5.5.0.3 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-5.5.0 lib/extensions/mspec/mspec/guards/tty.rb
tauplatform-1.0.3 lib/extensions/mspec/mspec/guards/tty.rb
mspec-1.9.1 lib/mspec/guards/tty.rb
mspec-1.9.0 lib/mspec/guards/tty.rb
tauplatform-1.0.2 lib/extensions/mspec/mspec/guards/tty.rb
tauplatform-1.0.1 lib/extensions/mspec/mspec/guards/tty.rb
mspec-1.8.0 lib/mspec/guards/tty.rb
mspec-1.7.0 lib/mspec/guards/tty.rb
mspec-1.6.0 lib/mspec/guards/tty.rb
mspec-1.5.21 lib/mspec/guards/tty.rb
mspec-1.5.20 lib/mspec/guards/tty.rb
mspec-1.5.19 lib/mspec/guards/tty.rb
mspec-1.5.18 lib/mspec/guards/tty.rb