Sha256: e705f7ade949ec99ea660608b490e5afeed98aa772fa975431c47cc30c1e9f98

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

require 'spec_helper'

describe "Intercom::Notification" do

  it "converts notification hash to object" do
    payload = Intercom::Notification.new(test_user_notification)
    payload.must_be_instance_of Intercom::Notification
  end

  it "returns correct model type for User" do
    payload = Intercom::Notification.new(test_user_notification)
    payload.model_type.must_equal Intercom::User
  end

  it "returns correct notification topic" do
    payload = Intercom::Notification.new(test_user_notification)
    payload.topic.must_equal "user.created"
  end

  it "returns instance of User" do
    payload = Intercom::Notification.new(test_user_notification)
    payload.model.must_be_instance_of Intercom::User
  end

  it "returns instance of Conversation" do
    payload = Intercom::Notification.new(test_conversation_notification)
    payload.model.must_be_instance_of Intercom::Conversation
  end

  it "returns correct model type for User" do
    payload = Intercom::Notification.new(test_conversation_notification)
    payload.model_type.must_equal Intercom::Conversation
  end

  it "returns correct notification topic" do
    payload = Intercom::Notification.new(test_conversation_notification)
    payload.topic.must_equal "conversation.user.created"
  end

  it "returns inner User object for Conversation" do
    payload = Intercom::Notification.new(test_conversation_notification)
    payload.model.user.must_be_instance_of Intercom::User
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
intercom-2.2.1 spec/unit/intercom/notification_spec.rb