Sha256: 25bf7b3c21b75b6dff81e1c95cffe45dbe058a5d48838ad7987408ce2d6a9b48

Contents?: true

Size: 741 Bytes

Versions: 10

Compression:

Stored size: 741 Bytes

Contents

require 'spec_helper'
require 'ronin/url_query_param'

describe URLQueryParam do
  it "should require a name" do
    param = URLQueryParam.new

    param.should_not be_valid
  end

  describe "#to_s" do
    let(:name) { URLQueryParamName.new(:name => 'foo') }

    it "should dump a name and a value into a String" do
      param = URLQueryParam.new(:name => name, :value => 'bar')

      param.to_s.should == "foo=bar"
    end

    it "should ignore empty or nil values" do
      param = URLQueryParam.new(:name => name)

      param.to_s.should == "foo="
    end

    it "should escape special characters" do
      param = URLQueryParam.new(:name => name, :value => 'bar baz')

      param.to_s.should == "foo=bar%20baz"
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ronin-1.5.0 spec/url_query_param_spec.rb
ronin-1.5.0.rc2 spec/url_query_param_spec.rb
ronin-1.5.0.rc1 spec/url_query_param_spec.rb
ronin-1.4.1 spec/url_query_param_spec.rb
ronin-1.4.0 spec/url_query_param_spec.rb
ronin-1.4.0.rc2 spec/url_query_param_spec.rb
ronin-1.4.0.rc1 spec/url_query_param_spec.rb
ronin-1.3.0 spec/url_query_param_spec.rb
ronin-1.2.0 spec/url_query_param_spec.rb
ronin-1.1.0 spec/url_query_param_spec.rb