Sha256: 6392298698337b83665710b934ff0eeb74cc3018007eb63871f4661c734df587

Contents?: true

Size: 1022 Bytes

Versions: 1

Compression:

Stored size: 1022 Bytes

Contents

require "spec_helper"

describe Intercom do
  before do
    Intercom.app_id = "abc123"
    Intercom.secret_key = "super-secret-key"
    @mock_rest_client = Intercom.mock_rest_client = mock()
  end

  it "has a version number" do
    Intercom::VERSION.must_equal "0.0.1"
  end

  describe "/v1/users" do
    describe "get" do
      it "fetches a user" do
        @mock_rest_client.expects(:get).with("users", {"email" => "bo@example.com"}).returns(test_user)
        user = Intercom::User.find("email" => "bo@example.com")
        user.email.must_equal "bo@example.com"
        user.name.must_equal "Joe Schmoe"
        user.session_count.must_equal 123
      end
    end

    describe "post" do
      it "saves a user" do
        user = Intercom::User.new("email" => "jo@example.com", "user_id" => "i-1224242")
        @mock_rest_client.expects(:post).with("users", {}, {:content_type => :json}, {"email" => "bo@example.com"}.to_json)
        user.save
      end
    end
  end

  describe "correct use of ssl" do
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
intercom-0.0.1 spec/intercom_spec.rb