active_shipping 1.0.0.pre3 → 1.0.0.pre4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 893b67f5102c88b62a062968374250a09ac2e266
4
- data.tar.gz: 4438e27c1d8d4f70abbcbdd59ba5a33f679d0a3d
3
+ metadata.gz: ce37970d12bcb0e0ad9b464cdf4f772a69dc77b6
4
+ data.tar.gz: fbc3624b76f5ae90378d39bb6dcdd348466bafc2
5
5
  SHA512:
6
- metadata.gz: 4f0286ca3df78d1803da401396e755254dda1d4792384b4f454ce272712781469d98b6cfc2d7d10fb4b7658ba6e84da452745b99562d7fc8743932f4d326ef74
7
- data.tar.gz: 0743b1728a552e6bafbc6fd4a3ec76bef05a6ed844219d9915bbbd77bbdadc450dc315b8f52f4552621d362ac3f43c3e750cc2a45b773bc7f2bc1d131df03029
6
+ metadata.gz: 1326d49a7cd30d4c77473c479aa5fe0da42d6fa861bd061476ce90a63ccdd0360d5dac556fb28896fccdb73529fa9331e43925eb13f660842aaa0ae710d113cd
7
+ data.tar.gz: 409147bef83cc2e1b2296a96c410cbc03df24fa84bddf20d4612ee40f29789cd0355ff9629522a720a228cfa9b004cf6fc46b26ba0ff434dbf44a5bb3bc5ddce
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,5 @@
1
1
  language: ruby
2
- script: bundle exec rake
2
+ script: bundle exec rake test
3
3
  sudo: false
4
4
 
5
5
  rvm:
@@ -12,3 +12,8 @@ gemfile:
12
12
  - Gemfile.activesupport40
13
13
  - Gemfile.activesupport41
14
14
  - Gemfile.activesupport42
15
+
16
+ env:
17
+ global:
18
+ - ACTIVESHIPPING_NEW_ZEALAND_POST_KEY=4d9dc0f0-dda0-012e-066f-000c29b44ac0
19
+ - ACTIVESHIPPING_CANADA_POST_LOGIN=CPC_DEMO_XML
data/Rakefile CHANGED
@@ -1,14 +1,22 @@
1
- require 'bundler'
2
1
  require 'bundler/gem_tasks'
3
2
  require 'rake/testtask'
4
3
 
4
+ desc "Run the unit and functioknal remote tests"
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << "test"
7
+ t.pattern = 'test/**/*_test.rb'
8
+ t.verbose = true
9
+ end
10
+
5
11
  namespace :test do
6
- Rake::TestTask.new(:units) do |t|
12
+ desc "Run unit tests"
13
+ Rake::TestTask.new(:unit) do |t|
7
14
  t.libs << "test"
8
15
  t.pattern = 'test/unit/**/*_test.rb'
9
16
  t.verbose = true
10
17
  end
11
18
 
19
+ desc "Run functional remote tests"
12
20
  Rake::TestTask.new(:remote) do |t|
13
21
  t.libs << "test"
14
22
  t.pattern = 'test/remote/*_test.rb'
@@ -16,8 +24,4 @@ namespace :test do
16
24
  end
17
25
  end
18
26
 
19
- desc "Default Task"
20
- task :default => 'test:units'
21
-
22
- desc "Run the unit and remote tests"
23
- task :test => %w(test:units test:remote)
27
+ task :default => 'test'
@@ -1,5 +1,5 @@
1
1
  lib = File.expand_path('../lib/', __FILE__)
2
- $:.unshift lib unless $:.include?(lib)
2
+ $:.unshift(lib) unless $:.include?(lib)
3
3
 
4
4
  require 'active_shipping/version'
5
5
 
@@ -540,7 +540,12 @@ module ActiveShipping
540
540
  tracking_details = xml.root.xpath('TrackInfo/TrackDetail')
541
541
 
542
542
  tracking_summary = xml.root.at('TrackInfo/TrackSummary')
543
- tracking_details << tracking_summary
543
+ if tracking_details.length > 0
544
+ tracking_details << tracking_summary
545
+ else
546
+ success = false
547
+ message = tracking_summary.text
548
+ end
544
549
 
545
550
  tracking_number = xml.root.at('TrackInfo').attributes['ID'].value
546
551
 
@@ -589,23 +594,12 @@ module ActiveShipping
589
594
  !document.at('Error').nil?
590
595
  end
591
596
 
592
- def no_record?(document)
593
- summary_node = track_summary_node(document)
594
- if summary_node
595
- summary = summary_node.text
596
- RESPONSE_ERROR_MESSAGES.detect { |re| summary =~ re }
597
- summary =~ /There is no record of that mail item/ || summary =~ /This Information has not been included in this Test Server\./
598
- else
599
- false
600
- end
601
- end
602
-
603
597
  def tracking_info_error?(document)
604
598
  !document.root.at('TrackInfo/Error').nil?
605
599
  end
606
600
 
607
601
  def response_success?(document)
608
- !(has_error?(document) || no_record?(document) || tracking_info_error?(document))
602
+ !(has_error?(document) || tracking_info_error?(document))
609
603
  end
610
604
 
611
605
  def response_message(document)
@@ -1,3 +1,3 @@
1
1
  module ActiveShipping
2
- VERSION = "1.0.0.pre3"
2
+ VERSION = "1.0.0.pre4"
3
3
  end
@@ -1,47 +1,61 @@
1
+ # The following file is used to specify credentials for the remote tests.
2
+ # In the CI environment, the environment are populated with proper values.
3
+ # If the values are not set, the remote tests will be skipped.
4
+ #
5
+ # If you want to run remote tests locally, you can set these environment
6
+ # variables, or you can create a file `~/.active_shipping/credentials.yml`,
7
+ # and set the values in there. This way you won't accidentially commit them
8
+ # to git.
9
+
1
10
  usps:
2
- login: APIKey
11
+ login: <%= ENV['ACTIVESHIPPING_USPS_LOGIN'] %>
12
+
3
13
  ups:
4
- key: XmlAccessKey
5
- login: UPSDotComLogin
6
- password: UPSDotComPassword
14
+ key: <%= ENV['ACTIVESHIPPING_UPS_LOGIN'] %>
15
+ login: <%= ENV['ACTIVESHIPPING_UPS_KEY'] %>
16
+ password: <%= ENV['ACTIVESHIPPING_UPS_PASSWORD'] %>
7
17
 
8
18
  fedex:
9
- account: FedExAccountNumber
10
- login: FedExMeterNumber
11
- password: FedExMeterPassword
12
- test: true
13
- key: FedExDeveloperKey
14
-
15
- fedex_freight:
16
- account: FedExFreightAccountNumber
17
- shipping_address1: FedExShippingAddress1
18
- shipping_address2: FedExShippingAddress2
19
- shipping_city: FedExShippingCity
20
- shipping_postal_code: FedExShippingPostalCode
21
- shipping_state: FedExShippingState
22
- shipping_country: FedExShippingCountry
23
- billing_address1: FedExBillingAddress1
24
- billing_address2: FedExBillingAddress2
25
- billing_city: FedExBillingCity
26
- billing_postal_code: FedExBillingPostalCode
27
- billing_state: FedExBillingState
28
- billing_country: FedExBillingCountry
29
- payment_type: SENDER
30
- freight_class: CLASS_050
31
- packaging: PALLET
32
- role: SHIPPER
19
+ account: <%= ENV['ACTIVESHIPPING_FEDEX_ACCOUNT'] %>
20
+ login: <%= ENV['ACTIVESHIPPING_FEDEX_LOGIN'] %>
21
+ password: <%= ENV['ACTIVESHIPPING_FEDEX_PASSWORD'] %>
22
+ key: <%= ENV['ACTIVESHIPPING_FEDEX_KEY'] %>
33
23
 
34
24
  shipwire:
35
- login: EmailAddress
36
- password: Password
25
+ login: <%= ENV['ACTIVESHIPPING_SHIPWIRE_LOGIN'] %>
26
+ password: <%= ENV['ACTIVESHIPPING_SHIPWITE_PASSWORD'] %>
37
27
 
38
28
  canada_post:
39
- login: CPC_DEMO_XML
29
+ login: <%= ENV['ACTIVESHIPPING_CANADA_POST_LOGIN'] %>
40
30
 
41
31
  new_zealand_post:
42
- key: '4d9dc0f0-dda0-012e-066f-000c29b44ac0'
32
+ key: <%= ENV['ACTIVESHIPPING_NEW_ZEALAND_POST_KEY'] %>
43
33
 
44
34
  canada_post_pws:
45
- platform_id: 12345678
46
- api_key: 1234789
47
- secret: 1245743
35
+ platform_id: <%= ENV['ACTIVESHIPPING_CANADA_POST_PWS_PLATFORM_ID'] %>
36
+ api_key: <%= ENV['ACTIVESHIPPING_CANADA_POST_PWS_API_KEY'] %>
37
+ secret: <%= ENV['ACTIVESHIPPING_CANADA_POST_PWS_SECRET'] %>
38
+
39
+ stamps:
40
+ integration_id: <%= ENV['ACTIVESHIPPING_STAMPS_INTEGRATION_ID'] %>
41
+ username: <%= ENV['ACTIVESHIPPING_STAMPS_USERNAME'] %>
42
+ password: <%= ENV['ACTIVESHIPPING_STAMPS_PASSWORD'] %>
43
+
44
+ # fedex_freight:
45
+ # account: FedExFreightAccountNumber
46
+ # shipping_address1: FedExShippingAddress1
47
+ # shipping_address2: FedExShippingAddress2
48
+ # shipping_city: FedExShippingCity
49
+ # shipping_postal_code: FedExShippingPostalCode
50
+ # shipping_state: FedExShippingState
51
+ # shipping_country: FedExShippingCountry
52
+ # billing_address1: FedExBillingAddress1
53
+ # billing_address2: FedExBillingAddress2
54
+ # billing_city: FedExBillingCity
55
+ # billing_postal_code: FedExBillingPostalCode
56
+ # billing_state: FedExBillingState
57
+ # billing_country: FedExBillingCountry
58
+ # payment_type: SENDER
59
+ # freight_class: CLASS_050
60
+ # packaging: PALLET
61
+ # role: SHIPPER
@@ -1,3 +1,2 @@
1
- <?xml version="1.0"?>
2
- <TrackResponse><TrackInfo ID="ABC123XYZ"><TrackSummary>There is no record of that mail item. If it was mailed recently, it may not yet be tracked. Please try again later.</TrackSummary></TrackInfo>
3
- </TrackResponse>
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <TrackResponse><TrackInfo ID="abc123xyz"><TrackSummary>The Postal Service could not locate the tracking information for your request. Please verify your tracking number and try again later.</TrackSummary></TrackInfo></TrackResponse>
@@ -3,7 +3,7 @@
3
3
  require 'test_helper'
4
4
 
5
5
  # All remote tests require Canada Post development environment credentials
6
- class CanadaPostPWSPlatformTest < Minitest::Test
6
+ class RemoteCanadaPostPWSPlatformTest < Minitest::Test
7
7
  include ActiveShipping::Test::Credentials
8
8
  include ActiveShipping::Test::Fixtures
9
9
 
@@ -95,6 +95,8 @@ class CanadaPostPWSPlatformTest < Minitest::Test
95
95
  @customer_number = @login[:customer_number]
96
96
  @customer_api_key = @login[:customer_api_key]
97
97
  @customer_secret = @login[:customer_secret]
98
+ rescue NoCredentialsFound => e
99
+ skip(e.message)
98
100
  end
99
101
 
100
102
  def build_options
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class CanadaPostPWSTest < Minitest::Test
3
+ class RemoteCanadaPostPWSTest < Minitest::Test
4
4
  # All remote tests require Canada Post development environment credentials
5
5
  include ActiveShipping::Test::Credentials
6
6
  include ActiveShipping::Test::Fixtures
@@ -84,6 +84,8 @@ class CanadaPostPWSTest < Minitest::Test
84
84
  :tracking_number => "11111118901234",
85
85
  :label_url => "https://ct.soa-gw.canadapost.ca/ers/artifact/#{@login[:api_key]}/20238/0"
86
86
  }
87
+ rescue NoCredentialsFound => e
88
+ skip(e.message)
87
89
  end
88
90
 
89
91
  def test_rates
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class CanadaPostTest < Minitest::Test
3
+ class RemoteCanadaPostTest < Minitest::Test
4
4
  include ActiveShipping::Test::Credentials
5
5
 
6
6
  def setup
@@ -10,6 +10,8 @@ class CanadaPostTest < Minitest::Test
10
10
  @origin = {:address1 => "61A York St", :city => "Ottawa", :province => "Ontario", :country => "Canada", :postal_code => "K1N 5T2"}
11
11
  @destination = {:city => "Beverly Hills", :state => "CA", :country => "United States", :postal_code => "90210"}
12
12
  @line_items = [Package.new(500, [2, 3, 4], :description => "a box full of stuff", :value => 25)]
13
+ rescue NoCredentialsFound => e
14
+ skip(e.message)
13
15
  end
14
16
 
15
17
  def test_valid_credentials
@@ -1,11 +1,13 @@
1
1
  require 'test_helper'
2
2
 
3
- class FedExTest < Minitest::Test
3
+ class RemoteFedExTest < Minitest::Test
4
4
  include ActiveShipping::Test::Credentials
5
5
  include ActiveShipping::Test::Fixtures
6
6
 
7
7
  def setup
8
8
  @carrier = FedEx.new(credentials(:fedex).merge(:test => true))
9
+ rescue NoCredentialsFound => e
10
+ skip(e.message)
9
11
  end
10
12
 
11
13
  def test_valid_credentials
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class NewZealandPostTest < Minitest::Test
3
+ class RemoteNewZealandPostTest < Minitest::Test
4
4
  include ActiveShipping::Test::Credentials
5
5
  include ActiveShipping::Test::Fixtures
6
6
 
@@ -9,6 +9,8 @@ class NewZealandPostTest < Minitest::Test
9
9
  @wellington = location_fixtures[:wellington]
10
10
  @auckland = location_fixtures[:auckland]
11
11
  @ottawa = location_fixtures[:ottawa]
12
+ rescue NoCredentialsFound => e
13
+ skip(e.message)
12
14
  end
13
15
 
14
16
  def test_valid_credentials
@@ -9,6 +9,8 @@ class RemoteShipwireTest < Minitest::Test
9
9
  @item1 = { :sku => 'AF0001', :quantity => 2 }
10
10
  @item2 = { :sku => 'AF0002', :quantity => 1 }
11
11
  @items = [@item1, @item2]
12
+ rescue NoCredentialsFound => e
13
+ skip(e.message)
12
14
  end
13
15
 
14
16
  def test_successful_domestic_rates_request_for_single_line_item
@@ -1,11 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
- class StampsTest < Minitest::Test
3
+ class RemoteStampsTest < Minitest::Test
4
4
  include ActiveShipping::Test::Credentials
5
- include ActiveShipping::Test::Fixtures
6
5
 
7
6
  def setup
8
7
  @carrier = Stamps.new(credentials(:stamps).merge(test: true))
8
+ rescue NoCredentialsFound => e
9
+ skip(e.message)
9
10
  end
10
11
 
11
12
  def test_valid_credentials
@@ -1,12 +1,14 @@
1
1
  require 'test_helper'
2
2
 
3
- class UPSTest < Minitest::Test
3
+ class RemoteUPSTest < Minitest::Test
4
4
  include ActiveShipping::Test::Credentials
5
5
  include ActiveShipping::Test::Fixtures
6
6
 
7
7
  def setup
8
8
  @options = credentials(:ups).merge(:test => true)
9
9
  @carrier = UPS.new(@options)
10
+ rescue NoCredentialsFound => e
11
+ skip(e.message)
10
12
  end
11
13
 
12
14
  def test_tracking
@@ -1,11 +1,14 @@
1
1
  require 'test_helper'
2
2
 
3
- class USPSTest < Minitest::Test
3
+ class RemoteUSPSTest < Minitest::Test
4
4
  include ActiveShipping::Test::Credentials
5
5
  include ActiveShipping::Test::Fixtures
6
6
 
7
7
  def setup
8
- @carrier = USPS.new(credentials(:usps))
8
+ @usps_credentials = credentials(:usps)
9
+ @carrier = USPS.new(@usps_credentials)
10
+ rescue NoCredentialsFound => e
11
+ skip(e.message)
9
12
  end
10
13
 
11
14
  def test_tracking
@@ -199,7 +202,7 @@ class USPSTest < Minitest::Test
199
202
  end
200
203
 
201
204
  def test_valid_credentials
202
- assert USPS.new(credentials(:usps).merge(:test => true)).valid_credentials?
205
+ assert USPS.new(@usps_credentials.merge(:test => true)).valid_credentials?
203
206
  end
204
207
 
205
208
  def test_must_provide_login_creds_when_instantiating
@@ -5,9 +5,8 @@ require 'mocha/mini_test'
5
5
  require 'timecop'
6
6
 
7
7
  require 'active_shipping'
8
- require 'nokogiri'
9
8
  require 'logger'
10
-
9
+ require 'erb'
11
10
 
12
11
  # This makes sure that Minitest::Test exists when an older version of Minitest
13
12
  # (i.e. 4.x) is required by ActiveSupport.
@@ -22,11 +21,20 @@ end
22
21
 
23
22
  module ActiveShipping::Test
24
23
  module Credentials
24
+ class NoCredentialsFound < StandardError
25
+ def initialize(key)
26
+ super("No credentials were found for '#{key}'")
27
+ end
28
+ end
29
+
25
30
  LOCAL_CREDENTIALS = ENV['HOME'] + '/.active_shipping/credentials.yml'
26
31
  DEFAULT_CREDENTIALS = File.dirname(__FILE__) + '/credentials.yml'
27
32
 
28
33
  def credentials(key)
29
- data = all_credentials[key] || raise(StandardError, "No credentials were found for '#{key}'")
34
+ data = all_credentials[key]
35
+ if data.nil? || data.all? { |k,v| v.nil? || v.empty? }
36
+ raise NoCredentialsFound.new(key)
37
+ end
30
38
  data.symbolize_keys
31
39
  end
32
40
 
@@ -36,7 +44,7 @@ module ActiveShipping::Test
36
44
  @@all_credentials ||= begin
37
45
  [DEFAULT_CREDENTIALS, LOCAL_CREDENTIALS].inject({}) do |credentials, file_name|
38
46
  if File.exist?(file_name)
39
- yaml_data = YAML.load(File.read(file_name)).symbolize_keys
47
+ yaml_data = YAML.load(ERB.new(File.read(file_name)).result(binding)).symbolize_keys
40
48
  credentials.merge!(yaml_data)
41
49
  end
42
50
  credentials
@@ -1,7 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class CanadaPostPwsRatingTest < Minitest::Test
4
- include ActiveShipping::Test::Credentials
5
4
  include ActiveShipping::Test::Fixtures
6
5
 
7
6
  def setup
@@ -38,10 +37,11 @@ class CanadaPostPwsRatingTest < Minitest::Test
38
37
 
39
38
  @customer_number = '654321'
40
39
 
41
- @cp = CanadaPostPWS.new(credentials(:canada_post_pws))
40
+ credentials = { platform_id: 123, api_key: '456', secret: '789' }
41
+ @cp = CanadaPostPWS.new(credentials)
42
42
  @cp.logger = Logger.new(StringIO.new)
43
- @french_cp = CanadaPostPWS.new(credentials(:canada_post_pws).merge(:language => 'fr'))
44
- @cp_customer_number = CanadaPostPWS.new(credentials(:canada_post_pws).merge(:customer_number => @customer_number))
43
+ @french_cp = CanadaPostPWS.new(credentials.merge(language: 'fr'))
44
+ @cp_customer_number = CanadaPostPWS.new(credentials.merge(customer_number: @customer_number))
45
45
 
46
46
  @default_options = {:customer_number => '123456'}
47
47
  end
@@ -1,11 +1,10 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class CanadaPostPwsRegisterTest < Minitest::Test
4
- include ActiveShipping::Test::Credentials
5
4
  include ActiveShipping::Test::Fixtures
6
5
 
7
6
  def setup
8
- @cp = CanadaPostPWS.new(credentials(:canada_post_pws))
7
+ @cp = CanadaPostPWS.new(platform_id: 123, api_key: '456', secret: '789')
9
8
  end
10
9
 
11
10
  def test_register_merchant
@@ -1,6 +1,5 @@
1
1
  require 'test_helper'
2
2
  class CanadaPostPwsShippingTest < Minitest::Test
3
- include ActiveShipping::Test::Credentials
4
3
  include ActiveShipping::Test::Fixtures
5
4
 
6
5
  def setup
@@ -71,7 +70,7 @@ class CanadaPostPwsShippingTest < Minitest::Test
71
70
  :label_url => "https://ct.soa-gw.canadapost.ca/ers/artifact/c70da5ed5a0d2c32/20238/0"
72
71
  }
73
72
 
74
- @cp = CanadaPostPWS.new(credentials(:canada_post_pws))
73
+ @cp = CanadaPostPWS.new(platform_id: 123, api_key: '456', secret: '789')
75
74
  end
76
75
 
77
76
  def test_build_shipment_customs_node
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
+
2
3
  class CanadaPostPwsTrackingTest < Minitest::Test
3
- include ActiveShipping::Test::Credentials
4
4
  include ActiveShipping::Test::Fixtures
5
5
 
6
6
  def setup
@@ -29,7 +29,7 @@ class CanadaPostPwsTrackingTest < Minitest::Test
29
29
  :zip => '90210'
30
30
  )
31
31
 
32
- @cp = CanadaPostPWS.new(credentials(:canada_post_pws))
32
+ @cp = CanadaPostPWS.new(platform_id: 123, api_key: '456', secret: '789')
33
33
  end
34
34
 
35
35
  def test_find_tracking_info_with_valid_pin
@@ -1,14 +1,13 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class CanadaPostTest < Minitest::Test
4
- include ActiveShipping::Test::Credentials
5
4
  include ActiveShipping::Test::Fixtures
6
5
 
7
6
  def setup
8
- login = credentials(:canada_post)
7
+ login = { login: 'CPC_DEMO_XML' }
9
8
 
10
9
  @carrier = CanadaPost.new(login)
11
- @french_carrier = CanadaPost.new(login.merge(:french => true))
10
+ @french_carrier = CanadaPost.new(login.merge(french: true))
12
11
 
13
12
  @request = xml_fixture('canadapost/example_request')
14
13
  @response = xml_fixture('canadapost/example_response')
@@ -2,7 +2,6 @@ require 'test_helper'
2
2
 
3
3
  class USPSTest < Minitest::Test
4
4
  include ActiveShipping::Test::Fixtures
5
- include ActiveShipping::Test::Credentials
6
5
 
7
6
  def setup
8
7
  @carrier = USPS.new(:login => 'login')
@@ -365,12 +364,13 @@ class USPSTest < Minitest::Test
365
364
  end
366
365
 
367
366
  def test_domestic_commercial_base_rates
368
- @carrier = USPS.new(credentials(:usps).merge(:commercial_base => true))
367
+ commercial_base_credentials = { key: "123", login: "user", password: "pass", commercial_base: true }
368
+ carrier = USPS.new(commercial_base_credentials)
369
369
 
370
370
  mock_response = xml_fixture('usps/beverly_hills_to_new_york_book_commercial_base_rate_response')
371
- @carrier.expects(:commit).returns(mock_response)
371
+ carrier.expects(:commit).returns(mock_response)
372
372
 
373
- response = @carrier.find_rates(
373
+ response = carrier.find_rates(
374
374
  location_fixtures[:beverly_hills],
375
375
  location_fixtures[:new_york],
376
376
  package_fixtures.values_at(:book),
@@ -385,12 +385,13 @@ class USPSTest < Minitest::Test
385
385
  end
386
386
 
387
387
  def test_intl_commercial_base_rates
388
- @carrier = USPS.new(credentials(:usps).merge(:commercial_base => true))
388
+ commercial_base_credentials = { key: "123", login: "user", password: "pass", commercial_base: true }
389
+ carrier = USPS.new(commercial_base_credentials)
389
390
 
390
391
  mock_response = xml_fixture('usps/beverly_hills_to_ottawa_american_wii_commercial_base_rate_response')
391
- @carrier.expects(:commit).returns(mock_response)
392
+ carrier.expects(:commit).returns(mock_response)
392
393
 
393
- response = @carrier.find_rates(
394
+ response = carrier.find_rates(
394
395
  location_fixtures[:beverly_hills],
395
396
  location_fixtures[:ottawa],
396
397
  package_fixtures.values_at(:american_wii),
@@ -401,12 +402,13 @@ class USPSTest < Minitest::Test
401
402
  end
402
403
 
403
404
  def test_domestic_commercial_plus_rates
404
- @carrier = USPS.new(credentials(:usps).merge(:commercial_plus => true))
405
+ commercial_plus_credentials = { key: "123", login: "user", password: "pass", commercial_plus: true }
406
+ carrier = USPS.new(commercial_plus_credentials)
405
407
 
406
408
  mock_response = xml_fixture('usps/beverly_hills_to_new_york_book_commercial_plus_rate_response')
407
- @carrier.expects(:commit).returns(mock_response)
409
+ carrier.expects(:commit).returns(mock_response)
408
410
 
409
- response = @carrier.find_rates(
411
+ response = carrier.find_rates(
410
412
  location_fixtures[:beverly_hills],
411
413
  location_fixtures[:new_york],
412
414
  package_fixtures.values_at(:book),
@@ -421,12 +423,13 @@ class USPSTest < Minitest::Test
421
423
  end
422
424
 
423
425
  def test_intl_commercial_plus_rates
424
- @carrier = USPS.new(credentials(:usps).merge(:commercial_plus => true))
426
+ commercial_plus_credentials = { key: "123", login: "user", password: "pass", commercial_plus: true }
427
+ carrier = USPS.new(commercial_plus_credentials)
425
428
 
426
429
  mock_response = xml_fixture('usps/beverly_hills_to_ottawa_american_wii_commercial_plus_rate_response')
427
- @carrier.expects(:commit).returns(mock_response)
430
+ carrier.expects(:commit).returns(mock_response)
428
431
 
429
- response = @carrier.find_rates(
432
+ response = carrier.find_rates(
430
433
  location_fixtures[:beverly_hills],
431
434
  location_fixtures[:ottawa],
432
435
  package_fixtures.values_at(:american_wii),
@@ -1,13 +1,11 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class RateEstimateTest < Minitest::Test
4
- include ActiveShipping::Test::Credentials
5
-
6
4
  def setup
7
5
  @origin = {:address1 => "61A York St", :city => "Ottawa", :province => "ON", :country => "Canada", :postal_code => "K1N 5T2"}
8
6
  @destination = {:city => "Beverly Hills", :state => "CA", :country => "United States", :postal_code => "90210"}
9
7
  @line_items = [Package.new(500, [2, 3, 4], :description => "a box full of stuff", :value => 2500)]
10
- @carrier = CanadaPost.new(credentials(:canada_post))
8
+ @carrier = CanadaPost.new(login: 'test')
11
9
  @options = {:currency => 'USD'}
12
10
 
13
11
  @rate_estimate = RateEstimate.new(@origin, @destination, @carrier, @service_name, @options)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_shipping
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre3
4
+ version: 1.0.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James MacAulay
@@ -33,7 +33,7 @@ cert_chain:
33
33
  fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
34
34
  TConQSX2BnZdhIEYW+cKzEC/bLc=
35
35
  -----END CERTIFICATE-----
36
- date: 2015-01-26 00:00:00.000000000 Z
36
+ date: 2015-01-29 00:00:00.000000000 Z
37
37
  dependencies:
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: quantified
metadata.gz.sig CHANGED
@@ -1,2 +1 @@
1
- MR��MR
2
- �xO�r iڶ`{��pp0c��VV.�F�y�d��o�8�V1*����C@K�-#��C�4��"sƽ��7����M�&�O��9�� ]�t�nA�\U(G��D��u.��������Ej���mq.����0�Ma�b %3 4~�o���������J8Z�=�ذ����h�� ��^��j����u��c��� IU�E��U��.�U�`~�u�':GG�z�Y�+U��?h�%
1
+ X