diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-27 18:30:27 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-28 10:50:51 -0700 |
| commit | 80adaea6319b2aca81fd3d9b1d0061152b6c7db2 (patch) | |
| tree | cead79a1b4d886fd824157d11b26b189c8a68632 /spec/unit | |
| parent | ebf49f98357f93b33e09c0ecbdee1c5c2db87569 (diff) | |
| download | puppet-80adaea6319b2aca81fd3d9b1d0061152b6c7db2.tar.gz puppet-80adaea6319b2aca81fd3d9b1d0061152b6c7db2.tar.xz puppet-80adaea6319b2aca81fd3d9b1d0061152b6c7db2.zip | |
(#7160) Support 'json' as a rendering method for CLI faces.
We already had some specialized support for rendering JSON using the PSON
libraries; this just extends that to recognize the request on the command line
for json to be identical to a request for pson.
Theoretically we should also support the format in our network rendering code,
but that is a much bigger change, in established code, that has more chance of
destabilizing the whole release.
Reviewed-By: Max Martin <max@puppetlabs.com>
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/application/face_base_spec.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/application/face_base_spec.rb b/spec/unit/application/face_base_spec.rb index 7b3a69f61..e84e6766f 100755 --- a/spec/unit/application/face_base_spec.rb +++ b/spec/unit/application/face_base_spec.rb @@ -296,5 +296,13 @@ EOT app.action.render_as = :for_humans app.render("bi-polar?").should == "bi-winning!" end + + it "should render JSON when asked for json" do + app.action.render_as = :json + json = app.render({ :one => 1, :two => 2 }) + json.should =~ /"one":\s*1\b/ + json.should =~ /"two":\s*2\b/ + PSON.parse(json).should == { "one" => 1, "two" => 2 } + end end end |
