Sha256: 10c53f5a979ac6b595f656c14d480f2b52616f32b63dbad541828533584bc795
Contents?: true
Size: 1.07 KB
Versions: 8
Compression:
Stored size: 1.07 KB
Contents
require_relative '../spec_helper' describe RestfulResource::HttpClient do describe 'Basic HTTP' do before :each do @http_client = RestfulResource::HttpClient.new end it 'should execute get' do response = @http_client.get('http://httpbin.org/get') expect(response.status).to eq 200 end it 'should execute put' do response = @http_client.put('http://httpbin.org/put', data: { name: 'Alfred' }) expect(response.status).to eq 200 end it 'should raise error 422' do expect { @http_client.put('http://httpbin.org/status/422', data: { name: 'Mad cow' }) }.to raise_error(RestfulResource::HttpClient::UnprocessableEntity) end end describe 'Authentication' do before :each do auth = RestfulResource::Authorization.http_authorization('user', 'passwd') @http_client = RestfulResource::HttpClient.new(authorization: auth) end it 'should execute authenticated get' do response = @http_client.get('http://httpbin.org/basic-auth/user/passwd') expect(response.status).to eq 200 end end end
Version data entries
8 entries across 8 versions & 1 rubygems