Skip to content
Browse files

Great.

  • Loading branch information...
1 parent 2aefb96 commit 50c32df31563d11bb58a3c369a9e34a86efecf6e @ujihisa committed Aug 15, 2009
Showing with 30 additions and 0 deletions.
  1. +30 −0 net-https-wrapper_spec.rb
View
30 net-https-wrapper_spec.rb
@@ -0,0 +1,30 @@
+require 'net-https-wrapper'
+
+describe 'Net::HTTP' do
+ describe '.__post_or_put__' do
+ it 'wraps posting using .new, #post and #body' do
+ nh = mock('nh')
+ Net::HTTP.should_receive(:new).with('aaa.bbb', 80).and_return(nh)
+ def nh.use_ssl=(a); end
+ def nh.verify_mode=(a); end
+ def nh.post(a, b, c); 'ok' end
+ Net::HTTP.__post_or_put__(
+ :post,
+ 'http://aaa.bbb/ccc/ddd',
+ 'data',
+ {'a' => 'b'}).should == 'ok'
+ end
+ end
+
+ describe '.post, .put' do
+ it 'wrap __post_or_put__' do
+ Net::HTTP.should_receive(:__post_or_put__).with(:post, nil, nil, nil)
+ Net::HTTP.post(nil, nil, nil)
+
+ Net::HTTP.should_receive(:__post_or_put__).with(:put, nil, nil, nil)
+ Net::HTTP.put(nil, nil, nil)
+ end
+ end
+end
+
+

0 comments on commit 50c32df

Please sign in to comment.
Something went wrong with that request. Please try again.