Sha256: 980d30554821aaafdaf47ca5d2d1fceb9e20a00b3e0462fd398efff735297eda

Contents?: true

Size: 884 Bytes

Versions: 476

Compression:

Stored size: 884 Bytes

Contents

require 'spec_helper'
require 'matchers/json'

require 'puppet/network/http'

describe Puppet::Network::HTTP::Error do
  include JSONMatchers

  describe Puppet::Network::HTTP::Error::HTTPError do
    it "should serialize to JSON that matches the error schema" do
      error = Puppet::Network::HTTP::Error::HTTPError.new("I don't like the looks of you", 400, :SHIFTY_USER)

      expect(error.to_json).to validate_against('api/schemas/error.json')
    end
  end

  describe Puppet::Network::HTTP::Error::HTTPServerError do
    it "should serialize to JSON that matches the error schema" do
      begin
        raise Exception, "a wild Exception appeared!"
      rescue Exception => e
        culpable = e
      end
      error = Puppet::Network::HTTP::Error::HTTPServerError.new(culpable)

      expect(error.to_json).to validate_against('api/schemas/error.json')
    end
  end

end

Version data entries

476 entries across 476 versions & 1 rubygems

Version Path
puppet-8.3.0 spec/unit/network/http/error_spec.rb
puppet-8.3.0-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-8.3.0-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-8.3.0-universal-darwin spec/unit/network/http/error_spec.rb
puppet-8.4.0 spec/unit/network/http/error_spec.rb
puppet-8.4.0-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-8.4.0-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-8.4.0-universal-darwin spec/unit/network/http/error_spec.rb
puppet-7.28.0 spec/unit/network/http/error_spec.rb
puppet-7.28.0-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-7.28.0-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-7.28.0-universal-darwin spec/unit/network/http/error_spec.rb
puppet-8.3.1 spec/unit/network/http/error_spec.rb
puppet-8.3.1-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-8.3.1-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-8.3.1-universal-darwin spec/unit/network/http/error_spec.rb
puppet-7.27.0 spec/unit/network/http/error_spec.rb
puppet-7.27.0-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-7.27.0-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-7.27.0-universal-darwin spec/unit/network/http/error_spec.rb