Sha256: dbf2bf2ba76a54d45f97d20fbe07213c45b3e4510cd7e67ab0b8149e7df70eaf
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' describe Restforce::Collection do let(:client) { double('client') } describe '#new' do subject { records } context 'without pagination' do let(:records) do described_class.new(JSON.parse(fixture('sobject/query_success_response')), client) end it { should respond_to :each } its(:size) { should eq 1 } its(:total_size) { should eq 1 } its(:next_page_url) { should be_nil } specify { subject.instance_variable_get(:@client).should eq client } describe 'each record' do it 'should be a Restforce::SObject' do records.each do |record| record.should be_a Restforce::SObject end end end end context 'with pagination' do let(:records) do described_class.new(JSON.parse(fixture('sobject/query_paginated_first_page_response')), client) end it { should respond_to :each } its(:size) { should eq 1 } its(:total_size) { should eq 2 } its(:next_page_url) { should eq '/services/data/v24.0/query/01gD' } specify { subject.instance_variable_get(:@client).should eq client } describe '.next_page' do before do client.should_receive(:get).and_return(Faraday::Response.new(body: Restforce::Collection.new({'records' => {}}, client))) end subject { records.next_page } it { should be_a Restforce::Collection } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
restforce-0.0.2 | spec/lib/collection_spec.rb |
restforce-0.0.1 | spec/lib/collection_spec.rb |