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.10.5 spec/output_spec.rb
softcover-1.10.4 spec/output_spec.rb
softcover-1.10.3 spec/output_spec.rb
softcover-1.10.2 spec/output_spec.rb
softcover-1.10.1 spec/output_spec.rb
softcover-1.10.0 spec/output_spec.rb
softcover-1.9.1 spec/output_spec.rb
softcover-1.9.0 spec/output_spec.rb
softcover-1.8.3 spec/output_spec.rb
softcover-1.8.2 spec/output_spec.rb
softcover-1.8.1 spec/output_spec.rb
softcover-1.8.0 spec/output_spec.rb
softcover-1.7.5 spec/output_spec.rb
softcover-1.7.4 spec/output_spec.rb
softcover-1.7.3 spec/output_spec.rb
softcover-1.7.2 spec/output_spec.rb
softcover-1.7.1 spec/output_spec.rb
softcover-1.7.0 spec/output_spec.rb
softcover-1.6.5 spec/output_spec.rb
softcover-1.6.4 spec/output_spec.rb