1 #! /usr/bin/env ruby -S rspec
4 describe "the parsejson function" do
5 let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
8 expect(Puppet::Parser::Functions.function("parsejson")).to eq("function_parsejson")
11 it "should raise a ParseError if there is less than 1 arguments" do
12 expect { scope.function_parsejson([]) }.to( raise_error(Puppet::ParseError))
15 it "should convert JSON to a data structure" do
19 result = scope.function_parsejson([json])
20 expect(result).to(eq(['aaa','bbb','ccc']))