Sha256: f711f1604ffc2032b2a266fd85aba09b3d2c5ad3fd8ede400260caa351cdfb8b

Contents?: true

Size: 1.51 KB

Versions: 10

Compression:

Stored size: 1.51 KB

Contents

$: << File.join(File.dirname(__FILE__), '..', 'lib')

require 'rubygems'
require 'spec'
require 'request_log_analyzer'

module RequestLogAnalyzerSpecHelper
  
  def format_file(format)
    File.dirname(__FILE__) + "/file_formats/#{format}.rb"
  end
  
  def spec_format
    @spec_format ||= begin
      require format_file(:spec_format)
      SpecFormat.new
    end
  end
      
  def log_fixture(name)
    File.dirname(__FILE__) + "/fixtures/#{name}.log"
  end
  
  def request(fields, format = TestFileFormat)
    if fields.kind_of?(Array)
      RequestLogAnalyzer::Request.create(format, *fields)
    else
      RequestLogAnalyzer::Request.create(format, fields)
    end
  end
  
end

module TestFileFormat
  
  module Summarizer
    def self.included(base)
      # monkey patching for summarizer here :-)
    end
  end
  
  module LogParser
    def self.included(base)
      # monkey patching for log parser here :-)
    end
  end
  
  LINE_DEFINITIONS = {
    :first => {
      :header => true,
      :teaser => /processing /,
      :regexp => /processing request (\d+)/,
      :captures => [{ :name => :request_no, :type => :integer, :anonymize => :slightly }]    
    },
    :test => {
      :teaser => /testing /,
      :regexp => /testing is (\w+)/,
      :captures => [{ :name => :test_capture, :type => :string, :anonymize => true}]
    }, 
    :last => {
      :footer => true,
      :teaser => /finishing /,
      :regexp => /finishing request (\d+)/,
      :captures => [{ :name => :request_no, :type => :integer}]
    }
  }
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
wvanbergen-request-log-analyzer-1.0.0 spec/spec_helper.rb
wvanbergen-request-log-analyzer-1.0.1 spec/spec_helper.rb
wvanbergen-request-log-analyzer-1.0.2 spec/spec_helper.rb
wvanbergen-request-log-analyzer-1.0.3 spec/spec_helper.rb
wvanbergen-request-log-analyzer-1.0.4 spec/spec_helper.rb
wvanbergen-request-log-analyzer-1.1.0 spec/spec_helper.rb
request-log-analyzer-1.0.2 spec/spec_helper.rb
request-log-analyzer-1.0.4 spec/spec_helper.rb
request-log-analyzer-1.0.3 spec/spec_helper.rb
request-log-analyzer-1.1.0 spec/spec_helper.rb