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.9.5 spec/unit/intercom/count_spec.rb
intercom-3.9.4 spec/unit/intercom/count_spec.rb
intercom-3.9.3 spec/unit/intercom/count_spec.rb
intercom-3.9.2 spec/unit/intercom/count_spec.rb
intercom-3.9.0 spec/unit/intercom/count_spec.rb
intercom-3.8.1 spec/unit/intercom/count_spec.rb
intercom-3.8.0 spec/unit/intercom/count_spec.rb
intercom-3.7.7 spec/unit/intercom/count_spec.rb
intercom-3.7.6 spec/unit/intercom/count_spec.rb
intercom-3.7.5 spec/unit/intercom/count_spec.rb
intercom-3.7.4 spec/unit/intercom/count_spec.rb
intercom-3.7.3 spec/unit/intercom/count_spec.rb
intercom-3.7.2 spec/unit/intercom/count_spec.rb
intercom-3.7.1 spec/unit/intercom/count_spec.rb
intercom-3.7.0 spec/unit/intercom/count_spec.rb
intercom-3.6.2 spec/unit/intercom/count_spec.rb
intercom-3.6.1 spec/unit/intercom/count_spec.rb
intercom-3.6.0 spec/unit/intercom/count_spec.rb
intercom-3.5.26 spec/unit/intercom/count_spec.rb
intercom-3.5.25 spec/unit/intercom/count_spec.rb