Sha256: 83c2fe3e649346333159a28f4c97c46a55f318eb9ea19994ab53fdd4409be6e2

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class LogFileTest < Test::Unit::TestCase
  include SproutTestCase

  context "A LogFile" do

    setup do
      @logger = StringIO.new
      @flashlog = File.join(fixtures, 'flashlog.txt')
      @reader = FlashPlayer::LogFile.new
      @reader.logger = @logger
      @reader.stubs(:flashlog_path).returns @flashlog

      FileUtils.touch @flashlog
    end

    teardown do
      remove_file @flashlog
    end

    should "read until killed" do
      blocked = true
      t = Thread.new {
        @reader.tail
        blocked = false
      }

      assert blocked
      t.kill
    end


    # This method only works when run alone -
    # Under normal circumstances, the SproutTestCase
    # clears out any Rake tasks that have been defined
    # and we don't have an easy way to redefine the
    # task...
    #should "read from rake task" do
      #FlashPlayer::LogFile.any_instance.stubs(:logger).returns StringIO.new
      #FlashPlayer::LogFile.any_instance.expects(:read_flashlog_at)
      #Rake.application[:flashlog].invoke
    #end

  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
flashsdk-1.0.12.pre test/unit/flashplayer_log_file_test.rb
flashsdk-1.0.5.pre test/unit/log_file_test.rb
flashsdk-1.0.1.pre test/unit/log_file_test.rb
flashplayer-10.1.9.pre test/unit/log_file_test.rb
flashplayer-10.1.8.pre test/unit/log_file_test.rb
flashplayer-10.1.7.pre test/unit/log_file_test.rb