Sha256: 08de4fbb3c329c77fed80f99165905946adf57d2837577c9eed7229d1d0ff20b

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'
require 'tempfile'
require 'pp'

describe Woodchuck::Agent do
  describe '#initialize' do
    let(:logfile) { Tempfile.new("foobar") }

    subject { described_class.new }
    
    it 'sets a logger' do
      subject.logger.should be_a Woodchuck::Logger
    end
    it 'sets a tailer' do
      subject.watcher.should be_a Woodchuck::Watcher
    end
  end

  describe '#start' do
    let(:path) { fixture_path }
    let(:log_dir) { path + "**/*" }
    let(:log_file) { File.open(path + 'foo', 'w+') }
    let(:timestamp) { Time.now.utc.iso8601(6) }

    subject { described_class.new(log_dir.to_s) }
    
    before do
      Socket.stub(:gethostname).and_return("example.com")

      fixtures path do
        touch log_file
      end
    end
    
    after do
      subject.stop
    end

    it 'gets a list of events' do
      subject.start
      log_file.write("a message!\n")
      log_file.flush      
      # subject.watcher.events.size.should == 1
    end
    # it do
    #   subject.events.size.should == 1
    # end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
woodchuck-json-event-0.0.2 spec/woodchuck/agent_spec.rb
woodchuck-json-event-0.0.1 spec/woodchuck/agent_spec.rb
woodchuck-0.0.1 spec/woodchuck/agent_spec.rb