Sha256: 856f10cd2108b105f272286a2f767f1e163ecce5dfed9621b6691b303bd10627

Contents?: true

Size: 686 Bytes

Versions: 8

Compression:

Stored size: 686 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
    it "should dump a name and a value into a String" do
      param = URLQueryParam.new(:name => 'foo', :value => 'bar')

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

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

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

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ronin-1.1.0.rc3 spec/url_query_param_spec.rb
ronin-1.1.0.rc2 spec/url_query_param_spec.rb
ronin-1.1.0.rc1 spec/url_query_param_spec.rb
ronin-1.0.0 spec/url_query_param_spec.rb
ronin-1.0.0.rc3 spec/url_query_param_spec.rb
ronin-1.0.0.rc2 spec/url_query_param_spec.rb
ronin-1.0.0.rc1 spec/url_query_param_spec.rb
ronin-1.0.0.pre4 spec/url_query_param_spec.rb