Sha256: e4ea7f60dccab1526b8fd2ff440d173d2ca47504f807da00507823d18449cd57

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 KB

Contents

require 'helper'

module Mollie
  class RefundTest < Test::Unit::TestCase
    def test_setting_attributes
      attributes = {
        id:                "re_4qqhO89gsT",
        payment:           {
          id: "tr_WDqYK6vllg",
        },
        amount:            "5.95",
        refunded_datetime: "2016-10-08T07:59:53.0Z",
        status:            "pending"
      }

      refund = Refund.new(attributes)

      assert_equal "re_4qqhO89gsT", refund.id
      assert_equal BigDecimal.new("5.95"), refund.amount
      assert_kind_of Payment, refund.payment
      assert_equal Time.parse("2016-10-08T07:59:53.0Z"), refund.refunded_datetime
      assert_equal Refund::STATUS_PENDING, refund.status
    end

    def test_pending?
      assert Refund.new(status: Refund::STATUS_PENDING).pending?
      assert !Refund.new(status: 'not-pending').pending?
    end

    def test_processing?
      assert Refund.new(status: Refund::STATUS_PROCESSING).processing?
      assert !Refund.new(status: 'not-processing').processing?
    end

    def test_refunded?
      assert Refund.new(status: Refund::STATUS_REFUNDED).refunded?
      assert !Refund.new(status: 'not-refunded').refunded?
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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