Sha256: 1cc9f998e3db951a9f95c55b31f354c97a2a91d7871b58066b8feaf6bb1d5813

Contents?: true

Size: 1.39 KB

Versions: 4

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe RequestLogAnalyzer::Controller do

  it "should use a custom output generator correctly" do
    
    mock_output = double('RequestLogAnalyzer::Output::Base')
    mock_output.stub(:io).and_return(mock_io)
    mock_output.should_receive(:header)
    mock_output.should_receive(:footer)

    controller  = RequestLogAnalyzer::Controller.new(mock_source, :output => mock_output)

    controller.run!
  end

  it "should call aggregators correctly when run" do
    controller  = RequestLogAnalyzer::Controller.new(mock_source, :output => mock_output)
    
    mock_aggregator = double('RequestLogAnalyzer::Aggregator::Base') 
    mock_aggregator.should_receive(:prepare).once.ordered
    mock_aggregator.should_receive(:aggregate).with(an_instance_of(testing_format.request_class)).twice.ordered
    mock_aggregator.should_receive(:finalize).once.ordered
    mock_aggregator.should_receive(:report).once.ordered
  
    controller.aggregators << mock_aggregator
    controller.run!
  end
  
  it "should call filters when run" do
    controller  = RequestLogAnalyzer::Controller.new(mock_source, :output => mock_output)
    
    mock_filter = double('RequestLogAnalyzer::Filter::Base')
    mock_filter.should_receive(:filter).twice.and_return(nil)
    controller.should_receive(:aggregate_request).twice.and_return(nil)
    
    controller.filters << mock_filter
    controller.run!
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
request-log-analyzer-1.13.1 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.13.0 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.12.11 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.12.10 spec/unit/controller/controller_spec.rb