Sha256: 6a56cf65c1cf728bef87675a7742fd9dca34bbf23c63106c0467f3853e008734

Contents?: true

Size: 938 Bytes

Versions: 40

Compression:

Stored size: 938 Bytes

Contents

require "spec_helper"

describe "Intercom::Count" do
  let (:client) { Intercom::Client.new(app_id: 'app_id',  api_key: 'api_key') }

  it 'should get app wide counts' do
    client.expects(:get).with("/counts", {}).returns(test_app_count)
    counts = client.counts.for_app
    counts.tag['count'].must_equal(341)
  end

  it 'should get type counts' do
    client.expects(:get).with("/counts", {type: 'user', count: 'segment'}).returns(test_segment_count)
    counts = client.counts.for_type(type: 'user', count: 'segment')
    counts.user['segment'][4]["segment 1"].must_equal(1)
  end

  it 'should not include count param when nil' do
    client.expects(:get).with("/counts", {type: 'conversation'}).returns(test_conversation_count)
    counts = client.counts.for_type(type: 'conversation')
    counts.conversation.must_equal({
      "assigned" => 1,
      "closed" => 15,
      "open" => 1,
      "unassigned" => 0
    })
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
intercom-3.5.24 spec/unit/intercom/count_spec.rb
intercom-3.5.23 spec/unit/intercom/count_spec.rb
intercom-3.5.22 spec/unit/intercom/count_spec.rb
intercom-3.5.21 spec/unit/intercom/count_spec.rb
intercom-3.5.20 spec/unit/intercom/count_spec.rb
intercom-3.5.19 spec/unit/intercom/count_spec.rb
intercom-3.5.17 spec/unit/intercom/count_spec.rb
intercom-3.5.16 spec/unit/intercom/count_spec.rb
intercom-3.5.15 spec/unit/intercom/count_spec.rb
intercom-3.5.14 spec/unit/intercom/count_spec.rb
intercom-3.5.12 spec/unit/intercom/count_spec.rb
intercom-3.5.11 spec/unit/intercom/count_spec.rb
intercom-3.5.10 spec/unit/intercom/count_spec.rb
intercom-3.5.9 spec/unit/intercom/count_spec.rb
intercom-3.5.8 spec/unit/intercom/count_spec.rb
intercom-3.5.7 spec/unit/intercom/count_spec.rb
intercom-3.5.6 spec/unit/intercom/count_spec.rb
intercom-3.5.5 spec/unit/intercom/count_spec.rb
intercom-3.5.4 spec/unit/intercom/count_spec.rb
intercom-3.5.3 spec/unit/intercom/count_spec.rb