Sha256: 0bce2f4673656e447e3770a1fdd97dd844fcfe14762345e7a139b24adee1580d

Contents?: true

Size: 804 Bytes

Versions: 5

Compression:

Stored size: 804 Bytes

Contents

require 'spec_helper'
require 'generators/templates/logger'

describe "Quorum::Logger" do
  describe "#log" do
    before(:all) do
      @args   = File.join(::Rails.root.to_s, "log") 
      @logger = Quorum::Logger.new(@args)
    end

    it "records program and message in a log file" do
      @logger.log("RSpec", "This is a test.")

      File.size(
        File.join(@args, "quorum.log")
      ).should be > 0

      `rm #{File.join(@args, "quorum.log")}`
    end

    it "records program, message, exits and removes files" do
      lambda {
        @logger.log(
          "RSpec", "This is a test.", 1, 
          File.join(@args, "quorum.log")
        )
      }.should raise_error(SystemExit)

      File.exists?(
        File.join(@args, "quorum.log")
      ).should be_false

    end
  end  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
quorum-0.3.1 spec/templates/logger_spec.rb
quorum-0.3.0 spec/templates/logger_spec.rb
quorum-0.2.1 spec/templates/logger_spec.rb
quorum-0.2.0 spec/templates/logger_spec.rb
quorum-0.1.0 spec/templates/logger_spec.rb