Sha256: adffed0eb670450d65f7b6d74103ebe2a37d32a663e12608b294524e3010344a

Contents?: true

Size: 1011 Bytes

Versions: 66

Compression:

Stored size: 1011 Bytes

Contents

require 'test_helper'

class ResponseTest < ActiveSupport::TestCase
  test "#initialize for a successful response" do
    response = RateResponse.new(
      true,
      "success!",
      { rate: 'Free!' },
      rates: [ stub(service_name: 'Free!', total_price: 0) ],
      xml: "<rate>Free!</rate>"
    )
    assert_predicate response, :success?
  end

  test "#initialize for a failed response raises ResponseError" do
    assert_raises(ActiveShipping::ResponseError) do
      RateResponse.new(
        false,
        "fail!",
        { rate: 'Free!' },
        rates: [ stub(service_name: 'Free!', total_price: 0) ],
        xml: "<rate>Free!</rate>"
      )
    end
  end

  test "#initialize doesn't raise when you pass in allow_failure" do
    response = RateResponse.new(
      false,
      "fail!",
      { rate: 'Free!' },
      rates: [ stub(service_name: 'Free!', total_price: 0) ],
      xml: "<rate>Free!</rate>",
      allow_failure: true,
    )
    refute_predicate response, :success?
  end
end

Version data entries

66 entries across 66 versions & 2 rubygems

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