Sha256: 724b65a8fe7b0a1f1beb84111c82f3c67d901cadcdd5cbc25e265710cad54d07

Contents?: true

Size: 1.42 KB

Versions: 17

Compression:

Stored size: 1.42 KB

Contents

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

describe RequestLogAnalyzer::Controller do

  it "should use a custom output generator correctly" do
    
    mock_output = mock('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 = mock('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 = mock('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

17 entries across 17 versions & 2 rubygems

Version Path
request-log-analyzer-1.8.0 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.7.0 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.6.4 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.6.3 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.6.2 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.6.1 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.6.0 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.5.4 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.5.3 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.5.2 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.5.1 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.5.0 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.4.2 spec/unit/controller/controller_spec.rb
ngmoco-request-log-analyzer-1.4.2 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.4.1 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.4.0.1 spec/unit/controller/controller_spec.rb
request-log-analyzer-1.4.0 spec/unit/controller/controller_spec.rb