Sha256: 7203b0a21c8499b9f1b8609bd7d492ea6dca6aab8274bb02c06de0448fade118

Contents?: true

Size: 925 Bytes

Versions: 127

Compression:

Stored size: 925 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 the optional 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')
    end
  end

end

Version data entries

127 entries across 127 versions & 1 rubygems

Version Path
puppet-4.7.0 spec/unit/network/http/error_spec.rb
puppet-4.7.0-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.7.0-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.7.0-universal-darwin spec/unit/network/http/error_spec.rb
puppet-4.6.2 spec/unit/network/http/error_spec.rb
puppet-4.6.2-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.6.2-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.6.2-universal-darwin spec/unit/network/http/error_spec.rb
puppet-4.6.1-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.6.1 spec/unit/network/http/error_spec.rb
puppet-4.6.1-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.6.1-universal-darwin spec/unit/network/http/error_spec.rb
puppet-4.5.3 spec/unit/network/http/error_spec.rb
puppet-4.5.3-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.5.3-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.5.3-universal-darwin spec/unit/network/http/error_spec.rb
puppet-4.5.2 spec/unit/network/http/error_spec.rb
puppet-4.5.2-x86-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.5.2-x64-mingw32 spec/unit/network/http/error_spec.rb
puppet-4.5.2-universal-darwin spec/unit/network/http/error_spec.rb