Sha256: 0514e0411e2c0251e370508a2afc418908afd39ec24cc24e5368b96b33eb9c30

Contents?: true

Size: 974 Bytes

Versions: 6

Compression:

Stored size: 974 Bytes

Contents

# frozen_string_literal: true

require "test_helper"

class EventObjectTest < Minitest::Test
  def setup
    json = JSON.parse(fixture_file("objects/event")).merge(client: client)
    @event = Calendlyr::Event.new(json)

    user_uuid = "GBGBDCAADAEDCRZ2"
    response = {body: fixture_file("users/retrieve"), status: 200}
    stub(path: "users/#{user_uuid}", response: response)
  end

  def test_memberships
    memberships = @event.memberships

    assert_equal 1, memberships.count
    assert_equal "John Doe", memberships.first.name
    assert_instance_of Calendlyr::User, memberships.first
  end

  def test_cancel
    response = {body: fixture_file("events/cancel_invitee"), status: 201}
    stub(method: :post, path: "scheduled_events/#{@event.uuid}/cancellation", response: response)

    cancellation = @event.cancel(reason: "I'm busy")

    assert_instance_of Calendlyr::Events::Cancellation, cancellation
    assert_equal "string", cancellation.reason
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
calendlyr-0.7.5 test/calendlyr/objects/event_test.rb
calendlyr-0.7.4 test/calendlyr/objects/event_test.rb
calendlyr-0.7.3 test/calendlyr/objects/event_test.rb
calendlyr-0.7.2 test/calendlyr/objects/event_test.rb
calendlyr-0.7.1 test/calendlyr/objects/event_test.rb
calendlyr-0.7.0 test/calendlyr/objects/event_test.rb