Sha256: 5a8f98a9710b9a628b530e3fa339ea16a5c6d1585155eca21151f0c85ee620ee

Contents?: true

Size: 1.47 KB

Versions: 6

Compression:

Stored size: 1.47 KB

Contents

require File.dirname(__FILE__) + '/../unit_test_helper'
require 'ceedling/streaminator'
require 'ceedling/constants'


class StreaminatorTest < Test::Unit::TestCase

  def setup
    objects = create_mocks(:verbosinator, :stream_wrapper)
    @streaminator = Streaminator.new(objects)
  end

  def teardown
  end
  
  
  should "write to stdout & flush if sufficient verbosity level" do
    @verbosinator.expects.should_output?(Verbosity::OBNOXIOUS).returns(true)
    
    @stream_wrapper.expects.stdout_puts("Hey. You lookin at me??")
    @stream_wrapper.expects.stdout_flush

    @streaminator.stdout_puts("Hey. You lookin at me??", Verbosity::OBNOXIOUS)
  end

  should "not write to stdout or flush because insufficient verbosity level" do
    @verbosinator.expects.should_output?(Verbosity::NORMAL).returns(false)
    
    @streaminator.stdout_puts("Hey. You lookin at me??", Verbosity::NORMAL)
  end


  should "write to stderr & flush if sufficient verbosity level" do
    @verbosinator.expects.should_output?(Verbosity::ERRORS).returns(true)
    
    @stream_wrapper.expects.stderr_puts("Hey, yah. I'm lookin at you.")
    @stream_wrapper.expects.stderr_flush

    @streaminator.stderr_puts("Hey, yah. I'm lookin at you.", Verbosity::ERRORS)
  end

  should "not write to stderr or flush because insufficient verbosity level" do
    @verbosinator.expects.should_output?(Verbosity::NORMAL).returns(false)
    
    @streaminator.stderr_puts("Hey, yah. I'm lookin at you.", Verbosity::NORMAL)
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ceedling-0.25.0 test_graveyard/unit/busted/streaminator_test.rb
ceedling-0.24.0 test_graveyard/unit/busted/streaminator_test.rb
ceedling-0.22.0 test_graveyard/unit/busted/streaminator_test.rb
ceedling-0.21.0 test_graveyard/unit/busted/streaminator_test.rb
ceedling-0.20.3 test_graveyard/unit/busted/streaminator_test.rb
ceedling-0.20.2 test_graveyard/unit/busted/streaminator_test.rb