Sha256: e20c4cbda1c2bda881f15c42c3d502159d40af23ff32b290054d8952444655b9

Contents?: true

Size: 558 Bytes

Versions: 8

Compression:

Stored size: 558 Bytes

Contents

require 'spec_helper'

describe ApiClient::Collection do
  let(:user) { User.new }

  before :each do
    stub_request(:get, 'http://api.example.com/users').to_return(:body => [ { 'a' => 'b' }, { 'a' => 'b2' } ].to_json)
    User.stub(:new => user)
    @collection = ApiClient::Collection.new(User, 'users')
  end

  it 'should include enumerable module' do
    @collection.should respond_to(:first)
  end

  describe '.initialize' do
    it 'Should initialize a collection of Objects' do
      @collection.collection.should == [user, user]
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
api-client-2.3.0 spec/api-client/collection_spec.rb
api-client-2.2.0 spec/api-client/collection_spec.rb
api-client-2.1.0 spec/api-client/collection_spec.rb
api-client-2.0.3 spec/api-client/collection_spec.rb
api-client-2.0.2 spec/api-client/collection_spec.rb
api-client-2.0.1 spec/api-client/collection_spec.rb
api-client-2.0.0 spec/api-client/collection_spec.rb
api-client-2.0.0.rc2 spec/api-client/collection_spec.rb