Sha256: dec23e71b89b958b4f456636a0ed3704b21beca6e64a0026e3cbc8b0c260149c

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"

describe Paymill::Preauthorization do
  let(:valid_attributes) do
    { 
      payment: "pay_d43cf0ee969d9847512b", 
      amount: 4200,
      currency: "EUR" 
    }
  end

  let (:preauthorization) do
    Paymill::Preauthorization.new(valid_attributes)
  end

  describe "#initialize" do
    it "initializes all attributes correctly" do
      preauthorization.payment.should eql("pay_d43cf0ee969d9847512b")
      preauthorization.amount.should eql(4200)
      preauthorization.currency.should eql("EUR")
    end
  end

  describe ".create" do
    it "makes a new POST request using the correct API endpoint" do
      Paymill.should_receive(:request).with(:post, "preauthorizations", valid_attributes).and_return("data" => {})
      Paymill::Preauthorization.create(valid_attributes)
    end
  end

  describe ".delete" do
    it "makes a new DELETE request using the correct API endpoint" do
      Paymill.should_receive(:request).with(:delete, "preauthorizations/123", {}).and_return(true)
      Paymill::Preauthorization.delete("123")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paymill-0.4.0 spec/paymill/preauthorization_spec.rb