Sha256: a3400090000a82ed6c9feee46d6f3cb46cc2d6c14cae0f93afcfe0e56267e35a

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

require 'spec_helper'
require 'tempfile'

describe Logger do

  describe "#reopen" do

    let(:path) { Tempfile.new(["heroku-scalr", "logger"]).path }
    subject    { Logger.new(path) }

    it "should reopen files" do
      subject.info "Line 1"
      FileUtils.mv(path, "#{path}.1")
      subject.info "Line 2"
      subject.reopen.should be(subject)
      subject.info "Line 3"

      File.read("#{path}.1").should have(2).lines
      File.read(path).should have(1).lines
    end

    it "should skip streams" do
      logger = Logger.new(STDERR)
      logger.reopen.should be_nil
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heroku-scalr-0.3.0 spec/heroku/scalr/core_ext_spec.rb
heroku-scalr-0.2.4 spec/heroku/scalr/core_ext_spec.rb