Sha256: 9fc5463da471ff75e600caae32f37c56a10a38bf3871b5acf08d6f0f70a01cfb

Contents?: true

Size: 825 Bytes

Versions: 2

Compression:

Stored size: 825 Bytes

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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paymill-0.3.0 spec/paymill/preauthorization_spec.rb
paymill-0.2.2 spec/paymill/preauthorization_spec.rb