Sha256: ab3a6a37104c058a15df4f7d0289eaa91358d60053dba5814b52bd4cdbbd1e3c
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
require 'ronin/extensions/uri' require 'spec_helper' describe URI::QueryParams do before(:each) do @uri = URI('http://www.test.com/page.php?x=1&y=one%20two&z') end it "should provide #query_params" do @uri.should respond_to(:query_params) end it "#query_params should be a Hash" do @uri.query_params.class.should == Hash end it "#query_params should contain params" do @uri.query_params.empty?.should == false end it "#query_params can contain single-word params" do @uri.query_params['x'].should == '1' end it "#query_params can contain multi-word params" do @uri.query_params['y'].should == 'one two' end it "#query_params can contain empty params" do @uri.query_params['z'].should be_nil end it "should update #query_params along with #query=" do @uri.query = 'u=3' @uri.query_params['u'].should == '3' end it "should properly escape query param values" do @uri.query_params['x'] = '1&2' @uri.query_params['y'] = 'one=two' @uri.query_params['z'] = '?' @uri.to_s.should == "http://www.test.com/page.php?x=1%262&y=one%3Dtwo&z=%3F" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ronin-0.3.0 | spec/extensions/uri/query_params_spec.rb |
ronin-0.2.4 | spec/extensions/uri/query_params_spec.rb |
ronin-0.2.3 | spec/extensions/uri/query_params_spec.rb |