Sha256: aa98b869a21ebee53587dd7e1c058c157ea6959c1c2489bef9038c71a8dfa071
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require "spec_helper" describe Paymill::Transaction do let(:valid_attributes) do { amount: 4200, status: "pending", description: "Test transaction.", livemode: false, creditcard: { card_type: "visa", country: "germany" }, client: "client_a013c" } end let (:transaction) do Paymill::Transaction.new(valid_attributes) end describe "#initialize" do it "initializes all attributes correctly" do transaction.amount.should eql(4200) transaction.status.should eql("pending") transaction.description.should eql("Test transaction.") transaction.livemode.should eql(false) transaction.creditcard[:card_type].should eql("visa") transaction.creditcard[:country].should eql("germany") transaction.client.should eql("client_a013c") end end describe ".find" do it "makes a new GET request using the correct API endpoint to receive a specific transaction" do Paymill.should_receive(:request).with(:get, "transactions/123", {}).and_return("data" => {}) Paymill::Transaction.find("123") end end describe ".all" do it "makes a new GET request using the correct API endpoint to receive all transactions" do Paymill.should_receive(:request).with(:get, "transactions/", {}).and_return("data" => {}) Paymill::Transaction.all end end describe ".create" do it "makes a new POST request using the correct API endpoint" do Paymill.should_receive(:request).with(:post, "transactions", valid_attributes).and_return("data" => {}) Paymill::Transaction.create(valid_attributes) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paymill-0.0.3 | spec/paymill/transaction_spec.rb |