Sha256: 378e62b7d0868f1e931dc420fe70c53754aece5adeb60085886622751bbe57ce
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
require 'spec_helper' describe ApiClient::InstanceMethods do let(:user) { User.new(:id => 1) } before :each do stub_request(:any, 'http://api.example.com/users/').to_return(:body => {'a' => 'b'}.to_json) stub_request(:any, 'http://api.example.com/users/1').to_return(:body => {'a' => 'b'}.to_json) end context '.update_attributes' do context 'with a root node' do it 'should update the object' do user.update_attributes('user' => { 'a' => 'b'}).should be_an_instance_of(User) end it 'should set the response' do user.update_attributes('user' => { 'a' => 'b'}).response.should == { 'user' => { 'a' => 'b' } } end end context 'without a root node' do it 'should update the object' do user.update_attributes('a' => 'b').should be_an_instance_of(User) end it 'should set the response' do user.update_attributes('a' => 'b').response.should == { 'a' => 'b' } end end end context '.get' do it 'should return a new object' do user.get.should be_an_instance_of(User) end end context '.post' do it 'should return a new object' do user.post.should be_an_instance_of(User) end end context '.put' do it 'should return a new object' do user.put.should be_an_instance_of(User) end end context '.patch' do it 'should return a new object' do user.patch.should be_an_instance_of(User) end end context '.delete' do it 'should return a new object' do user.delete.should be_an_instance_of(User) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
api-client-2.0.0 | spec/api-client/instance_methods_spec.rb |