Sha256: d4f0d28ff3eaa7f473526e2ebdc524ab787ebc7fac20a6054fcae462cdd55a20

Contents?: true

Size: 1.99 KB

Versions: 24

Compression:

Stored size: 1.99 KB

Contents

# frozen_string_literal: true

require ::File.expand_path("../../test_helper", __FILE__)

module Stripe
  class AccountPersonsOperationsTest < Test::Unit::TestCase
    setup do
      @account_id = "acct_123"
      @person_id = "person_123"
    end

    context "#create_person" do
      should "create a person" do
        person = Stripe::Account.create_person(
          @account_id,
          first_name: "John",
          last_name: "Doe"
        )
        assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons"
        assert person.is_a?(Stripe::Person)
      end
    end

    context "#retrieve_person" do
      should "retrieve a person" do
        person = Stripe::Account.retrieve_person(
          @account_id,
          @person_id
        )
        assert_requested :get, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons/#{@person_id}"
        assert person.is_a?(Stripe::Person)
      end
    end

    context "#update_person" do
      should "update a person" do
        person = Stripe::Account.update_person(
          @account_id,
          @person_id,
          first_name: "John"
        )
        assert_requested :post, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons/#{@person_id}"
        assert person.is_a?(Stripe::Person)
      end
    end

    context "#delete_person" do
      should "delete an person" do
        person = Stripe::Account.delete_person(
          @account_id,
          @person_id
        )
        assert_requested :delete, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons/#{@person_id}"
        assert person.deleted
        assert_equal @person_id, person.id
      end
    end

    context "#list_persons" do
      should "list the account's external accounts" do
        persons = Stripe::Account.list_persons(
          @account_id
        )
        assert_requested :get, "#{Stripe.api_base}/v1/accounts/#{@account_id}/persons"
        assert persons.is_a?(Stripe::ListObject)
        assert persons.data.is_a?(Array)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
stripe-3.31.1 test/stripe/account_persons_operations_test.rb
stripe-3.31.0 test/stripe/account_persons_operations_test.rb
stripe-3.30.0 test/stripe/account_persons_operations_test.rb
stripe-3.29.0 test/stripe/account_persons_operations_test.rb