Sha256: 23727c3116058e97ad58eafc880d72e503e566b56269432e32ab5475dd7b0662

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

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

describe RequestLogAnalyzer::Controller do

  include RequestLogAnalyzerSpecHelper

  it "should include the file format module" do
    controller = RequestLogAnalyzer::Controller.new(:rails)
    (class << controller; self; end).ancestors.include?(RequestLogAnalyzer::FileFormat::Rails)
  end

  it "should call the aggregators when run" do
    controller = RequestLogAnalyzer::Controller.new(:rails)
    controller << log_fixture(:rails_1x)
    
    mock_aggregator = mock('aggregator')
    mock_aggregator.should_receive(:prepare).once.ordered
    mock_aggregator.should_receive(:aggregate).with(an_instance_of(RequestLogAnalyzer::Request)).at_least(:twice).ordered
    mock_aggregator.should_receive(:finalize).once.ordered
    mock_aggregator.should_receive(:report).once.ordered
    
    another_mock_aggregator = mock('another aggregator')
    another_mock_aggregator.should_receive(:prepare).once.ordered
    another_mock_aggregator.should_receive(:aggregate).with(an_instance_of(RequestLogAnalyzer::Request)).at_least(:twice).ordered
    another_mock_aggregator.should_receive(:finalize).once.ordered  
    another_mock_aggregator.should_receive(:report).once.ordered  

    
    controller.aggregators << mock_aggregator << another_mock_aggregator
    controller.run!
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wvanbergen-request-log-analyzer-0.3.0 spec/controller_spec.rb
wvanbergen-request-log-analyzer-0.3.2 spec/controller_spec.rb
wvanbergen-request-log-analyzer-0.3.3 spec/controller_spec.rb
wvanbergen-request-log-analyzer-0.3.4 spec/controller_spec.rb