Sha256: 43f04077c2ae6fc5256df1cf8b6f4e506bc5bd954601212d98bdf0a01f379477
Contents?: true
Size: 1013 Bytes
Versions: 3
Compression:
Stored size: 1013 Bytes
Contents
require 'rest-core/test' describe RC::HttpClient do describe 'POST Payload' do after do WebMock.reset! end client = RC::Builder.client client.builder.run(RC::HttpClient) path = 'http://example.com' ok = 'OK' c = client.new post = lambda do |payload, body| WebMock::API.stub_request(:post, path). with(:body => body).to_return(:body => ok) c.post(path, payload).should.eq ok end would 'post with string' do post['string', 'string'] end would 'post with file' do File.open(__FILE__) do |f| b = f.read f.rewind post[f, b] end end would 'post with socket' do rd, wr = IO.pipe wr.write('socket') wr.close post[rd, 'socket'] end would 'not kill the thread if error was coming from the task' do mock(HTTPClient).new{ raise 'boom' }.with_any_args c.request(RC::ASYNC => true).message.should.eq 'boom' Muack.verify end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rest-core-3.5.4 | test/test_httpclient.rb |
rest-core-3.5.3 | test/test_httpclient.rb |
rest-core-3.5.2 | test/test_httpclient.rb |