spec/session_spec.rb in patron-0.4.16 vs spec/session_spec.rb in patron-0.4.17
- old
+ new
@@ -169,11 +169,11 @@
it "should post a hash of arguments as a urlencoded form" do
data = {:foo => 123, 'baz' => '++hello world++'}
response = @session.post("/testpost", data)
body = YAML::load(response.body)
body['content_type'].should == "application/x-www-form-urlencoded"
- body['body'].should match(/baz=%2b%2bhello%20world%2b%2b/)
+ body['body'].should match(/baz=%2B%2Bhello%20world%2B%2B/)
body['body'].should match(/foo=123/)
end
it "should raise when no data is provided to :post" do
lambda { @session.post("/test", nil) }.should raise_error(ArgumentError)
@@ -282,8 +282,21 @@
(request.path + '?' + request.query_string).should == "/test?foo=bar&baz=quux"
end
def encode_authz(user, passwd)
"Basic " + Base64.encode64("#{user}:#{passwd}").strip
+ end
+
+ # ------------------------------------------------------------------------
+ describe 'when debug is enabled' do
+ it 'it should not clobber stderr' do
+ rdev = STDERR.stat.rdev
+
+ @session.enable_debug
+ STDERR.stat.rdev.should be == rdev
+
+ @session.enable_debug
+ STDERR.stat.rdev.should be == rdev
+ end
end
end