Sha256: 6e5b1c4a0899cf73559a0ba6fd69a7c02e2354a777e261096ea32c7edf3e59d3

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

require 'helper'

module Mollie
  class Customer
    class MandateTest < Test::Unit::TestCase
      def test_setting_attributes
        attributes = {
          id:               "mdt_qtUgejVgMN",
          status:           "valid",
          method:           "creditcard",
          customer_id:      "cst_R6JLAuqEgm",
          details:          {
            card_holder:      "John Doe",
            card_expiry_date: "2016-03-31"
          },
          created_datetime: "2016-04-13T11:32:38.0Z"
        }

        mandate = Mandate.new(attributes)

        assert_equal 'mdt_qtUgejVgMN', mandate.id
        assert_equal 'valid', mandate.status
        assert_equal 'creditcard', mandate.method
        assert_equal 'cst_R6JLAuqEgm', mandate.customer_id
        assert_equal Time.parse('2016-04-13T11:32:38.0Z'), mandate.created_datetime

        assert_equal 'John Doe', mandate.details.card_holder
        assert_equal '2016-03-31', mandate.details.card_expiry_date
        assert_equal nil, mandate.details.non_existing
      end

      def test_valid_invalid
        mandate = Mandate.new(status: Mandate::STATUS_VALID)
        assert mandate.valid?
        assert !mandate.invalid?

        mandate = Mandate.new(status: Mandate::STATUS_INVALID)
        assert !mandate.valid?
        assert mandate.invalid?
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mollie-api-ruby-3.1.5 test/mollie/customer/mandate_test.rb
mollie-api-ruby-3.1.4 test/mollie/customer/mandate_test.rb
mollie-api-ruby-3.1.4.pre.beta test/mollie/customer/mandate_test.rb
mollie-api-ruby-3.1.3 test/mollie/customer/mandate_test.rb
mollie-api-ruby-3.1.2 test/mollie/customer/mandate_test.rb
mollie-api-ruby-3.1.1 test/mollie/customer/mandate_test.rb
mollie-api-ruby-3.1.0 test/mollie/customer/mandate_test.rb