Sha256: 717f34edb5aebb08909184cb13eb8ad3cd8f5644482903124aa83b25d17c6a64

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

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

  it "should have correct collection path" do
    AirbrakeAPI::Error.collection_path.should == "/errors.xml"
  end

  it "should generate correct error path given an id" do
    AirbrakeAPI::Error.error_path(1234).should == "/errors/1234.xml"
  end

  describe '.find' do
    it "should find a page of the 30 most recent errors" do
      errors = AirbrakeAPI::Error.find(:all)
      ordered = errors.sort_by(&:most_recent_notice_at).reverse
      ordered.should == errors
      errors.size.should == 30
    end

    it "should paginate errors" do
      errors = AirbrakeAPI::Error.find(:all, :page => 2)
      ordered = errors.sort_by(&:most_recent_notice_at).reverse
      ordered.should == errors
      errors.size.should == 2
    end

    it "should find an individual error" do
      error = AirbrakeAPI::Error.find(1696170)
      error.action.should == 'index'
      error.id.should == 1696170
    end

    it "should raise an error when not passed an id" do
      lambda do
        AirbrakeAPI::Error.find
      end.should raise_error(AirbrakeAPI::AirbrakeError)
    end
  end

  describe '.update' do
    it 'should update the status of an error' do
      error = AirbrakeAPI::Error.update(1696170, :group => { :resolved => true})
      error.resolved.should be_true
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
airbrake-api-4.2.1 spec/airbrake_api/error_spec.rb
airbrake-api-4.2.0 spec/airbrake_api/error_spec.rb
airbrake-api-4.1.3 spec/airbrake_api/error_spec.rb
airbrake-api-4.1.2 spec/airbrake_api/error_spec.rb
airbrake-api-4.1.1 spec/airbrake_api/error_spec.rb
airbrake-api-4.1.0 spec/airbrake_api/error_spec.rb
airbrake-api-4.0.0 spec/airbrake_api/error_spec.rb
airbrake-api-3.3.0 spec/airbrake_api/error_spec.rb
airbrake-api-3.2.3 spec/airbrake_api/error_spec.rb
airbrake-api-3.2.2 spec/airbrake_api/error_spec.rb
airbrake-api-3.2.1 spec/airbrake_api/error_spec.rb
airbrake-api-3.2.0 spec/airbrake_api/error_spec.rb