Sha256: 17f8e3387e664e31c18a6a4bca385d01aa7544343b288cd9635bde5e4a3217d9

Contents?: true

Size: 1.69 KB

Versions: 9

Compression:

Stored size: 1.69 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")

describe Braintree::PaymentMethodCustomerDataUpdatedMetadata do
  describe "self.new" do
    it "is protected" do
      expect do
        Braintree::PaymentMethodCustomerDataUpdatedMetadata.new
      end.to raise_error(NoMethodError, /protected method .new/)
    end
  end

  describe "self._new" do
    it "initializes the object with the appropriate attributes set" do

      params = {
        token: "a-token",
        payment_method: {
          venmo_account: {
            venmo_user_id: "venmo-user-id",
          },
        },
        datetime_updated: "2022-01-01T21:28:37Z",
        enriched_customer_data: {
          fields_updated: ["username"],
          profile_data: {
            username: "a-username",
            first_name: "a-first-name",
            last_name: "a-last-name",
            phone_number: "a-phone-number",
            email: "a-email",
          },
        },
      }

      payment_method_customer_data_updated = Braintree::PaymentMethodCustomerDataUpdatedMetadata._new(:gateway, params)

      expect(payment_method_customer_data_updated.token).to eq("a-token")
      expect(payment_method_customer_data_updated.datetime_updated).to eq("2022-01-01T21:28:37Z")
      expect(payment_method_customer_data_updated.payment_method).to be_a(Braintree::VenmoAccount)
      expect(payment_method_customer_data_updated.enriched_customer_data.profile_data.first_name).to eq("a-first-name")
      expect(payment_method_customer_data_updated.enriched_customer_data.profile_data.last_name).to eq("a-last-name")
      expect(payment_method_customer_data_updated.enriched_customer_data.fields_updated).to eq(["username"])
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
braintree-4.23.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.22.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.21.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.20.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.19.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.18.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.17.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.16.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.15.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb