Sha256: fd55fc7a770b8a914fef0c302c06a920ed47d17447531185b6860475a64e54ce

Contents?: true

Size: 766 Bytes

Versions: 11

Compression:

Stored size: 766 Bytes

Contents

require "test_helper"

describe Pliny::Errors do
  it "includes a general error that requires an identifier" do
    e = Pliny::Errors::Error.new("General error.", :general_error)
    assert_equal "General error.", e.message
    assert_equal :general_error, e.id
  end

  it "includes an HTTP error that will take generic parameters" do
    e = Pliny::Errors::HTTPStatusError.new(
      "Custom HTTP error.", :custom_http_error, 499)
    assert_equal "Custom HTTP error.", e.message
    assert_equal :custom_http_error, e.id
    assert_equal 499, e.status
  end

  it "includes pre-defined HTTP error templates" do
    e = Pliny::Errors::NotFound.new
    assert_equal "Not found.", e.message
    assert_equal :not_found, e.id
    assert_equal 404, e.status
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pliny-0.4.0 test/errors_test.rb
pliny-0.3.0 test/errors_test.rb
pliny-0.2.1 test/errors_test.rb
pliny-0.2.0 test/errors_test.rb
pliny-0.1.0 test/errors_test.rb
pliny-0.0.4 test/errors_test.rb
pliny-0.0.3 test/errors_test.rb
pliny-0.0.1 test/errors_test.rb
pliny-0.0.1.pre3 test/errors_test.rb
pliny-0.0.1.pre2 test/errors_test.rb
pliny-0.0.1.pre test/errors_test.rb