Sha256: f26b24dfb39fe1649cac1dff48a95502cb2ed017dcd285880a2d1718a76e548f

Contents?: true

Size: 679 Bytes

Versions: 24

Compression:

Stored size: 679 Bytes

Contents

require "spec_helper"

describe "notes" do
  it "creates a note" do
    Intercom.expects(:post).with("/notes", {"body" => "Note to leave on user"}).returns({"body" => "<p>Note to leave on user</p>", "created_at" => 1234567890})
    note = Intercom::Note.create("body" => "Note to leave on user")
    note.body.must_equal "<p>Note to leave on user</p>"
  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

24 entries across 24 versions & 2 rubygems

Version Path
intercom-2.0.3 spec/unit/intercom/note_spec.rb
intercom-2.0.2 spec/unit/intercom/note_spec.rb
intercom-2.0.1 spec/unit/intercom/note_spec.rb
intercom-2.0.0 spec/unit/intercom/note_spec.rb