Sha256: 4964179f66cec689b8fbae289c4f818db48d647889a19eef4e09910fc700c991

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe "Intercom::Event" do

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

  it "creates an event with metadata" do
    Intercom.expects(:post).with('/events', {'event_name' => 'Eventful 1', 'created_at' => created_time.to_i, 'email' => 'joe@example.com', 'metadata' => {'invitee_email' => 'pi@example.org', :invite_code => 'ADDAFRIEND', 'found_date' => 12909364407}}).returns(:status => 202)

    Intercom::Event.create(:event_name => "Eventful 1", :created_at => created_time,
                                   :email => 'joe@example.com',
                                   :metadata => {
                                     "invitee_email" => "pi@example.org",
                                     :invite_code => "ADDAFRIEND",
                                     "found_date" => 12909364407
    })
  end

  it "creates an event without metadata" do
    Intercom.expects(:post).with('/events', {'event_name' => 'sale of item', 'email' => 'joe@example.com'})
    Intercom::Event.create(:event_name => "sale of item", :email => 'joe@example.com')
  end
 
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
cogniteev-intercom-2.5.4 spec/unit/intercom/event_spec.rb
intercom-2.5.4 spec/unit/intercom/event_spec.rb
intercom-2.4.4 spec/unit/intercom/event_spec.rb
intercom-2.4.3 spec/unit/intercom/event_spec.rb
intercom-2.4.2 spec/unit/intercom/event_spec.rb
intercom-2.4.1 spec/unit/intercom/event_spec.rb
intercom-2.4.0 spec/unit/intercom/event_spec.rb