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-1.4.1 res/generators/templates/spec/app/mspec/guards/tty.rb
rhodes-1.4.0 res/generators/templates/spec/app/mspec/guards/tty.rb
rhodes-1.4.0 spec/framework_spec/app/mspec/guards/tty.rb
mspec-1.5.16 lib/mspec/guards/tty.rb
mspec-1.5.15 lib/mspec/guards/tty.rb
mspec-1.5.14 lib/mspec/guards/tty.rb
mspec-1.5.13 lib/mspec/guards/tty.rb
rhodes-1.2.2 spec/app/mspec/guards/tty.rb
rhodes-framework-1.2.1 spec/app/mspec/guards/tty.rb
rhodes-framework-1.2.0 spec/app/mspec/guards/tty.rb
mspec-1.5.10 lib/mspec/guards/tty.rb
mspec-1.5.12 lib/mspec/guards/tty.rb
mspec-1.5.11 lib/mspec/guards/tty.rb
rhodes-framework-1.1.0 spec/app/mspec/guards/tty.rb
rhodes-framework-1.1.1 spec/app/mspec/guards/tty.rb