Sha256: ab12b15ad9d610e976ac568bd02317d67ac6b54e79ec0f1301c02be243c324e4

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require "test_helper"

module Organizations
  class InvitationObjectTest < Minitest::Test
    def setup
      json = JSON.parse(fixture_file("objects/organizations/invitation")).merge(client: client)
      @invitation = Calendlyr::Organizations::Invitation.new(json)

      response = {body: fixture_file("organizations/revoke_invitation"), status: 204}
      stub(method: :delete, path: "organizations/#{@invitation.associated_organization.uuid}/invitations/#{@invitation.uuid}", response: response)

      response = {body: fixture_file("users/retrieve"), status: 200}
      stub(path: "users/#{Calendlyr::Object.get_slug(@invitation.user)}", response: response)
    end

    def test_associated_organization
      organization = @invitation.associated_organization

      assert_equal Calendlyr::Organization, organization.class
    end

    def test_associated_user
      user = @invitation.associated_user

      assert_equal "John Doe", user.name
    end

    def test_revoke
      assert @invitation.revoke
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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