Sha256: 95ecbc65ab9d9c876f5d0123d738bdb0da92d506756ca1d4f5161589c0c211ea

Contents?: true

Size: 891 Bytes

Versions: 8

Compression:

Stored size: 891 Bytes

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
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ronin-0.1.2 spec/extensions/uri/query_params_spec.rb
ronin-0.1.0 spec/extensions/uri/query_params_spec.rb
ronin-0.1.1 spec/extensions/uri/query_params_spec.rb
ronin-0.1.4 spec/extensions/uri/query_params_spec.rb
ronin-0.1.3 spec/extensions/uri/query_params_spec.rb
ronin-0.2.0 spec/extensions/uri/query_params_spec.rb
ronin-0.2.1 spec/extensions/uri/query_params_spec.rb
ronin-0.2.2 spec/extensions/uri/query_params_spec.rb