Sha256: 2738c30b1aac2bc014a4ec836f96482a480f19d88d044c43ad01d962f3702c5d
Contents?: true
Size: 1005 Bytes
Versions: 13
Compression:
Stored size: 1005 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 = double() @mock_client = double(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
13 entries across 13 versions & 1 rubygems