spec/encoding_spec.rb in em-http-request-0.2.15 vs spec/encoding_spec.rb in em-http-request-0.3.0
- old
+ new
@@ -1,6 +1,6 @@
-require 'spec/helper'
+require 'helper'
describe EventMachine::HttpEncoding do
include EventMachine::HttpEncoding
it "should transform a basic hash into HTTP POST Params" do
@@ -27,8 +27,14 @@
end
it "should escape keys and values" do
params = form_encode_body({'bad&str'=> {'key&key' => ['bad+&stuff', '[test]']}})
params.should == "bad%26str[key%26key][0]=bad%2B%26stuff&bad%26str[key%26key][1]=%5Btest%5D"
+ end
+
+ it "should be fast on long string escapes" do
+ s = Time.now
+ 5000.times { |n| form_encode_body({:a => "{a:'b', d:'f', g:['a','b']}"*50}) }
+ (Time.now - s).should satisfy { |t| t < 1.5 }
end
end