diff options
author | Luke Kanies <luke@madstop.com> | 2009-03-10 00:48:13 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-03-10 00:48:13 -0500 |
commit | d0fc2f5738a78c51128f6377c03fe42cf50371a0 (patch) | |
tree | 340ba2bb55f823b5cc180b9a4848456310aebda3 /spec/unit/network | |
parent | 90afd48c39bc7bbb8e7afa81a49d2f814a787565 (diff) | |
download | puppet-d0fc2f5738a78c51128f6377c03fe42cf50371a0.tar.gz puppet-d0fc2f5738a78c51128f6377c03fe42cf50371a0.tar.xz puppet-d0fc2f5738a78c51128f6377c03fe42cf50371a0.zip |
Correctly handling numerical REST arguments
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/network')
-rwxr-xr-x | spec/unit/network/http/mongrel/rest.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/network/http/mongrel/rest.rb b/spec/unit/network/http/mongrel/rest.rb index e72d4f540..c03698dbd 100755 --- a/spec/unit/network/http/mongrel/rest.rb +++ b/spec/unit/network/http/mongrel/rest.rb @@ -128,6 +128,18 @@ describe "Puppet::Network::HTTP::MongrelREST" do result[:foo].should be_false end + it "should convert integer arguments to Integers" do + @request.expects(:params).returns('QUERY_STRING' => 'foo=15') + result = @handler.params(@request) + result[:foo].should == 15 + end + + it "should convert floating point arguments to Floats" do + @request.expects(:params).returns('QUERY_STRING' => 'foo=1.5') + result = @handler.params(@request) + result[:foo].should == 1.5 + end + it "should YAML-load and URI-decode values that are YAML-encoded" do escaping = URI.escape(YAML.dump(%w{one two})) @request.expects(:params).returns('QUERY_STRING' => "foo=#{escaping}") |