Sha256: 5a1206d00f19730048b76e56928fcf29f89ef43243ab021bcfd8864b61a222a2

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

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

describe SystemMetrics::Instrument::ActionView do
  include NotificationsSupport

  before(:each) do
    @instrument = SystemMetrics::Instrument::ActionView.new
  end

  describe '#handle?' do
    it 'should handle any event whose name ends with action_view' do
      @instrument.handles?(event(:name => 'recieve.action_view')).should be_true
      @instrument.handles?(event(:name => 'send.action_view')).should be_true
    end

    it 'should not handle an event whose name does not end with action_view' do
      @instrument.handles?(event(:name => 'do_something.else')).should be_false
      @instrument.handles?(event(:name => 'action_view.process_action')).should be_false
    end
  end

  describe '#ignore?' do
    it 'should always return false' do
      @instrument.ignore?(event(:name => 'process_action.action_view')).should be_false
      @instrument.ignore?(event(:name => 'start_processing.action_controller')).should be_false
    end
  end

  describe '#prepare' do
    it 'should try to replace any paths in payload values' do
      @instrument.mapped_paths['/abc123'] = 'A'
      e = event(:payload => { 
        :path => '/abc123/more/path',
        :action => 'create'
      })      
      @instrument.prepare(e)
      e.payload.should == { :path => 'A/more/path', :action => 'create' }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
system-metrics-0.2.5 spec/system_metrics/instrument/action_view_spec.rb
system-metrics-0.2.4 spec/system_metrics/instrument/action_view_spec.rb
system-metrics-0.2.3 spec/system_metrics/instrument/action_view_spec.rb
system-metrics-0.2.2 spec/system_metrics/instrument/action_view_spec.rb
system-metrics-0.2.1 spec/system_metrics/instrument/action_view_spec.rb
system-metrics-0.2.0 spec/system_metrics/instrument/action_view_spec.rb