Sha256: fffb1d71d496fa9b914bbe155a75b0212dedbf8a3d285d2b88f2dd63eaa4263f

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 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
    
    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

1 entries across 1 versions & 1 rubygems

Version Path
julien51-em-http-request-0.1.9 test/test_hash.rb