Sha256: 0b7b4b1adde0992d661428c45b98f9dcd4d1f734e3a0a729c5a92fbfd8cb049f
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require "helper" describe CentrumFaktur::Payment do before do CentrumFaktur.configure do |config| config.login = "john" config.password = "secret" config.subdomain = "john" end end it "gets payment" do FakeWeb.register_uri(:get, "https://john:secret@john.centrumfaktur.pl/api/1.0/invoices/22933/payments", :response => fixture("payments.txt") ) response = CentrumFaktur::Payment.list("/api/1.0/invoices/22933/payments") expected = [{ "date" => "2007-01-01", "amount" => 10.0, "resource_uri" => "/api/1.0/users/749/", "created" => "2011-06-14 20:06:36" }] assert_equal expected, response end it "creates payment" do FakeWeb.register_uri(:post, "https://john:secret@john.centrumfaktur.pl/api/1.0/invoices/22933/payments", :response => fixture("new_payment.txt")) response = CentrumFaktur::Payment.create("/api/1.0/invoices/22933/payments", {:date => "2011-06-10", :amount => 99.00} ) expected = { "date" => "2011-06-10", "amount" => 99.00, "created" => "2012-01-01", "resource_uri" => "/api/1.0/payments/99999/" } assert_equal expected, response end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
centrum_faktur-0.2.2 | test/payments_test.rb |
centrum_faktur-0.2.1 | test/payments_test.rb |