Sha256: c546c12c1b1bb95fc8e33fc93790859c48d23d3e44d04628ac021ea06ac4e894

Contents?: true

Size: 591 Bytes

Versions: 3

Compression:

Stored size: 591 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) {
      Aitch.get("http://example.org/", {}, {}, expect: [200])
    }

    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

3 entries across 3 versions & 1 rubygems

Version Path
aitch-1.0.2 test/aitch/request/status_code_validation_test.rb
aitch-1.0.1 test/aitch/request/status_code_validation_test.rb
aitch-1.0.0 test/aitch/request/status_code_validation_test.rb