Sha256: 5586b3cd850958e61355e601d776e5c422c700304bd9e876674b770d0571f0ec

Contents?: true

Size: 905 Bytes

Versions: 1

Compression:

Stored size: 905 Bytes

Contents

# encoding: utf-8
#require 'rubygems'

if RUBY_VERSION.match("1.9")
  require 'simplecov'
  SimpleCov.start do
    add_filter 'test'
  end
end

require 'minitest/autorun'
require 'pathname'
require 'yaml'
#require 'fakeweb'
require 'mocha/setup'
require File.join(File.dirname(__FILE__), '..', 'lib', 'amazon', 'mws')

include Amazon::MWS

def xml_for(name, code)
  file = File.open(Pathname.new(File.dirname(__FILE__)).expand_path.dirname.join("examples/xml/#{name}.xml"),'rb')
  mock_response(code, {:content_type=>'text/xml', :body=>file.read})
end

def mock_response(code, options={})
  body = options[:body]
  content_type = options[:content_type]
  response = Net::HTTPResponse.send(:response_class, code.to_s).new("1.0", code.to_s, "message")
  response.instance_variable_set(:@body, body)
  response.instance_variable_set(:@read, true)
  response.content_type = content_type
  return response
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amazon-mws-plus-0.1.3 test/test_helper.rb