Sha256: 2d4a4dc317c4bfa8c395f7a70b2a6136e659138159ca118ad18243012ad2afd4
Contents?: true
Size: 922 Bytes
Versions: 54
Compression:
Stored size: 922 Bytes
Contents
require 'spec_helper' require_relative '../../../lib/locomotive/steam/adapters/memory.rb' describe Locomotive::Steam::MemoryAdapter do let(:collection) { [OpenStruct.new(name: 'Hello world')] } let(:mapper) { instance_double('Mapper', name: :test) } let(:scope) { instance_double('Scope', locale: nil) } let(:adapter) { Locomotive::Steam::MemoryAdapter.new(collection) } before { allow(mapper).to receive(:to_entity) { |arg| arg } } describe '#all' do subject { adapter.all(mapper, scope) } it { expect(subject.size).to eq 1 } end describe '#query' do let(:block) { -> (_) { where(name: 'Hello world') } } subject { adapter.query(mapper, scope, &block) } it { expect(subject.size).to eq 1 } context 'another syntax' do let(:block) { -> (_) { where(k(:name, :in) => ['Hello world']) } } it { expect(subject.size).to eq 1 } end end end
Version data entries
54 entries across 54 versions & 1 rubygems