Sha256: a293cba9de1c35a84a97f0a1db44fc670fc84d2be92e9955af5bd8e8de1bdb7d

Contents?: true

Size: 1005 Bytes

Versions: 72

Compression:

Stored size: 1005 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 and has a deprecated stacktrace property" 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')
      expect(error.to_json).to match(/The 'stacktrace' property is deprecated/)
    end
  end

end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
puppet-4.10.12 spec/unit/network/http/error_spec.rb
puppet-4.10.12-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.12-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.12-universal-darwin spec/unit/network/http/error_spec.rb
puppet-4.10.11 spec/unit/network/http/error_spec.rb
puppet-4.10.11-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.11-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.11-universal-darwin spec/unit/network/http/error_spec.rb
puppet-4.10.10 spec/unit/network/http/error_spec.rb
puppet-4.10.10-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.10-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.10-universal-darwin spec/unit/network/http/error_spec.rb
puppet-4.10.9 spec/unit/network/http/error_spec.rb
puppet-4.10.9-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.9-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.9-universal-darwin spec/unit/network/http/error_spec.rb
puppet-4.10.8 spec/unit/network/http/error_spec.rb
puppet-4.10.8-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.8-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.10.8-universal-darwin spec/unit/network/http/error_spec.rb