Skip to content

Commit 5220241

Browse files
committed
Add WebMock around test for default query specifying default graph.
1 parent 32760d6 commit 5220241

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spec/client_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,11 @@ def response(header)
147147
end
148148

149149
it "handles successful response with default graph specified" do
150-
client = SPARQL::Client.new('http://dbpedia.org/sparql', graph: "https://example.org/")
150+
WebMock.stub_request(:post, 'https://dbpedia.org/sparql?default-graph-uri=https://example.org/').
151+
to_return(body: '{}', status: 200, headers: { 'Content-Type' => 'application/sparql-results+json'})
152+
client = SPARQL::Client.new('https://dbpedia.org/sparql', graph: "https://example.org/")
151153
client.query(query)
154+
expect(WebMock).to have_requested(:post, "https://dbpedia.org/sparql?default-graph-uri=https://example.org/")
152155
end
153156

154157
it "generates IOError when querying closed client" do

0 commit comments

Comments
 (0)