Sha256: 287bcebb4c54f43be8222c910e4122fbc37ff26bc1b278c4054d0f53f447ec47

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require File.dirname(__FILE__) + '/../../../test_helper'

class QuickpayHelperTest < Test::Unit::TestCase
  include MerbMerchant::Billing::Integrations
  
  def setup
    @helper = Quickpay::Helper.new('order-500','24352435', :amount => 500, :currency => 'USD')
    @helper.md5secret "mysecretmd5string"
    @helper.return_url 'http://example.com/ok'
    @helper.cancel_return_url 'http://example.com/cancel'
    @helper.notify_url 'http://example.com/notify'
  end
 
  def test_basic_helper_fields
    assert_field 'merchant', '24352435'
    assert_field 'amount', '500'
    assert_field 'ordernumber', 'order500'
  end
  
  def test_generate_md5string
    assert_equal '3authorize24352435daorder500500USDhttp://example.com/okhttp://example.com/cancelhttp://example.com/notify00mysecretmd5string', 
                 @helper.generate_md5string
  end
  
  def test_generate_md5check
    assert_equal '31a0a94ce953208d05f3f3d255fff31f', @helper.generate_md5check
  end
  
  def test_unknown_mapping
    assert_nothing_raised do
      @helper.company_address :address => '500 Dwemthy Fox Road'
    end
  end
  
  def test_setting_invalid_address_field
    fields = @helper.fields.dup
    @helper.billing_address :street => 'My Street'
    assert_equal fields, @helper.fields
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
merb_merchant-1.4.1 test/unit/integrations/helpers/quickpay_helper_test.rb