Closed danielparks closed 2 years ago
I think I like this version too. I can't immediately think of anything negative that would come out of it..
I’m going to go ahead and close #311 (thought I’ll keep I’ll keep the branch around until this is merged).
This is an alternate to #311, which fixes this same problem in a different way. I like this solution better.
Catch parse failures in
PuppetStrings::Json
testsPreviously, the tests for
PuppetStrings::Json
(in json_spec.rb) parsed a variety of code samples and then queried YARD to test the results. Ifa sample failed to parse, an error might be outputted (see issue #307), but no failure was registered by the testing harness.This adds simple checks to verify that the parses actually succeed.
Unfortunately, one of the samples currently fails to parse, so this commit introduces a testing error. The subbsequent commit will fix it.
(#307) Fix plan parsing in JSON spec tests
Previously, the parsing code activated task support in Puppet when it detected that it was parsing a file in a plans/ directory. This casued the JSON spec test for plans to fail because it parsed a string, which naturally had no file name to check.
This turns on task support (and thus enables parsing plans) whenever the parser starts (assuming that task support is available).
This helps avoid surprises to future users who need to parse plans from ruby code, such as in tests.
Add a plan test to parser_spec.rb
Previously, none of the examples in parser_spec.rb included a Puppet plan. This adds a plan and verifies that it parses correctly.