Sha256: caf07fa58b91c7a009b9f1dc26e65a4cd08bfdebafd92c084cc5e04e93688894

Contents?: true

Size: 1.19 KB

Versions: 17

Compression:

Stored size: 1.19 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

17 entries across 17 versions & 1 rubygems

Version Path
intercom-2.3.0 spec/unit/intercom/event_spec.rb
intercom-2.2.4 spec/unit/intercom/event_spec.rb
intercom-2.2.3 spec/unit/intercom/event_spec.rb
intercom-2.2.2 spec/unit/intercom/event_spec.rb
intercom-2.2.1 spec/unit/intercom/event_spec.rb
intercom-2.2.0 spec/unit/intercom/event_spec.rb
intercom-2.1.6 spec/unit/intercom/event_spec.rb
intercom-2.1.5 spec/unit/intercom/event_spec.rb
intercom-2.1.4 spec/unit/intercom/event_spec.rb
intercom-2.1.3 spec/unit/intercom/event_spec.rb
intercom-2.1.2 spec/unit/intercom/event_spec.rb
intercom-2.1.1 spec/unit/intercom/event_spec.rb
intercom-2.1.0 spec/unit/intercom/event_spec.rb
intercom-2.0.3 spec/unit/intercom/event_spec.rb
intercom-2.0.2 spec/unit/intercom/event_spec.rb
intercom-2.0.1 spec/unit/intercom/event_spec.rb
intercom-2.0.0 spec/unit/intercom/event_spec.rb