Sha256: 09eb38cc22e1afc8a59eeafa68994b92f7d80bb3514cbaa2799c6f92b6ffb1fc

Contents?: true

Size: 1.54 KB

Versions: 1

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'
module Alf
  shared_examples_for "A valid Logs::Reader instance" do

    specify{ reader.should be_a(::Alf::Logs::Reader) }
    
    it "should yield a pseudo-relation" do
      reader.all?{|tuple| tuple.is_a?(Hash)}.should be_true
    end
    
  end
  describe Logs::Reader do
    
    let(:input){ _("apache_combined.log", __FILE__) }
    
    describe "when called on a reader directly" do
      let(:reader){
        ::Alf::Logs::Reader.new(input)
      }
      it_should_behave_like "A valid Logs::Reader instance"
    end
    
    describe "when called through registered one" do
      let(:reader){
        ::Alf::Reader.reader(input)
      }
      it_should_behave_like "A valid Logs::Reader instance"
    end
    
    describe "when called through factory method" do
      let(:reader){
        ::Alf::Reader.logs(input)
      }
      it_should_behave_like "A valid Logs::Reader instance"
    end
    
    describe "the auto-detect feature" do
      let(:reader){ ::Alf::Logs::Reader.new(nil,nil,:file_format => nil) }
      let(:relation){ reader.to_rel }
      
      describe "on postgresql.log" do
        before{ reader.pipe(_("postgresql.log", __FILE__)) }
        it_should_behave_like "A valid Logs::Reader instance"
        specify{ relation.should_not be_empty }
      end
      
      describe "on apache_combined.log" do
        before{ reader.pipe(_("apache_combined.log", __FILE__)) }
        it_should_behave_like "A valid Logs::Reader instance"
        specify{ relation.should_not be_empty }
      end
        
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-0.10.0 spec/unit/logs/test_reader.rb