Sha256: ea30131f8881672cc208213da437a155d2a332f0880a3b1b76bd51c2769f54c9

Contents?: true

Size: 1.57 KB

Versions: 7

Compression:

Stored size: 1.57 KB

Contents

require 'spec_helper'

describe AirbrakeAPI::Notice do
  before(:all) do
    AirbrakeAPI.account = 'myapp'
    AirbrakeAPI.auth_token = 'abcdefg123456'
    AirbrakeAPI.secure = false
  end

  it "should find error notices" do
    notices = AirbrakeAPI::Notice.find_by_error_id(1696170)
    notices.size.should == 42
    notices.first.id.should == 1234
  end

  it "should find all error notices" do
    notices = AirbrakeAPI::Notice.find_all_by_error_id(1696170)
    notices.size.should == 42
  end

  it "should fail with errors" do
    expect {
      AirbrakeAPI::Notice.find_all_by_error_id(1696172)
    }.to raise_error(AirbrakeAPI::AirbrakeError, /You are not authorized to see that page/)
  end

  it "should find all error notices with a page limit" do
    notices = AirbrakeAPI::Notice.find_all_by_error_id(1696171, :pages => 2)
    notices.size.should == 60
  end

  it "yields batches" do
    batches = []
    notices = AirbrakeAPI::Notice.find_all_by_error_id(1696171, :pages => 2) do |batch|
      batches << batch
    end
    notices.size.should == 60
    batches.map(&:size).should == [30,30]
  end

  it "should find individual notices" do
    AirbrakeAPI::Notice.find(1234, 1696170).should_not == nil
  end

  it "should find a broken notices" do
    AirbrakeAPI::Notice.find(666, 1696170).should_not == nil
  end

  it 'defines the notices path' do
    AirbrakeAPI::Notice.all_path(1696170).should eq('/errors/1696170/notices.xml')
  end

  it 'defines the an individual notices path' do
    AirbrakeAPI::Notice.find_path(666, 1696170).should eq('/errors/1696170/notices/666.xml')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
airbrake-api-4.2.1 spec/airbrake_api/notice_spec.rb
airbrake-api-4.2.0 spec/airbrake_api/notice_spec.rb
airbrake-api-4.1.3 spec/airbrake_api/notice_spec.rb
airbrake-api-4.1.2 spec/airbrake_api/notice_spec.rb
airbrake-api-4.1.1 spec/airbrake_api/notice_spec.rb
airbrake-api-4.1.0 spec/airbrake_api/notice_spec.rb
airbrake-api-4.0.0 spec/airbrake_api/notice_spec.rb