Sha256: 20b5f22e29d7d48a2fa1afc038ca9a99a770ad08a29bf5070c3a64be6bbf3a79

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

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

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

  it "should generate correct error path given an id" do
    Hoptoad::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 = Hoptoad::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 = Hoptoad::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 = Hoptoad::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
        Hoptoad::Error.find
      end.should raise_error(Hoptoad::HoptoadError)
    end
  end

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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hoptoad-api-2.5.0 spec/hoptoad_api/error_spec.rb
hoptoad-api-2.4.0 spec/hoptoad_api/error_spec.rb