Skip to content

Commit b46937e

Browse files
author
Ben Slaughter
committed
Added plain text string test
1 parent 420bcdf commit b46937e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/initialize_data_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/'

0 commit comments

Comments
 (0)