Sha256: b30f4298e83f551d7f229d9665d04e658c73626c06aa372f1f95f9f54936ca10

Contents?: true

Size: 1.22 KB

Versions: 18

Compression:

Stored size: 1.22 KB

Contents

require 'bundler/setup'

require 'active_fulfillment'

require 'minitest/autorun'
require 'mocha/setup'
require 'timecop'
require 'pry'

require 'logger'
ActiveFulfillment::Service.logger = Logger.new(nil)

# This makes sure that Minitest::Test exists when an older version of Minitest
# (i.e. 4.x) is required by ActiveSupport.
unless defined?(Minitest::Test)
  Minitest::Test = MiniTest::Unit::TestCase
end

module ActiveFulfillment::Test
  module Fixtures
    LOCAL_CREDENTIALS = ENV['HOME'] + '/.active_fulfillment/fixtures.yml' unless defined?(LOCAL_CREDENTIALS)
    DEFAULT_CREDENTIALS = File.dirname(__FILE__) + '/fixtures.yml' unless defined?(DEFAULT_CREDENTIALS)

    def fixtures(key)
      data = all_fixtures[key] || raise(StandardError, "No fixture data was found for '#{key}'")

      data.dup
    end

    def xml_fixture(path) # where path is like 'usps/beverly_hills_to_ottawa_response'
      File.read(File.join(File.dirname(__FILE__),'fixtures','xml',"#{path}.xml"))
    end

    private

    def all_fixtures
      @@fixtures ||= load_fixtures
    end

    def load_fixtures
      file = File.exists?(LOCAL_CREDENTIALS) ? LOCAL_CREDENTIALS : DEFAULT_CREDENTIALS
      YAML.load(File.read(file)).deep_symbolize_keys
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
active_fulfillment-3.2.11 test/test_helper.rb
active_fulfillment-3.2.10 test/test_helper.rb
active_fulfillment-3.2.8 test/test_helper.rb
active_fulfillment-3.2.7 test/test_helper.rb
active_fulfillment-3.2.6 test/test_helper.rb
active_fulfillment-3.2.5 test/test_helper.rb
active_fulfillment-3.2.4 test/test_helper.rb
active_fulfillment-3.2.3 test/test_helper.rb
active_fulfillment-3.2.2 test/test_helper.rb
active_fulfillment-3.2.1 test/test_helper.rb
active_fulfillment-3.2.0 test/test_helper.rb
active_fulfillment-3.1.1 test/test_helper.rb
active_fulfillment-3.1.0 test/test_helper.rb
active_fulfillment-3.0.8 test/test_helper.rb
active_fulfillment-3.0.7 test/test_helper.rb
active_fulfillment-3.0.6 test/test_helper.rb
active_fulfillment-3.0.5 test/test_helper.rb
active_fulfillment-3.0.4 test/test_helper.rb