class Reagan::TestJSON
tests to make sure the version has been updated on the cookbook
Public Class Methods
new(file)
click to toggle source
# File lib/reagan/test_json.rb 24 def initialize(file) 25 @file = file 26 end
Public Instance Methods
test()
click to toggle source
performs JSON format test returns true if json can be parsed and false if it cannot
# File lib/reagan/test_json.rb 30 def test 31 puts 'Running JSON parsing test:' 32 begin 33 json_file = File.read(File.join(Config.settings['jenkins']['workspace_dir'], @file)) 34 JSON.parse(json_file) 35 success = true 36 rescue JSON::JSONError 37 success = false 38 end 39 puts success ? 'PASS: JSON parses'.indent : 'FAIL: JSON does NOT parse'.indent.to_red 40 success 41 end