Sha256: ab687154fad1faa17e52cccf149d7dc08fe52afff0375229dac0835574df1cf2
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' describe ApiClient::Parser do describe "#_response" do context "with a valid json response" do before :each do FakeWeb.register_uri(:post, "http://api.example.com/user/5", :body => { :a => :b }.to_json, :status => "201") @response = ApiClient::Base._post('http://api.example.com/user/5', {}, {}) end it "should return the response code and the body parsed" do ApiClient::Base._response(@response).should == ['201', { "a" => "b" }] end end context "with a invalid json response" do before :each do FakeWeb.register_uri(:post, "http://api.example.com/user/5", :body => "wrong", :status => "201") @response = ApiClient::Base._post('http://api.example.com/user/5', {}, {}) end it "should return the response code and a nil body" do ApiClient::Base._response(@response).should == ['201', nil] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
api-client-1.2.0 | spec/api-client/parser_spec.rb |