Sha256: c279001563daacce8d076700ce0b5418ded8185d4207a1758707caaac36feffe

Contents?: true

Size: 1.33 KB

Versions: 17

Compression:

Stored size: 1.33 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/integration_helper")

describe "exception handling" do
  before do
    Errplane.configure do |config|
      config.ignored_environments = %w{development}
      config.instrumentation_enabled = false
    end

    FakeWeb.last_request = nil
    FakeWeb.clean_registry
    @request_path = "/api/v1/applications/#{Errplane.configuration.application_id}/exceptions/test?api_key=f123-e456-d789c012"
    @request_url = "http://api.errplane.com#{@request_path}"
    FakeWeb.register_uri(:post, @request_url, :body => "", :status => ["200", "OK"])

    Errplane.queue.clear
  end

  describe "in an action that raises an exception" do
    it "should add an exception to the queue" do
      Errplane.queue.size.should be_zero
      get "/widgets/new"
      Errplane.queue.size.should == 1
    end
  end

  describe "in an action that does not raise an exception" do
    it "should not add anything to the queue" do
      get "/widgets"
      Errplane.queue.size.should be_zero
    end
  end

  describe "for an ignored user agent" do
    it "should not make an HTTP call to the API" do
      Errplane.configure do |config|
        config.ignored_user_agents = %w{Googlebot}
      end
      get "/widgets/new", {}, { "HTTP_USER_AGENT" => "Googlebot/2.1" }
      Errplane.queue.size.should be_zero
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
errplane-0.5.23 spec/integration/exceptions_spec.rb
errplane-0.5.22 spec/integration/exceptions_spec.rb
errplane-0.5.21 spec/integration/exceptions_spec.rb
errplane-0.5.20 spec/integration/exceptions_spec.rb
errplane-0.5.19 spec/integration/exceptions_spec.rb
errplane-0.5.18 spec/integration/exceptions_spec.rb
errplane-0.5.17 spec/integration/exceptions_spec.rb
errplane-0.5.15 spec/integration/exceptions_spec.rb
errplane-0.5.14 spec/integration/exceptions_spec.rb
errplane-0.5.13 spec/integration/exceptions_spec.rb
errplane-0.5.12 spec/integration/exceptions_spec.rb
errplane-0.5.11 spec/integration/exceptions_spec.rb
errplane-0.5.10 spec/integration/exceptions_spec.rb
errplane-0.5.9 spec/integration/exceptions_spec.rb
errplane-0.5.8 spec/integration/exceptions_spec.rb
errplane-0.5.7 spec/integration/exceptions_spec.rb
errplane-0.5.6 spec/integration/exceptions_spec.rb