Sha256: b48d714b694522e0a3049fdaab668d10c24b6267f39ec8f5a56022a6dc08e4c1

Contents?: true

Size: 875 Bytes

Versions: 8

Compression:

Stored size: 875 Bytes

Contents

require 'spec_helper'

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

  it "gets a subscription" do
    client.expects(:get).with("/subscriptions/nsub_123456789", {}).returns(test_subscription)
    subscription = client.subscriptions.find(:id => "nsub_123456789")
    _(subscription.request.topics[0]).must_equal "user.created"
    _(subscription.request.topics[1]).must_equal "conversation.user.replied"
  end

  it "creates a subscription" do
    client.expects(:post).with("/subscriptions", {'url' => "http://example.com", 'topics' => ["user.created"]}).returns(test_subscription)
    subscription = client.subscriptions.create(:url => "http://example.com", :topics => ["user.created"])
    _(subscription.request.topics[0]).must_equal "user.created"
    _(subscription.request.url).must_equal "http://example.com"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
intercom-4.2.1 spec/unit/intercom/subscription_spec.rb
intercom-4.2.0 spec/unit/intercom/subscription_spec.rb
intercom-4.1.3 spec/unit/intercom/subscription_spec.rb
intercom-4.1.2 spec/unit/intercom/subscription_spec.rb
intercom-4.1.1 spec/unit/intercom/subscription_spec.rb
intercom-4.1.0 spec/unit/intercom/subscription_spec.rb
intercom-4.0.1 spec/unit/intercom/subscription_spec.rb
intercom-4.0.0 spec/unit/intercom/subscription_spec.rb