Sha256: 5592cb7167d60a73faaaa84be223bcb70eb7e0bef30754308c2f662d529176aa

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

describe IdealMollie::IdealException do
  context "#new_payment" do
    it "should throw exception when no config is set" do
      VCR.use_cassette("new_payment") do
        config = IdealMollie::Config
        config.reset!
        expect { IdealMollie.new_payment(1234, "exception test", "0031") }.
          to raise_error(IdealMollie::IdealException, /A fetch was issued without specification of 'partnerid'./)
      end
    end
    it "should throw an exception when a unknown account is specified" do
      config = IdealMollie::Config
      config.test_mode = false
      config.partner_id = 123465
      config.report_url = "http://example.org/report"
      config.return_url = "http://example.org/return"

      VCR.use_cassette("new_payment") do
        expect { IdealMollie.new_payment(1234, "exception test", "0031") }.
          to raise_error(IdealMollie::IdealException, /This account does not exist or is suspended./)
      end
    end
  end
  context "#check_payment" do
    it "should raise an exception when a invalid transaction_id is asked" do
      config = IdealMollie::Config
      config.test_mode = false
      config.partner_id = 654321
      config.report_url = "http://example.org/report"
      config.return_url = "http://example.org/return"

      VCR.use_cassette("check_payment") do
        expect { IdealMollie.check_payment("482d599bbcc7795727650330ad65fe9b") }.
          to raise_error(IdealMollie::IdealException, /This is an unknown order./)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ideal-mollie-0.0.2 spec/ideal_exception_spec.rb