Sha256: 7e6c6ecbfc69b21137b2e6071028537d90b77ed75a0b0ab77071848aacabf5f2

Contents?: true

Size: 1.57 KB

Versions: 6

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('/groups/1696170/notices.xml')
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
airbrake-api-4.6.0 spec/airbrake_api/notice_spec.rb
airbrake-api-4.5.1 spec/airbrake_api/notice_spec.rb
airbrake-api-4.5.0 spec/airbrake_api/notice_spec.rb
airbrake-api-4.4.0 spec/airbrake_api/notice_spec.rb
airbrake-api-4.3.0 spec/airbrake_api/notice_spec.rb
airbrake-api-4.2.2 spec/airbrake_api/notice_spec.rb