Sha256: 0c11b1eb7912746f56f9f7273c313df9b20c1d089250253e4ffdbe5fd4ca66fa

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Intercom::Collection do
  let(:client) { Intercom::Client.new(token: 'token') }

  it 'creates a collection' do
    client.expects(:post).with('/help_center/collections', { 'name' => 'Collection 1', 'description' => 'Collection desc' }).returns(test_collection)
    client.collections.create(:name => 'Collection 1', :description => 'Collection desc')
  end

  it 'lists collections' do
    client.expects(:get).with('/help_center/collections', {}).returns(test_collection_list)
    client.collections.all.each { |t| }
  end

  it 'finds a collection' do
    client.expects(:get).with('/help_center/collections/1', {}).returns(test_collection)
    client.collections.find(id: '1')
  end

  it 'updates a collection' do
    collection = Intercom::Collection.new(id: '12345')
    client.expects(:put).with('/help_center/collections/12345', {})
    client.collections.save(collection)
  end

  it 'deletes a collection' do
    collection = Intercom::Collection.new(id: '12345')
    client.expects(:delete).with('/help_center/collections/12345', {})
    client.collections.delete(collection)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
intercom-4.2.1 spec/unit/intercom/collection_spec.rb
intercom-4.2.0 spec/unit/intercom/collection_spec.rb
intercom-4.1.3 spec/unit/intercom/collection_spec.rb
intercom-4.1.2 spec/unit/intercom/collection_spec.rb
intercom-4.1.1 spec/unit/intercom/collection_spec.rb
intercom-4.1.0 spec/unit/intercom/collection_spec.rb