Sha256: 71fdd16c0c62ae178c823145c0294119e6abb80d784fda1825fbe524a7125a39
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
require 'spec_helper' describe ApiClient::ClassMethods do 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 '.build' do context 'with a root node' do it 'should return an user' do User.build('user' => { 'a' => 'b'}).should be_an_instance_of(User) end it 'should set the response' do User.build('user' => { 'a' => 'b'}).response.should == { 'user' => { 'a' => 'b' } } end end context 'without a root node' do it 'should return an user' do User.build('a' => 'b').should be_an_instance_of(User) end it 'should set the response' do User.build('a' => 'b').response.should == { 'a' => 'b' } end end end context '.get' do it 'should return an user' do User.get(1).should be_an_instance_of(User) end end context '.find' do it 'should return an user' do User.find(1).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(1, {}).should be_an_instance_of(User) end end context '.update_attributes' do it 'should return an user' do User.update_attributes(1, {}).should be_an_instance_of(User) end end context '.patch' do it 'should return an user' do User.patch(1, {}).should be_an_instance_of(User) end end context '.delete' do it 'should return an user' do User.delete(1).should be_an_instance_of(User) end end context '.destroy' do it 'should return an user' do User.destroy(1).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/class_methods_spec.rb |