Sha256: 89366eb7dce98a57ff0cc67cc050579e2494a2b8f9ae0a459f816ee9e073698e
Contents?: true
Size: 1.18 KB
Versions: 59
Compression:
Stored size: 1.18 KB
Contents
require "test_helper" require "json_reference" describe JsonReference::Reference do it "expands a reference without a URI" do ref = reference("#/definitions") assert_equal nil, ref.uri assert_equal "#/definitions", ref.pointer end it "expands a reference with a URI" do ref = reference("http://example.com#/definitions") assert_equal URI.parse("http://example.com"), ref.uri assert_equal "#/definitions", ref.pointer end it "expands just a root sign" do ref = reference("#") assert_equal nil, ref.uri assert_equal "#", ref.pointer end it "expands a URI with just a root sign" do ref = reference("http://example.com#") assert_equal URI.parse("http://example.com"), ref.uri assert_equal "#", ref.pointer end it "normalizes pointers by adding a root sign prefix" do ref = reference("/definitions") assert_equal nil, ref.uri assert_equal "#/definitions", ref.pointer end it "normalizes pointers by stripping a trailing slash" do ref = reference("#/definitions/") assert_equal nil, ref.uri assert_equal "#/definitions", ref.pointer end def reference(str) JsonReference::Reference.new(str) end end
Version data entries
59 entries across 59 versions & 1 rubygems