Sha256: ea764973e36fa134e1ed2622ef7c790ddf88069d69bd645a040d7570e7cc0de1

Contents?: true

Size: 906 Bytes

Versions: 4

Compression:

Stored size: 906 Bytes

Contents

require 'spec_helper'

describe Intercom::Company do
  
  describe 'when no response raises error' do
    it 'on find' do
      Intercom.expects(:get).with("/companies", {:company_id => '4'}).returns(nil)
      proc {Intercom::Company.find(:company_id => '4')}.must_raise Intercom::HttpError
    end
    
    it 'on find_all' do
      Intercom.expects(:get).with("/companies", {}).returns(nil)
      proc {Intercom::Company.all.each {|company| }}.must_raise Intercom::HttpError
    end
    
    it 'on load' do
      Intercom.expects(:get).with("/companies", {:company_id => '4'}).returns({'type' =>'user', 'id' =>'aaaaaaaaaaaaaaaaaaaaaaaa', 'company_id' => '4', 'name' => 'MyCo'})
      company = Intercom::Company.find(:company_id => '4')
      Intercom.expects(:get).with('/companies/aaaaaaaaaaaaaaaaaaaaaaaa', {}).returns(nil)
      proc {company.load}.must_raise Intercom::HttpError
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
cogniteev-intercom-2.5.4 spec/unit/intercom/company_spec.rb
intercom-2.5.4 spec/unit/intercom/company_spec.rb
intercom-2.4.4 spec/unit/intercom/company_spec.rb
intercom-2.4.3 spec/unit/intercom/company_spec.rb