Sha256: 7d9a98b2931de804813bd31a1f6bd8adfc2c40778f8336cedbc5f42954e4c4b9
Contents?: true
Size: 777 Bytes
Versions: 4
Compression:
Stored size: 777 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe 'Blacklight::Document::ActiveModelShim' do class MockDocument include Blacklight::Document include Blacklight::Document::ActiveModelShim end class MockResponse attr_reader :response, :params def initialize(response, params) @response = response @params = params end def documents response.collect {|doc| MockDocument.new(doc, self)} end end before do allow(MockDocument.repository).to receive(:find).and_return(MockResponse.new([{id: 1}], {})) end describe "#find" do it "should return a document from the repository" do expect(MockDocument.find(1)).to be_a MockDocument expect(MockDocument.find(1).id).to be 1 end end end
Version data entries
4 entries across 4 versions & 1 rubygems