Sha256: b1874f55fc57982c7b889d4aec26b6975c5c5298addb001b856521b3e0635737

Contents?: true

Size: 815 Bytes

Versions: 10

Compression:

Stored size: 815 Bytes

Contents

require "spec_helper"

describe "/v1/impressions" do
  it "creates a good impression" do
    Intercom.expects(:post).with("users/impressions", {"email" => "jo@example.com", "location" => "/some/path/in/my/app"}).returns({"unread_messages" => 10})
    impression = Intercom::Impression.create("email" => "jo@example.com", "location" => "/some/path/in/my/app")
    impression.unread_messages.must_equal 10
  end

  it "sets/gets allowed keys" do
    params = {"user_ip" => "1.2.3.4", "user_agent" => "ie6", "location" => "/some/path/in/my/app", "email" => "me@example.com", :user_id => "abc123"}
    impression = Intercom::Impression.new(params)
    impression.to_hash.keys.sort.must_equal params.keys.map(&:to_s).sort
    params.keys.each do | key|
      impression.send(key).must_equal params[key]
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
intercom-0.0.11 spec/unit/intercom/impression_spec.rb
intercom-0.0.10 spec/unit/intercom/impression_spec.rb
intercom-0.0.9 spec/unit/intercom/impression_spec.rb
intercom-0.0.8 spec/unit/intercom/impression_spec.rb
intercom-0.0.7 spec/unit/intercom/impression_spec.rb
intercom-0.0.6 spec/unit/intercom/impression_spec.rb
intercom-0.0.5 spec/unit/intercom/impression_spec.rb
intercom-0.0.4 spec/unit/intercom/impression_spec.rb
intercom-0.0.3 spec/unit/intercom/impression_spec.rb
intercom-0.0.2 spec/unit/intercom/impression_spec.rb