@@ -56,6 +56,21 @@ def test_parse_json_string
5656 assert_raises ( JSON ::Schema ::JsonLoadError ) { JSON ::Validator . validate ( schema , data , :uri => true ) }
5757 end
5858
59+ def test_parse_plain_text_string
60+ schema = { 'type' => 'string' }
61+ data = 'kapow'
62+
63+ assert ( JSON ::Validator . validate ( schema , data ) )
64+
65+ assert ( JSON ::Validator . validate ( schema , data , :parse_data => false ) )
66+
67+ assert_raises ( JSON ::Schema ::JsonParseError ) do
68+ JSON ::Validator . validate ( schema , data , :json => true )
69+ end
70+
71+ assert_raises ( JSON ::Schema ::JsonLoadError ) { JSON ::Validator . validate ( schema , data , :uri => true ) }
72+ end
73+
5974 def test_parse_valid_uri_string
6075 schema = { 'type' => 'string' }
6176 data = 'http://foo.bar/'
@@ -96,6 +111,21 @@ def test_parse_invalid_uri_string
96111 assert_raises ( JSON ::Schema ::JsonLoadError ) { JSON ::Validator . validate ( schema , data , :uri => true ) }
97112 end
98113
114+ def test_parse_invalid_scheme_string
115+ schema = { 'type' => 'string' }
116+ data = 'pick one: [1, 2, 3]'
117+
118+ assert ( JSON ::Validator . validate ( schema , data ) )
119+
120+ assert ( JSON ::Validator . validate ( schema , data , :parse_data => false ) )
121+
122+ assert_raises ( JSON ::Schema ::JsonParseError ) do
123+ JSON ::Validator . validate ( schema , data , :json => true )
124+ end
125+
126+ assert_raises ( JSON ::Schema ::UriError ) { JSON ::Validator . validate ( schema , data , :uri => true ) }
127+ end
128+
99129 def test_parse_integer
100130 schema = { 'type' => 'integer' }
101131 data = 42
0 commit comments