Sha256: 443149f978316593e70b1da00affedc2b894b1b3266ce3fb5c09be333f0cc873
Contents?: true
Size: 1.96 KB
Versions: 1
Compression:
Stored size: 1.96 KB
Contents
require_relative '../spec_helper' describe Syncano::QueryBuilder do let(:connection) { double('connection') } let(:resource_class) { double('resource_class') } let(:scope_parameters) { { foo: :bar } } subject { described_class.new(connection, resource_class, scope_parameters) } describe '.initialize' do it { expect(subject.instance_eval{ connection }).to eq(connection) } it { expect(subject.instance_eval{ resource_class }).to eq(resource_class) } it { expect(subject.instance_eval{ scope_parameters }).to eq(scope_parameters) } end describe '.all' do specify do expect(resource_class).to receive(:all).with(connection, scope_parameters, {}) subject.all end end describe '.first' do specify do expect(resource_class).to receive(:first).with(connection, scope_parameters) subject.first end end describe '.last' do specify do expect(resource_class).to receive(:last).with(connection, scope_parameters) subject.last end end describe '.find' do specify do key = 100 expect(resource_class).to receive(:find).with(connection, scope_parameters, key) subject.find(key) end end describe '.new' do specify do attributes = { bar: :foo } expect(resource_class).to receive(:new).with(connection, scope_parameters, attributes) subject.new(attributes) end end describe '.create' do specify do attributes = { bar: :foo } expect(resource_class).to receive(:create).with(connection, scope_parameters, attributes) subject.create(attributes) end end describe '.space' do let(:options) { double } let(:resource) { double } let(:space) { double } before do expect(Syncano::Resources::Space).to receive(:new).with(resource, subject, options).and_return(space) end it 'should return a Space object with passed options' do expect(subject.space(resource, options)).to eq(space) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
syncano-4.0.0.pre | spec/unit/query_builder_spec.rb |