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

describe Braintree::ApplePayDetails do
  it "initializes prepaid reloadable correctly" do
    card = Braintree::ApplePayDetails.new({:prepaid_reloadable => "No"})
    expect(card.prepaid_reloadable).to eq("No")
  end

  it "initializes business correctly" do
    card = Braintree::ApplePayDetails.new({:business => "No"})
    expect(card.business).to eq("No")
  end

  it "initializes consumer correctly" do
    card = Braintree::ApplePayDetails.new({:consumer => "No"})
    expect(card.consumer).to eq("No")
  end

  it "initializes corporate correctly" do
    card = Braintree::ApplePayDetails.new({:corporate => "No"})
    expect(card.corporate).to eq("No")
  end

  it "initializes purchase correctly" do
    card = Braintree::ApplePayDetails.new({:purchase => "No"})
    expect(card.purchase).to eq("No")
  end

  describe "payment_account_reference" do
    it "returns the payment account reference when present" do
      details = Braintree::ApplePayDetails.new(
        :payment_account_reference => "V0010013019339005665779448477",
      )
      expect(details.payment_account_reference).to eq("V0010013019339005665779448477")
    end
  end
end
