Sha256: 644351a967cc3e95f9460b232d9751d043502d5ab8840fda17efaf90a4509b06

Contents?: true

Size: 1.1 KB

Versions: 11

Compression:

Stored size: 1.1 KB

Contents

describe Veritrans do

  after do
    Veritrans.logger = nil
    Veritrans.file_logger = nil
  end

  it "should set logger" do
    Veritrans.logger = :nothing
    Veritrans.logger.should == :nothing

    Veritrans.file_logger = :nothing2
    Veritrans.file_logger.should == :nothing2
  end

  describe "widthout rails" do
    before do
      hide_const("Rails")
    end

    it "should log to stdout when there is no rails" do
      Veritrans.logger.instance_variable_get(:@logdev).dev.should == $stdout
    end

    it "should set file_logger" do
      Veritrans.file_logger.instance_variable_get(:@logdev).filename.should == "/dev/null"
    end

  end

  describe "width rails" do
    before do
      FileUtils.mkdir_p("/tmp/log")
      allow(Rails).to receive(:logger).and_return(Logger.new(STDERR))
      allow(Rails).to receive(:root).and_return(Pathname.new("/tmp"))
    end

    it "should use rails logger" do
      Veritrans.logger.should == Rails.logger
    end

    it "should set file_logger" do
      Veritrans.file_logger.instance_variable_get(:@logdev).filename.should == "/tmp/log/veritrans.log"
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
veritrans-2.3.0 spec/veritrans_logger_spec.rb
veritrans-2.2.0 spec/veritrans_logger_spec.rb
veritrans-2.1.3 spec/veritrans_logger_spec.rb
veritrans-2.1.2 spec/veritrans_logger_spec.rb
veritrans-2.1.1 spec/veritrans_logger_spec.rb
veritrans-2.1.0 spec/veritrans_logger_spec.rb
veritrans-2.0.4 spec/veritrans_logger_spec.rb
veritrans-2.0.3 spec/veritrans_logger_spec.rb
veritrans-2.0.2 spec/veritrans_logger_spec.rb
veritrans-2.0.0 spec/veritrans_logger_spec.rb
veritrans-2.0.0beta spec/veritrans_logger_spec.rb