Sha256: cca0cb76d2eb5b99229e270caa596b4dfe1efe00395d3b6c0b9ab7057b8d0923

Contents?: true

Size: 1016 Bytes

Versions: 6

Compression:

Stored size: 1016 Bytes

Contents

require 'spec_helper'

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

  it 'creates a section' do
    client.expects(:post).with('/help_center/sections', { 'name' => 'Section 1', 'parent_id' => '1' }).returns(test_section)
    client.sections.create(:name => 'Section 1', :parent_id => '1')
  end

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

  it 'finds a section' do
    client.expects(:get).with('/help_center/sections/1', {}).returns(test_section)
    client.sections.find(id: '1')
  end

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

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