Sha256: 3b6bf17674c7d69a3739be1396892fbdb66cea574876de0d77e235fcc14864b3

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'


describe "Refund", :vcr, class: Pin::Refund do
  before(:each) do
    Pin::Base.new(ENV["PIN_SECRET"], :test)
  end

  it "should list all refunds made to a charge given a token" do
    Pin::Refund.find('ch_S_3tP81Q9_sDngSv27gShQ')[0]['token'].should == "rf_O4lHrNzwXYmMmTbBq0ZLPw"
  end

  it "should return nothing if looking for a charge without a refund" do
    Pin::Refund.find('ch_rqPIWDK71YU46M4MAQHQKg').should == []
  end

  it "should return a page of refunds given a page and token" do
    Pin::Refund.find('ch_S_3tP81Q9_sDngSv27gShQ',1,true)[:response].should_not == []
  end

  xit "should create a refund for a given amount and charge" do
    @charge = Pin::Charges.search({query: "1000"})[2]
    Pin::Refund.create(@charge['token'], "400")['amount'].should == 400
  end

  #having issues with Pin raising a 500 error with this one.
  xit "should create a refund for the entire amount of a charge if no amount given" do
    @charge = Pin::Charges.search({query: "1000"})[1]
    @refund = Pin::Refund.create(@charge['token'])
    raise @refund.inspect
    @refund['amount'].should == @charge['amount']
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pin_up-0.7.5 spec/refund_spec.rb
pin_up-0.7.4 spec/refund_spec.rb
pin_up-0.7.3 spec/refund_spec.rb
pin_up-0.7.2 spec/refund_spec.rb
pin_up-0.7.1 spec/refund_spec.rb
pin_up-0.7.0 spec/refund_spec.rb
pin_up-0.6.4 spec/refund_spec.rb
pin_up-0.6.3 spec/refund_spec.rb
pin_up-0.6.2 spec/refund_spec.rb
pin_up-0.6.1 spec/refund_spec.rb
pin_up-0.5.0 spec/refund_spec.rb