Sha256: c5f050c2e6928934420fcf1845743b29ff7f3b8f9ebc65352c53778bd896aed2

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'
require 'open3'
require 'rflow'

class RFlow
  describe Logger do
    let(:log_file_path) { File.join(@temp_directory_path, 'logfile') }
    let(:logger_config) do
      {'rflow.log_file_path' => log_file_path,
       'rflow.log_level' => 'DEBUG'}
    end

    def initialize_logger
      @logger = described_class.new(logger_config)
    end
    let(:logger) { @logger }

    before(:each) { initialize_logger }

    it "should initialize correctly" do
      expect(File.exist?(log_file_path)).to be true

      logger.error "TESTTESTTEST"
      expect(File.read(log_file_path)).to match(/TESTTESTTEST/)

      logger.close
    end

    it "should reopen correctly" do
      moved_path = log_file_path + '.old'

      expect(File.exist?(log_file_path)).to be true
      expect(File.exist?(moved_path)).to be false

      File.rename log_file_path, moved_path

      logger.reopen

      logger.error "TESTTESTTEST"
      expect(File.read(log_file_path)).to match(/TESTTESTTEST/)
      expect(File.read(moved_path)).not_to match(/TESTTESTTEST/)

      logger.close
    end

    it "should toggle log level"
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rflow-1.0.1 spec/rflow/logger_spec.rb
rflow-1.0.0 spec/rflow/logger_spec.rb
rflow-1.0.0a6 spec/rflow/logger_spec.rb
rflow-1.0.0a5 spec/rflow/logger_spec.rb
rflow-1.0.0a4 spec/rflow/logger_spec.rb
rflow-1.0.0a3 spec/rflow/logger_spec.rb