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
creative-paypal-express-1.4.1 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-1.4.0 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-1.3.0 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-1.2.1 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-1.2.0 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-1.1.0 spec/paypal/payment/common/amount_spec.rb
dfg-paypal-0.8.2 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-1.0.1.dev2 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-1.0.1.dev1 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-1.0.0 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-0.8.2.4 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-0.8.2.3 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-0.8.2.2 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-0.8.2.1 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-0.8.2 spec/paypal/payment/common/amount_spec.rb
creative-paypal-express-0.8.1 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.8.1 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.8.0 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.7.1 spec/paypal/payment/common/amount_spec.rb
paypal-express-0.7.0 spec/paypal/payment/common/amount_spec.rb