Sha256: 0234dcfa39452431c2ee3521339a92dcc272498f5ec0e9b7c872c1c9935ceb82

Contents?: true

Size: 946 Bytes

Versions: 4

Compression:

Stored size: 946 Bytes

Contents

require 'spec_helper.rb'

describe Paypal::Payment::Response::Amount do
  let :keys do
    Paypal::Payment::Response::Amount.optional_attributes
  end

  describe '.new' do
    it 'should not allow nil for attributes' do
      amount = Paypal::Payment::Response::Amount.new
      keys.each do |key|
        amount.send(key).should == 0
      end
    end

    it 'should treat all attributes as Numeric' do
      # Integer
      attributes = keys.inject({}) do |attributes, key|
        attributes.merge!(key => "100")
      end
      amount = Paypal::Payment::Response::Amount.new attributes
      keys.each do |key|
        amount.send(key).should == 100
      end

      # Float
      attributes = keys.inject({}) do |attributes, key|
        attributes.merge!(key => "10.25")
      end
      amount = Paypal::Payment::Response::Amount.new attributes
      keys.each do |key|
        amount.send(key).should == 10.25
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
paypal-express-0.0.4 spec/paypal/payment/response/amount_spec.rb
paypal-express-0.0.3 spec/paypal/payment/response/amount_spec.rb
paypal-express-0.0.2 spec/paypal/payment/response/amount_spec.rb
paypal-express-0.0.1 spec/paypal/payment/response/amount_spec.rb