Sha256: b468508d3e158b448d43dd346a2509af87ab67f948937c1fb795d4d1b3888b10
Contents?: true
Size: 1.98 KB
Versions: 1
Compression:
Stored size: 1.98 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' do context 'with a root node' do it 'should update the object' do user.update('user' => { 'a' => 'b'}).should be_an_instance_of(User) end it 'should set the response' do user.update('user' => { 'a' => 'b'}).response.should == { 'user' => { 'a' => 'b' } } end end context 'without a root node' do it 'should update the object' do user.update('a' => 'b').should be_an_instance_of(User) end it 'should set the response' do user.update('a' => 'b').response.should == { 'a' => 'b' } end end end context '.get' do it 'should return an user' do user.get.should be_an_instance_of(User) end end context '.reload' do it 'should return an user' do user.reload.should be_an_instance_of(User) end end context '.post' do it 'should return an user' do user.post.should be_an_instance_of(User) end end context '.create' do it 'should return an user' do user.create.should be_an_instance_of(User) end end context '.put' do it 'should return an user' do user.put.should be_an_instance_of(User) end end context '.update_attributes' do it 'should return an user' do user.update_attributes.should be_an_instance_of(User) end end context '.patch' do it 'should return an user' do user.patch.should be_an_instance_of(User) end end context '.delete' do it 'should return an user' do user.delete.should be_an_instance_of(User) end end context '.destroy' do it 'should return an user' do user.destroy.should be_an_instance_of(User) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
api-client-2.2.0 | spec/api-client/instance_methods_spec.rb |