Sha256: b85fb1d0f3980ecdbe4c05f9df0b12cdd096fb8efe9ab0b174b13e52a3e1df04

Contents?: true

Size: 529 Bytes

Versions: 5

Compression:

Stored size: 529 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'mspec/guards/tty'

describe Object, "#with_tty" do
  before :each do
    ScratchPad.clear
  end

  it "yields if STDOUT is a TTY" do
    STDOUT.should_receive(:tty?).and_return(true)
    with_tty { ScratchPad.record :yield }
    ScratchPad.recorded.should == :yield
  end

  it "does not yield if STDOUT is not a TTY" do
    STDOUT.should_receive(:tty?).and_return(false)
    with_tty { ScratchPad.record :yield }
    ScratchPad.recorded.should_not == :yield
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mspec-1.5.6 spec/guards/tty_spec.rb
mspec-1.5.9 spec/guards/tty_spec.rb
mspec-1.5.5 spec/guards/tty_spec.rb
mspec-1.5.7 spec/guards/tty_spec.rb
mspec-1.5.8 spec/guards/tty_spec.rb