Sha256: 0e8a53f87f8e09400c304282c4d67f5e107caf7e5a14802100c54df997b218f5
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 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 a new object' 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 a new object' 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 a new object' do User.get(1).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(1, {}).should be_an_instance_of(User) end end context '.patch' do it 'should return a new object' do User.patch(1, {}).should be_an_instance_of(User) end end context '.delete' do it 'should return a new object' do User.delete(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.0.0 | spec/api-client/class_methods_spec.rb |