Sha256: 909eb4a93085a622b64826b05bf4a101b02a3b3e48a3957994d2228a5712db6f

Contents?: true

Size: 816 Bytes

Versions: 6

Compression:

Stored size: 816 Bytes

Contents

require 'spec_helper'

module OpenStax
  module Api
    describe RepresentableSchemaPrinter do
      it 'must print model schemas' do
        schema = RepresentableSchemaPrinter.json(DummyUserRepresenter)
        expect(schema).to include('## Schema')
        expect(schema).to include('{#')
        expect(schema).to include(' .schema}')
        expect(schema).to include("<pre class='code'>")
        expect(schema).to include('</pre>')
        json_schema = schema.match(/<pre class='code'>([^<]*)<\/pre>/)
        expect(JSON.parse(json_schema[1])).to eq({
            "type" => "object",
            "required" => [ "username" ],
            "properties" => {
              "username" => { "type" => "string" }
            },
            "additionalProperties" => false
          })
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
openstax_api-2.5.1 spec/lib/openstax/api/representable_schema_printer_spec.rb
openstax_api-2.5.0 spec/lib/openstax/api/representable_schema_printer_spec.rb
openstax_api-2.4.0 spec/lib/openstax/api/representable_schema_printer_spec.rb
openstax_api-2.3.1 spec/lib/openstax/api/representable_schema_printer_spec.rb
openstax_api-2.3.0 spec/lib/openstax/api/representable_schema_printer_spec.rb
openstax_api-2.2.4 spec/lib/openstax/api/representable_schema_printer_spec.rb