Sha256: 5883760db034c7bc1276a5f0a9c12b633b41d3a0a85ce2619401d84f5eb8d623

Contents?: true

Size: 1.68 KB

Versions: 24

Compression:

Stored size: 1.68 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'

describe RequestLogAnalyzer::Tracker::Base, "API test" do

  before(:each) do
    @tracker    = Class.new(RequestLogAnalyzer::Tracker::Base).new
    
    @summarizer = RequestLogAnalyzer::Aggregator::Summarizer.new(mock_source)
    @summarizer.trackers << @tracker
  end
    
  it "should receive :prepare when the summarizer is preparing" do
    @tracker.should_receive(:prepare).once    
    @summarizer.prepare
  end
  
  it "should receieve :finalize when the summarizer is finalizing" do
    @tracker.should_receive(:finalize).once    
    @summarizer.finalize    
  end
  
  it "should receive :update for every request for which should_update? returns true" do
    @tracker.should_receive(:should_update?).twice.and_return(true)
    @tracker.should_receive(:update).twice
    
    @summarizer.aggregate(testing_format.request(:field => 'value1'))
    @summarizer.aggregate(testing_format.request(:field => 'value2'))    
  end
  
  it "should not :update for every request for which should_update? returns false" do
    @tracker.should_receive(:should_update?).twice.and_return(false)
    @tracker.should_not_receive(:update)
    
    @summarizer.aggregate(testing_format.request(:field => 'value1'))
    @summarizer.aggregate(testing_format.request(:field => 'value2'))    
  end
  
  it "should receive :report when the summary report is being built" do
    @tracker.should_receive(:report).with(anything).once   
    @summarizer.report(mock_output) 
  end
  
  it "should receive :to_yaml object when finalizing" do
    @summarizer.options[:dump] = temp_output_file(:dump)
    @tracker.should_receive(:to_yaml_object).once
    @summarizer.to_yaml
  end
  
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
wvanbergen-request-log-analyzer-1.2.3 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.2.4 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.2.5 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.2.6 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.2.7 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.2.8 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.2.9 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.3.0 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.3.1 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.3.2 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.3.3 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.3.4 spec/unit/tracker/tracker_api_spec.rb
wvanbergen-request-log-analyzer-1.3.5 spec/unit/tracker/tracker_api_spec.rb
request-log-analyzer-1.3.5 spec/unit/tracker/tracker_api_spec.rb
request-log-analyzer-1.3.4 spec/unit/tracker/tracker_api_spec.rb
request-log-analyzer-1.3.3 spec/unit/tracker/tracker_api_spec.rb
request-log-analyzer-1.3.2 spec/unit/tracker/tracker_api_spec.rb
request-log-analyzer-1.3.1 spec/unit/tracker/tracker_api_spec.rb
request-log-analyzer-1.3.0 spec/unit/tracker/tracker_api_spec.rb
request-log-analyzer-1.2.9 spec/unit/tracker/tracker_api_spec.rb