Sha256: 325980ca0b513b621ade9c1aea3140ea6f920e7923e224c41f92463027e60ab0

Contents?: true

Size: 1.46 KB

Versions: 47

Compression:

Stored size: 1.46 KB

Contents

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

describe Braintree::PayPalAccount do
  describe "self.create" do
    it "raises an exception if attributes contain an invalid key" do
      expect do
        result = Braintree::PayPalAccount.create(
          :invalid_key => "bad stuff",
          :options => {
            :invalid_option => "bad option",
          }
        )
      end.to raise_error(ArgumentError, "invalid keys: invalid_key, options[invalid_option]")
    end
  end

  describe "self.update" do
    it "raises an exception if attributes contain an invalid key" do
      expect do
        Braintree::PayPalAccount.update("some_token", :invalid_key => 'val')
      end.to raise_error(ArgumentError, "invalid keys: invalid_key")
    end
  end

  describe "default?" do
    it "is true if the paypal account is the default payment method for the customer" do
      Braintree::PayPalAccount._new(:gateway, :default => true).default?.should == true
    end

    it "is false if the paypal account is not the default payment methodfor the customer" do
      Braintree::PayPalAccount._new(:gateway, :default => false).default?.should == false
    end
  end

  describe "timestamps" do
    it "exposes created_at and updated_at" do
      now = Time.now
      paypal_account = Braintree::PayPalAccount._new(:gateway, :updated_at => now, :created_at => now)

      paypal_account.created_at.should == now
      paypal_account.updated_at.should == now
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
braintree-3.3.0 spec/unit/braintree/paypal_account_spec.rb
braintree-3.2.0 spec/unit/braintree/paypal_account_spec.rb
braintree-3.1.0 spec/unit/braintree/paypal_account_spec.rb
braintree-3.0.1 spec/unit/braintree/paypal_account_spec.rb
braintree-2.104.1 spec/unit/braintree/paypal_account_spec.rb
braintree-2.104.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.103.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.102.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.101.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.100.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.99.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.98.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.97.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.96.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.95.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.94.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.93.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.92.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.91.0 spec/unit/braintree/paypal_account_spec.rb
braintree-2.90.0 spec/unit/braintree/paypal_account_spec.rb