Sha256: 6519d235d3a951c36c5c4603191a7a5b0763a089179666c685f871f104c0b498
Contents?: true
Size: 671 Bytes
Versions: 4
Compression:
Stored size: 671 Bytes
Contents
# frozen_string_literal: true RSpec.describe Macros::Search::Query do subject(:query_step) { described_class.new(searchable: klass) } let(:page) { 1 } let(:result) { double('result', page: page) } let(:ransack_result) { OpenStruct.new(q: query, result: result) } let(:klass) { mock_model('User', ransack: ransack_result) } let(:query) { { name_cont: 'foo' } } let(:params) { { q: query, page: page } } let(:ctx) { { params: params } } it 'expects to search' do expect(klass).to receive(:ransack).with(query) query_step.call(ctx, params: params) expect(ctx[:query].q).to eql query expect(ctx[:query].result).to eql result end end
Version data entries
4 entries across 4 versions & 1 rubygems