Sha256: 9906844e9a88b9f2cc74d90d10ea8185fe1d81adcbb6a577bc28ab5d3fdc1099

Contents?: true

Size: 1000 Bytes

Versions: 4

Compression:

Stored size: 1000 Bytes

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

  it 'should create a refund for a given amount and charge' do
    options = { email: 'dNitza@gmail.com', description: 'A new charge from testing Pin gem', amount: '400', currency: 'AUD', ip_address: '127.0.0.1', customer_token: 'cus_8ImkZdEZ6BXUA6NcJDZg_g' }
    @charge = Pin::Charges.create(options)
    Pin::Refund.create(@charge['token'], '400')['amount'].should == 400
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pin_up-1.0.0 spec/refund_spec.rb
pin_up-0.10.1 spec/refund_spec.rb
pin_up-0.10.0 spec/refund_spec.rb
pin_up-0.9.5 spec/refund_spec.rb