Sha256: f6c1e9119e0ab6b0a556a85350d926f89dc1a5a27d5c5f22d0cff044241b69b1
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' module Peddler module Refunds describe Batch do let(:transport) do transport = Peddler::Transport.new transport.legacize_request transport end let(:refunds) { Peddler::Refunds::Batch.new(transport) } let(:refund) do Peddler::Refunds::Item.new( :order_id => "123-1234567-1234567", :payments_transaction_id => "12341234567890", :refund_amount => 10.00, :reason => "CouldNotShip", :message => "With our apologies" ) end it "adds items to batch" do refunds.batch.size.should == 0 refunds << refund refunds.batch.size.should == 1 end it "generates an upload file" do refunds << refund refunds.file_content.should == "order-id\tpayments-transaction-id\trefund-amount\treason\tmessage\r\n123-1234567-1234567\t12341234567890\t10.0\tCouldNotShip\tWith our apologies\r\n" end it "uploads batch" do transport.stub!(:execute_request).and_return("<Success>SUCCESS</Success>") refunds << refund refunds.upload.should == true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
peddler-0.3.1 | spec/peddler/refunds_spec.rb |
peddler-0.3.0 | spec/peddler/refunds_spec.rb |