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-3.5.1.12 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.5 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.4.2 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.4 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.3 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.3.beta.4 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.3.beta.3 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.3.beta.2 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.3.beta.1 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.2 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.2.beta.7 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.2.beta.6 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.2.beta.5 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.2.beta.4 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.2.beta.3 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.2.beta.2 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.2.beta.1 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.1 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.0 lib/extensions/mspec/mspec/guards/tty.rb
rhodes-3.3.0.beta.3 lib/extensions/mspec/mspec/guards/tty.rb