Sha256: f933a475b2d85f9681a2903371d919655f28ec0f34ed09304930d848484f484b

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'

class RemoteKunakiTest < ActiveSupport::TestCase
  include ActiveShipping::Test::Fixtures

  def setup
    @carrier = Kunaki.new
    @item1 = { :sku => 'XZZ1111111', :quantity => 2 }
    @item2 = { :sku => 'PXZZ111112', :quantity => 1 }
    @items = [@item1, @item2]
  end

  def test_successful_rates_request
    response = @carrier.find_rates(
                 location_fixtures[:ottawa],
                 location_fixtures[:beverly_hills],
                 package_fixtures.values_at(:book, :wii),
                 :items => @items
               )

    assert response.success?
    assert_equal 4, response.rates.size
    assert_equal ["UPS 2nd Day Air", "UPS Ground", "UPS Next Day Air Saver", "USPS First Class Mail"], response.rates.collect(&:service_name).sort
  end

  def test_send_no_items
    assert_raises(ActiveUtils::ResponseError) do
      @carrier.find_rates(
        location_fixtures[:ottawa],
        location_fixtures[:beverly_hills],
        package_fixtures.values_at(:book, :wii),
        :items => []
      )
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
active_shipping-2.1.1 test/remote/kunaki_test.rb
active_shipping-2.1.0 test/remote/kunaki_test.rb
active_shipping-2.0.1 test/remote/kunaki_test.rb
active_shipping-2.0.0 test/remote/kunaki_test.rb