Sha256: f59d46d45f70ce01e50c6ac937d6eb4236ffd6ad437d5418bef936759c5d9d15
Contents?: true
Size: 1.07 KB
Versions: 9
Compression:
Stored size: 1.07 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' require 'ruby-fs-stack/fs_utils' describe FsUtils do describe "querystring_from_hash" do it "should return a querystring" do qstring = FsUtils.querystring_from_hash :names => 'all' qstring.should == 'names=all' end it "should return a querystring with &s delimiting params" do qstring = FsUtils.querystring_from_hash :names => 'all', :events => 'all' # a hash never guarantees the order so we'll split the string and test # that it contain s all of the pieces qstring.should include('names=all') qstring.should include('events=all') qstring.should include('&') end it "should url_encode all of the hash values" do qstring = FsUtils.querystring_from_hash :name => "Parker Felch" qstring.should == 'name=Parker%20Felch' end it "should convert sub-hashes into key.subkey=value" do qstring = FsUtils.querystring_from_hash :father => {:name => 'Parker Felch'} qstring.should == 'father.name=Parker%20Felch' end end end
Version data entries
9 entries across 9 versions & 1 rubygems