mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
Add clarifying comments to unit test for malformed json test
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
parent
7d1fd5a085
commit
06399fbc0f
1 changed files with 7 additions and 4 deletions
|
@ -64,9 +64,12 @@ describe 'Inspec::Config' do
|
||||||
let(:fixture_name) { 'malformed_json' }
|
let(:fixture_name) { 'malformed_json' }
|
||||||
it 'should throw an exception' do
|
it 'should throw an exception' do
|
||||||
ex = proc { cfg }.must_raise(Inspec::ConfigError::MalformedJson)
|
ex = proc { cfg }.must_raise(Inspec::ConfigError::MalformedJson)
|
||||||
ex.message.must_include 'Failed to load JSON config'
|
# Failed to load JSON configuration: 765: unexpected token at '{ "hot_garbage": "a", "version": "1.1",
|
||||||
ex.message.must_include 'unexpected token'
|
# '
|
||||||
ex.message.must_include 'version'
|
# Config was: "{ \"hot_garbage\": \"a\", \"version\": \"1.1\", \n"
|
||||||
|
ex.message.must_include 'Failed to load JSON config' # The message
|
||||||
|
ex.message.must_include 'unexpected token' # The specific parser error
|
||||||
|
ex.message.must_include 'hot_garbage' # A sample of the unacceptable contents
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -457,7 +460,7 @@ module ConfigTestHelper
|
||||||
when :bad_top_level
|
when :bad_top_level
|
||||||
'{ "version": "1.1", "unsupported_field": "some_value" }'
|
'{ "version": "1.1", "unsupported_field": "some_value" }'
|
||||||
when :malformed_json
|
when :malformed_json
|
||||||
'{ "version": "1.1", '
|
'{ "hot_garbage": "a", "version": "1.1", '
|
||||||
when :with_compliance
|
when :with_compliance
|
||||||
# TODO - this is dubious, need to verify
|
# TODO - this is dubious, need to verify
|
||||||
<<~EOJ5
|
<<~EOJ5
|
||||||
|
|
Loading…
Add table
Reference in a new issue