Sha256: b90809e4b7c1222d6c0d29975a4556cba5d2d177927ff1f176f9c36ff3b9d830

Contents?: true

Size: 1005 Bytes

Versions: 62

Compression:

Stored size: 1005 Bytes

Contents

require 'pry'
require 'active_shipping'
require 'test_helper'

include ActiveShipping
include ActiveShipping::Test::Credentials
include ActiveShipping::Test::Fixtures

def create_carrier(klass, creds)
  options = credentials(creds).merge(test: true)
  klass.new(options)
rescue NoCredentialsFound
  STDERR.puts "No credentials found for #{creds}"
  nil
end

def px(xml_s)
  puts Nokogiri.XML(xml_s)
end

def reload!
  # Supress a billion constant redefinition warnings
  warn_level = $VERBOSE
  $VERBOSE = nil

  files = $LOADED_FEATURES.select { |feat| feat =~ /\/active_shipping\// }
  files.each { |file| load file }

  $VERBOSE = warn_level
  files
end

# Prebuilt objects for most common carriers
@canpo    = create_carrier(CanadaPost, :canada_post)
@fedex    = create_carrier(FedEx, :fedex)
@shipwire = create_carrier(Shipwire, :shipwire)
@usps     = create_carrier(USPS, :usps)
# Tips: call reload! to reload all the active_shipping files, use fixtures from test_helpers for parameters
binding.pry

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 vendor/active_shipping/test/console.rb
workarea-core-3.5.26 vendor/active_shipping/test/console.rb
workarea-core-3.4.45 vendor/active_shipping/test/console.rb
workarea-core-3.5.25 vendor/active_shipping/test/console.rb
workarea-core-3.5.23 vendor/active_shipping/test/console.rb
workarea-core-3.4.44 vendor/active_shipping/test/console.rb
workarea-core-3.5.22 vendor/active_shipping/test/console.rb
workarea-core-3.4.43 vendor/active_shipping/test/console.rb
workarea-core-3.5.21 vendor/active_shipping/test/console.rb
workarea-core-3.4.42 vendor/active_shipping/test/console.rb
workarea-core-3.5.20 vendor/active_shipping/test/console.rb
workarea-core-3.4.41 vendor/active_shipping/test/console.rb
workarea-core-3.5.19 vendor/active_shipping/test/console.rb
workarea-core-3.4.40 vendor/active_shipping/test/console.rb
workarea-core-3.5.18 vendor/active_shipping/test/console.rb
workarea-core-3.4.39 vendor/active_shipping/test/console.rb
workarea-core-3.5.17 vendor/active_shipping/test/console.rb
workarea-core-3.4.38 vendor/active_shipping/test/console.rb
workarea-core-3.5.16 vendor/active_shipping/test/console.rb
workarea-core-3.4.37 vendor/active_shipping/test/console.rb