0
@@ -20,6 +20,8 @@ module Test
0
LOCAL_CREDENTIALS = ENV['HOME'] + '/.active_merchant/fixtures.yml' unless defined?(LOCAL_CREDENTIALS)
0
DEFAULT_CREDENTIALS = File.dirname(__FILE__) + '/fixtures.yml' unless defined?(DEFAULT_CREDENTIALS)
0
+ MODEL_FIXTURES = File.dirname(__FILE__) + '/fixtures/' unless defined?(MODEL_FIXTURES)
0
@@fixtures ||= load_fixtures
0
@@ -34,6 +36,13 @@ module Test
0
file = File.exists?(LOCAL_CREDENTIALS) ? LOCAL_CREDENTIALS : DEFAULT_CREDENTIALS
0
yaml_data = YAML.load(File.read(file))
0
+ model_fixtures = Dir.glob(File.join(MODEL_FIXTURES,'**','*.yml'))
0
+ model_fixtures.each do |file|
0
+ name = File.basename(file, '.yml')
0
+ yaml_data[name] = YAML.load(File.read(file))
0
symbolize_keys(yaml_data)
0
@@ -49,6 +58,24 @@ module Test
0
hash.each{|k,v| symbolize_keys(v)}
0
+ def xml_logs(response_object, options={})
0
+ name = options[:name] || Time.new.strftime('%Y%m%d%H%M%S')
0
+ carrier_name = @carrier.name rescue ''
0
+ path = options[:path] || File.join(ENV['HOME'], '.active_merchant', 'shipping', 'logs', carrier_name)
0
+ methods = {'request' => 'request', 'response' => 'xml'}
0
+ methods.each do |suffix, method|
0
+ file = File.join(path, ([name,suffix].join('_') + '.xml'))
0
+ while File.exist?(file) do
0
+ file = File.join(path, ([name + (i += 1).to_s,suffix].join('_') + '.xml'))
0
+ File.open(file, 'w+') do |file|
0
+ file.puts response_object.send(method)
0
@@ -90,6 +117,60 @@ module ActiveMerchant
0
:phone => '1-310-285-1013',
0
:fax => '1-310-275-8159'),
0
+ :real_home_as_commercial => Location.new(
0
+ :address1 => '7926 Woodvale Circle',
0
+ :address_type => 'commercial'), # means that UPS will default to commercial if it doesn't know
0
+ :fake_home_as_commercial => Location.new(
0
+ :address1 => '123 fake st.',
0
+ :address_type => 'commercial'),
0
+ :real_google_as_commercial => Location.new(
0
+ :city => 'Mountain View',
0
+ :address1 => '1600 Amphitheatre Parkway',
0
+ :address_type => 'commercial'),
0
+ :real_google_as_residential => Location.new(
0
+ :city => 'Mountain View',
0
+ :address1 => '1600 Amphitheatre Parkway',
0
+ :address_type => 'residential'), # means that will default to residential if it doesn't know
0
+ :fake_google_as_commercial => Location.new(
0
+ :city => 'Mountain View',
0
+ :address1 => '123 bogusland dr.',
0
+ :address_type => 'commercial'),
0
+ :fake_google_as_residential => Location.new(
0
+ :city => 'Mountain View',
0
+ :address1 => '123 bogusland dr.',
0
+ :address_type => 'residential'), # means that will default to residential if it doesn't know
0
+ :fake_home_as_residential => Location.new(
0
+ :address1 => '123 fake st.',
0
+ :address_type => 'residential'),
0
+ :real_home_as_residential => Location.new(
0
+ :address1 => '7926 Woodvale Circle',
0
+ :address_type => 'residential'),
0
:london => Location.new(
Comments
No one has commented yet.