Sha256: 979acebcfa920f238c5cb172d08990be4a436fb1c055e6b7bd48e137f52ae48b
Contents?: true
Size: 1.01 KB
Versions: 6
Compression:
Stored size: 1.01 KB
Contents
require_relative '../../spec_helper' describe Syncano::Resources::Space do let(:resource) { double('resource', primary_key: 123) } let(:query_builder) { spy('query_builder') } it 'should pass the query to the query builder with a default direction' do described_class.new(resource, query_builder).all expect(query_builder).to have_received(:all).with(last_pk: 123, direction: 1) end it 'should translate order desc to query builder direction' do described_class.new(resource, query_builder, direction: :prev).all expect(query_builder).to have_received(:all).with(last_pk: 123, direction: 0) end it 'should translate order asc to query builder direction' do described_class.new(resource, query_builder, direction: :next).all expect(query_builder).to have_received(:all).with(last_pk: 123, direction: 1) end it 'should raise an error on invalid options' do expect { described_class.new(resource, query_builder, direction: :koza).all }.to raise_error(Syncano::RuntimeError) end end
Version data entries
6 entries across 6 versions & 1 rubygems