Sha256: 651ab79523cb504307201bc72450d0dc0138b590810743a28beaf0b43d6a2967
Contents?: true
Size: 1.23 KB
Versions: 33
Compression:
Stored size: 1.23 KB
Contents
require File.dirname(__FILE__) + "/../spec_helper" require 'tempfile' require "resourceful/urlencoded_form_data.rb" describe Resourceful::UrlencodedFormData do before do @form_data = Resourceful::UrlencodedFormData.new end it "should know its content-type" do @form_data.content_type.should match(/^application\/x-www-form-urlencoded$/i) end describe "instantiation" do it "should be creatable with hash" do Resourceful::UrlencodedFormData.new(:foo => 'testing').read.should eql("foo=testing") end end describe "with simple parameters" do it "should all simple parameters to be added" do @form_data.add(:foo, "testing") end it "should render a multipart form-data document when #read is called" do @form_data.add('foo', 'bar') @form_data.add('baz', 'this') @form_data.read.should eql("foo=bar&baz=this") end it "should escape character in values that are unsafe" do @form_data.add('foo', 'this & that') @form_data.read.should eql("foo=this+%26+that") end it "should escape character in names that are unsafe" do @form_data.add('foo=bar', 'this') @form_data.read.should eql("foo%3Dbar=this") end end end
Version data entries
33 entries across 33 versions & 4 rubygems