Sha256: c9de4b8a46ea35067f8c2b8bdbe219e658d983198a82c175ef1d2c19dadee79a

Contents?: true

Size: 961 Bytes

Versions: 53

Compression:

Stored size: 961 Bytes

Contents

require "spec_helper"

describe "notes" do
  let (:client) { Intercom::Client.new(app_id: 'app_id',  api_key: 'api_key') }

  it "creates a note" do
    client.expects(:post).with("/notes", {"body" => "Note to leave on user"}).returns({"body" => "<p>Note to leave on user</p>", "created_at" => 1234567890})
    note = client.notes.create("body" => "Note to leave on user")
    note.body.must_equal "<p>Note to leave on user</p>"
  end

  it 'gets a note' do
    client.expects(:get).with("/notes/123", {}).returns({"id" => "123", "body" => "<p>Note to leave on user</p>", "created_at" => 1234567890})
    client.notes.find(id: '123')
  end

  it "sets/gets allowed keys" do
    params = {"body" => "Note body", "email" => "me@example.com", :user_id => "abc123"}
    note = Intercom::Note.new(params)

    note.to_hash.keys.sort.must_equal params.keys.map(&:to_s).sort
    params.keys.each do | key|
      note.send(key).must_equal params[key]
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
intercom-3.9.5 spec/unit/intercom/note_spec.rb
intercom-3.9.4 spec/unit/intercom/note_spec.rb
intercom-3.9.3 spec/unit/intercom/note_spec.rb
intercom-3.9.2 spec/unit/intercom/note_spec.rb
intercom-3.9.0 spec/unit/intercom/note_spec.rb
intercom-3.8.1 spec/unit/intercom/note_spec.rb
intercom-3.8.0 spec/unit/intercom/note_spec.rb
intercom-3.7.7 spec/unit/intercom/note_spec.rb
intercom-3.7.6 spec/unit/intercom/note_spec.rb
intercom-3.7.5 spec/unit/intercom/note_spec.rb
intercom-3.7.4 spec/unit/intercom/note_spec.rb
intercom-3.7.3 spec/unit/intercom/note_spec.rb
intercom-3.7.2 spec/unit/intercom/note_spec.rb
intercom-3.7.1 spec/unit/intercom/note_spec.rb
intercom-3.7.0 spec/unit/intercom/note_spec.rb
intercom-3.6.2 spec/unit/intercom/note_spec.rb
intercom-3.6.1 spec/unit/intercom/note_spec.rb
intercom-3.6.0 spec/unit/intercom/note_spec.rb
intercom-3.5.26 spec/unit/intercom/note_spec.rb
intercom-3.5.25 spec/unit/intercom/note_spec.rb