Sha256: 4b5a32c91a94e4b307b1fdc6938779137ba426af485e50b76870c14d25cff7b6

Contents?: true

Size: 1.41 KB

Versions: 5

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'

describe Conekta::ShippingContact do
  include_context "API 2.0.0"
  include_context "customer"

  let(:shipping_contacts) do
    [{
       receiver: "John Williams",
       phone: "+5213353319758",
       address: {
         street1: "250 Alexis St",
         city: "Red Deer",
         state: "Alberta",
         country: "CA",
         postal_code: "T4N 0B8",
       }
     },
     {
       receiver: "John Williams",
       phone: "+5213353319758",
       address: {
         street1: "250 Alexis St",
         city: "Red Deer",
         state: "Alberta",
         country: "CA",
         postal_code: "T4N 0B8",
       }
     }]
  end

  let(:customer) do
    Conekta::Customer.create(customer_data.
                               merge(shipping_contacts: shipping_contacts))
  end

 let(:shipping_contact) { customer.shipping_contacts.first }

  context "deleting shipping contacts" do
    it "successful shipping contact delete" do
      shipping_contact.delete

      expect(shipping_contact.deleted).to eq(true)
    end
  end

  context "updating shipping contacts" do
    it "successful shipping contact update" do
      shipping_contact.update(receiver: "Mario Moreno")

      expect(shipping_contact.receiver).to eq("Mario Moreno")
    end

    it "unsuccessful shipping contact update" do
      expect {
        shipping_contact.update(receiver: 123)
      }.to raise_error(Conekta::ErrorList)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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