Sha256: 0f8a20bd5980696719b6d63914ea681d758b42d10fa5705575a792ee12a80a26

Contents?: true

Size: 814 Bytes

Versions: 12

Compression:

Stored size: 814 Bytes

Contents

require 'spec_helper'

describe "Intercom::Subscription" do
  it "gets a subscription" do
    Intercom.expects(:get).with("/subscriptions/nsub_123456789", {}).returns(test_subscription)
    subscription = Intercom::Subscription.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
    Intercom.expects(:post).with("/subscriptions", {'url' => "http://example.com", 'topics' => ["user.created"]}).returns(test_subscription)
    subscription = Intercom::Subscription.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

12 entries across 12 versions & 2 rubygems

Version Path
cogniteev-intercom-2.5.4 spec/unit/intercom/subscription_spec.rb
intercom-2.5.4 spec/unit/intercom/subscription_spec.rb
intercom-2.4.4 spec/unit/intercom/subscription_spec.rb
intercom-2.4.3 spec/unit/intercom/subscription_spec.rb
intercom-2.4.2 spec/unit/intercom/subscription_spec.rb
intercom-2.4.1 spec/unit/intercom/subscription_spec.rb
intercom-2.4.0 spec/unit/intercom/subscription_spec.rb
intercom-2.3.0 spec/unit/intercom/subscription_spec.rb
intercom-2.2.4 spec/unit/intercom/subscription_spec.rb
intercom-2.2.3 spec/unit/intercom/subscription_spec.rb
intercom-2.2.2 spec/unit/intercom/subscription_spec.rb
intercom-2.2.1 spec/unit/intercom/subscription_spec.rb