Sha256: 037d34a28169858a6d55b0a006168c90c9283467e93e329f957fc7180cd8de68

Contents?: true

Size: 595 Bytes

Versions: 5

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

require "test_helper"

class StatusCodeValidationTest < Minitest::Test
  test "raises exception when status code isn't valid" do
    register_uri(:get, "http://example.org/", status: 404)

    error = assert_raises(Aitch::StatusCodeError) do
      Aitch.get("http://example.org/", {}, {}, expect: [200])
    end

    assert_equal "Expected(200 OK) <=> Actual(404 Not Found)", error.message
  end

  test "accepts valid status code" do
    register_uri(:get, "http://example.org/", status: 200)
    Aitch.get("http://example.org/", {}, {}, expect: [200])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aitch-2.0.0 test/aitch/request/status_code_validation_test.rb
aitch-1.2.2 test/aitch/request/status_code_validation_test.rb
aitch-1.2.1 test/aitch/request/status_code_validation_test.rb
aitch-1.2.0 test/aitch/request/status_code_validation_test.rb
aitch-1.1.0 test/aitch/request/status_code_validation_test.rb