Sha256: 64bd77754803864fffc92514c9d9ca690c654dacb0d79d51b663522c2ed99412
Contents?: true
Size: 1006 Bytes
Versions: 16
Compression:
Stored size: 1006 Bytes
Contents
require 'rest-core/test' describe RC::Simple do path = 'http://example.com/' after do WebMock.reset! end would 'give RESPONSE_BODY' do stub_request(:get, path).to_return(:body => 'OK') RC::Simple.new.get(path).should.eq 'OK' end would 'give RESPONSE_HEADERS' do stub_request(:head, path).to_return(:headers => {'A' => 'B'}) RC::Simple.new.head(path).should.eq 'A' => 'B' end would 'give RESPONSE_HEADERS' do stub_request(:get, path).to_return(:status => 199) RC::Simple.new.get(path, {}, RC::RESPONSE_KEY => RC::RESPONSE_STATUS).should.eq 199 end would 'give RESPONSE_SOCKET' do stub_request(:get, path).to_return(:body => 'OK') RC::Simple.new.get(path, {}, RC::HIJACK => true).read.should.eq 'OK' end would 'give REQUEST_URI' do stub_request(:get, "#{path}?a=b").to_return(:body => 'OK') RC::Simple.new.get(path, {:a => 'b'}, RC::RESPONSE_KEY => RC::REQUEST_URI).should.eq "#{path}?a=b" RC::Simple.wait end end
Version data entries
16 entries across 16 versions & 1 rubygems