Sha256: d79a675a1c635c5951d6b89c25a679e27e8261ea894691ab2d5c08281f395b0e
Contents?: true
Size: 1001 Bytes
Versions: 41
Compression:
Stored size: 1001 Bytes
Contents
require 'spec_helper' describe Rubydora::ResourceIndex do class MockRepository include Rubydora::ResourceIndex end before(:each) do @mock_repository = MockRepository.new end it "should map a simple relationship query into SPARQL" do @mock_repository.should_receive(:find_by_sparql) do |query| query.should match(/\<pid\> \<predicate\> \?pid/) end @mock_repository.find_by_sparql_relationship('pid', 'predicate') end it "should send sparql queries with appropriate parameters" do @mock_risearch = mock() @mock_client = mock(RestClient::Resource) @mock_risearch.should_receive(:post).with(hash_including(:dt => 'on', :format => 'CSV', :lang => 'sparql', :limit => nil, :query => 'placeholder SPARQL query', :type => 'tuples' )) @mock_client.should_receive(:[]).with('risearch').and_return(@mock_risearch) @mock_repository.should_receive(:client).and_return(@mock_client) @mock_repository.risearch 'placeholder SPARQL query' end end
Version data entries
41 entries across 41 versions & 1 rubygems