Sha256: 15851942a0844a9878009066be06eed06079fbb542c7388b21b256f92349e25f

Contents?: true

Size: 1.81 KB

Versions: 7

Compression:

Stored size: 1.81 KB

Contents

require 'spec_helper.rb'

describe Paypal::Payment::Response::Info do
  let :attributes do
    {
      :NAME => 'Item Name',
      :DESC => 'Item Description',
      :QTY => '1',
      :NUMBER => '1',
      :ITEMCATEGORY => 'Digital',
      :ITEMWIDTHVALUE => '1.0',
      :ITEMHEIGHTVALUE => '2.0',
      :ITEMLENGTHVALUE => '3.0',
      :ITEMWEIGHTVALUE => '4.0'
    }
  end

  describe '.new' do
    subject { Paypal::Payment::Response::Item.new(attributes) }

    describe '#name' do
      subject { super().name }
      it { is_expected.to eq('Item Name') }
    end

    describe '#description' do
      subject { super().description }
      it { is_expected.to eq('Item Description') }
    end

    describe '#quantity' do
      subject { super().quantity }
      it { is_expected.to eq(1) }
    end

    describe '#category' do
      subject { super().category }
      it { is_expected.to eq('Digital') }
    end

    describe '#width' do
      subject { super().width }
      it { is_expected.to eq('1.0') }
    end

    describe '#height' do
      subject { super().height }
      it { is_expected.to eq('2.0') }
    end

    describe '#length' do
      subject { super().length }
      it { is_expected.to eq('3.0') }
    end

    describe '#weight' do
      subject { super().weight }
      it { is_expected.to eq('4.0') }
    end

    describe '#number' do
      subject { super().number }
      it { is_expected.to eq('1') }
    end

    context 'when non-supported attributes are given' do
      it 'should ignore them and warn' do
        _attr_ = attributes.merge(
          :ignored => 'Ignore me!'
        )
        expect(Paypal.logger).to receive(:warn).with(
          "Ignored Parameter (Paypal::Payment::Response::Item): ignored=Ignore me!"
        )
        Paypal::Payment::Response::Item.new _attr_
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ianfleeton-paypal-express-1.0.0 spec/paypal/payment/response/item_spec.rb
ianfleeton-paypal-express-0.8.7 spec/paypal/payment/response/item_spec.rb
ianfleeton-paypal-express-0.8.6 spec/paypal/payment/response/item_spec.rb
ianfleeton-paypal-express-0.8.5 spec/paypal/payment/response/item_spec.rb
ianfleeton-paypal-express-0.8.4 spec/paypal/payment/response/item_spec.rb
ianfleeton-paypal-express-0.8.3 spec/paypal/payment/response/item_spec.rb
ianfleeton-paypal-express-0.8.2 spec/paypal/payment/response/item_spec.rb