Sha256: 57af768088bbeda9987372316f0ff673195f6f33e5f48b789c3b043997f38c12

Contents?: true

Size: 1.49 KB

Versions: 10

Compression:

Stored size: 1.49 KB

Contents

require 'test_helper'

class <%= class_name %>HelperTest < Test::Unit::TestCase
  include ActiveMerchant::Billing::Integrations
  
  def setup
    @helper = <%= class_name %>::Helper.new('order-500','cody@example.com', :amount => 500, :currency => 'USD')
  end
 
  def test_basic_helper_fields
    assert_field '', 'cody@example.com'

    assert_field '', '5.00'
    assert_field '', 'order-500'
  end
  
  def test_customer_fields
    @helper.customer :first_name => 'Cody', :last_name => 'Fauser', :email => 'cody@example.com'
    assert_field '', 'Cody'
    assert_field '', 'Fauser'
    assert_field '', 'cody@example.com'
  end

  def test_address_mapping
    @helper.billing_address :address1 => '1 My Street',
                            :address2 => '',
                            :city => 'Leeds',
                            :state => 'Yorkshire',
                            :zip => 'LS2 7EE',
                            :country  => 'CA'
   
    assert_field '', '1 My Street'
    assert_field '', 'Leeds'
    assert_field '', 'Yorkshire'
    assert_field '', 'LS2 7EE'
  end
  
  def test_unknown_address_mapping
    @helper.billing_address :farm => 'CA'
    assert_equal 3, @helper.fields.size
  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

10 entries across 10 versions & 2 rubygems

Version Path
johnideal-activemerchant-1.4.10 generators/integration/templates/helper_test.rb
johnideal-activemerchant-1.4.11 generators/integration/templates/helper_test.rb
johnideal-activemerchant-1.4.4 generators/integration/templates/helper_test.rb
johnideal-activemerchant-1.4.5 generators/integration/templates/helper_test.rb
johnideal-activemerchant-1.4.6 generators/integration/templates/helper_test.rb
johnideal-activemerchant-1.4.7 generators/integration/templates/helper_test.rb
johnideal-activemerchant-1.4.8 generators/integration/templates/helper_test.rb
smulube-activemerchant-1.5.1.4 generators/integration/templates/helper_test.rb
smulube-activemerchant-1.5.1.3 generators/integration/templates/helper_test.rb
smulube-activemerchant-1.5.1.2 generators/integration/templates/helper_test.rb