Sha256: 253f5db011e4e0a014088492eb94ab9797ea3cb529ff9d085a94b2bee844378a

Contents?: true

Size: 1.22 KB

Versions: 11

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe "Intercom::Message" do

  let (:user) {Intercom::User.new("email" => "jim@example.com", :user_id => "12345", :created_at => Time.now, :name => "Jim Bob")}

  it 'creates an user message with symbol keys' do
    Intercom.expects(:post).with('/messages', {'from' => { :type => 'user', :email => 'jim@example.com'}, 'body' => 'halp'}).returns(:status => 200)
    Intercom::Message.create(:from => { :type => "user", :email => "jim@example.com" }, :body => "halp")
  end
  
  it "creates an user message with string keys" do
    Intercom.expects(:post).with('/messages', {'from' => { 'type' => 'user', 'email' => 'jim@example.com'}, 'body' => 'halp'}).returns(:status => 200)
    Intercom::Message.create('from' => { 'type' => "user", 'email' => "jim@example.com" }, 'body' => "halp")
  end
  
  it "creates a admin message" do
    Intercom.expects(:post).with('/messages', {'from' => { 'type' => "admin", 'id' => "1234" }, 'to' => { 'type' => 'user', 'id' => '5678' }, 'body' => 'halp', 'message_type' => 'inapp'}).returns(:status => 200)
    Intercom::Message.create('from' => { 'type' => "admin", 'id' => "1234" }, :to => { 'type' => 'user', 'id' => '5678' }, 'body' => "halp", 'message_type' => 'inapp')
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

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