Sha256: da050b20a94e21ba6d6132b720802b76b81b9a2da4358c4d9a2253eab7254deb

Contents?: true

Size: 1.67 KB

Versions: 9

Compression:

Stored size: 1.67 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)

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
braintree-4.14.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.13.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.12.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.11.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.10.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.9.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.8.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.7.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb
braintree-4.6.0 spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb