Sha256: b8f50ef0f7b65aa5d47c9803e6a5c39f88afd1bf95df0970b736f5d5302b6115
Contents?: true
Size: 722 Bytes
Versions: 17
Compression:
Stored size: 722 Bytes
Contents
require 'test/helper' describe Hash do describe ".to_params" do it "should transform a basic hash into HTTP POST Params" do {:a => "alpha", :b => "beta"}.to_params.should == "a=alpha&b=beta" end it "should transform a more complex hash into HTTP POST Params" do {:a => "a", :b => ["c", "d", "e"]}.to_params.should == "a=a&b[0]=c&b[1]=d&b[2]=e" end # Ruby 1.8 Hash is not sorted, so this test breaks randomly. Maybe once we're all on 1.9. ;-) # it "should transform a very complex hash into HTTP POST Params" do # {:a => "a", :b => [{:c => "c", :d => "d"}, {:e => "e", :f => "f"}]}.to_params.should == "a=a&b[0][d]=d&b[0][c]=c&b[1][f]=f&b[1][e]=e" # end end end
Version data entries
17 entries across 17 versions & 5 rubygems