Sha256: 57047b49c315da5791b1784decbba79b9a0b6ef4dff9e020576bc8d6cbc11ba4

Contents?: true

Size: 724 Bytes

Versions: 173

Compression:

Stored size: 724 Bytes

Contents

require 'spec_helper'

module OutputTest
  include Softcover::Output
  extend self

  def puts_hello
    puts 'hello'
  end

  def print_hello
    print 'hello'
  end

  def printf_hello
    print 'hello'
  end

  def system_cmd
    system "echo hello"
  end
end

describe Softcover::Output do
  before { Softcover::Output.unsilence! }

  it 'redirects output' do
    Softcover::Output.stream = $stderr
    $stderr.should_receive(:puts).with('hello')
    $stderr.should_receive(:print).twice.with('hello')

    OutputTest.puts_hello
    OutputTest.print_hello
    OutputTest.printf_hello
  end

  it 'redirects system command output' do
    Softcover::Output.stream.should_receive(:puts)
    OutputTest.system_cmd
  end
end

Version data entries

173 entries across 173 versions & 2 rubygems

Version Path
softcover-1.1.11 spec/output_spec.rb
softcover-1.1.10 spec/output_spec.rb
softcover-1.1.9 spec/output_spec.rb
softcover-1.1.8 spec/output_spec.rb
softcover-1.1.7 spec/output_spec.rb
softcover-1.1.6 spec/output_spec.rb
softcover-1.1.4 spec/output_spec.rb
softcover-1.1.3 spec/output_spec.rb
softcover-1.1.2 spec/output_spec.rb
softcover-1.1.1 spec/output_spec.rb
softcover-1.1.0 spec/output_spec.rb
softcover-1.1.beta2 spec/output_spec.rb
softcover-1.0.5 spec/output_spec.rb
softcover-1.1.beta1 spec/output_spec.rb
softcover-1.0.4 spec/output_spec.rb
softcover-1.0.3 spec/output_spec.rb
softcover-1.0.2 spec/output_spec.rb
softcover-1.0.1 spec/output_spec.rb
softcover-1.0.0 spec/output_spec.rb
softcover-1.0.beta17 spec/output_spec.rb