Sha256: d60153e83e43410426e6a60eb7f432c83f4c57168a1c9d2039d33da749baaf56

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

require 'spec_helper'

describe Conekta::Customer do
  include_context "API 2.0.0"
  context "updating customers" do
    context "creating submodels" do
      include_context "customer"

      let(:customer) { Conekta::Customer.create(customer_data) }

      let(:source_params) do
        {
          type:     "card",
          token_id: "tok_test_visa_4242"
        }
      end

      let(:shipping_contact_params) do
        {
          email: "rogue@xmen.org",
          phone: "+5213353319758",
          receiver: "Test Conekta",
          address: {
            street1: "250 Alexis St",
            city: "Red Deer",
            state: "Alberta",
            country: "CA",
            postal_code: "T4N 0B8",
          }
        }
      end

      it "successfully creates source for customer" do
        source = customer.create_payment_source(source_params)

        expect(source.class.to_s).to eq("Conekta::PaymentSource")
        expect(customer.payment_sources.class.to_s).to eq("Conekta::List")
      end

      it "successfully creates shipping contact for customer" do
        shipping_contact =
          customer.create_shipping_contact(shipping_contact_params)

        expect(shipping_contact.class.to_s).to eq("Conekta::ShippingContact")
        expect(customer.shipping_contacts.class.to_s).to eq("Conekta::List")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
conekta-2.3.0 spec/conekta/2.0.0/customer_spec.rb
conekta-2.0.0 spec/conekta/2.0.0/customer_spec.rb
conekta-1.1.3 spec/conekta/2.0.0/customer_spec.rb
conekta-1.1.2 spec/conekta/2.0.0/customer_spec.rb
conekta-1.1.1 spec/conekta/2.0.0/customer_spec.rb
conekta-1.1.0 spec/conekta/2.0.0/customer_spec.rb