Sha256: dd57138a83e653b2cd605e2ef33473a2954aaba263673795a098ab0b6e69babf

Contents?: true

Size: 936 Bytes

Versions: 56

Compression:

Stored size: 936 Bytes

Contents

require 'spec_helper.rb'

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

  describe '.new' do
    it 'should not allow nil for attributes' do
      amount = Paypal::Payment::Common::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::Common::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::Common::Amount.new attributes
      keys.each do |key|
        amount.send(key).should == 10.25
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 3 rubygems

Version Path
paypal-express-0.6.0 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.5.5 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.5.4 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.5.3 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.5.2 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.5.1 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.5.0 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.4.7 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.5.0.alpha spec/paypal/payment/common/amount_spec.rb
paypal-express-0.4.6 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.4.5 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.4.4 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.4.3 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.4.2 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.4.1 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.4.0 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.4.0.alpha spec/paypal/payment/common/amount_spec.rb
paypal-express-0.3.1 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.3.0 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.2.10 spec/paypal/payment/common/amount_spec.rb