@@ -266,16 +266,16 @@ def io_name
266266 end
267267 end
268268
269- Info = Struct . new ( :id , :logger , :action , :result , :format )
269+ Info = Struct . new ( :id , :logger , :action , :result , :format , :base , :prefixes )
270270
271271 RSpec ::Matchers . define :be_equivalent_graph do |expected , info |
272272 match do |actual |
273273 @info = if ( info . id rescue false )
274274 info
275275 elsif info . is_a? ( Logger )
276- Info . new ( "" , info )
276+ Info . new ( logger : info )
277277 elsif info . is_a? ( Hash )
278- Info . new ( info [ :id ] , info [ :logger ] , info [ :action ] , info [ :result ] , info [ :format ] )
278+ Info . new ( info [ :id ] , info [ :logger ] , info [ :action ] , info [ :result ] , info [ :format ] , info [ :base ] , info [ :prefixes ] )
279279 else
280280 Info . new ( info )
281281 end
@@ -290,19 +290,33 @@ def io_name
290290 end
291291
292292 failure_message do |actual |
293+ dump_opts = {
294+ standard_prefixes : true ,
295+ literal_shorthand : false ,
296+ validate : false ,
297+ base_uri : @info . base ,
298+ prefixes : @info . prefixes
299+ }
293300 info = @info . respond_to? ( :information ) ? @info . information : @info . inspect
294301 if @expected . is_a? ( RDF ::Enumerable ) && @actual . size != @expected . size
295302 "Graph entry counts differ:\n expected: #{ @expected . size } \n actual: #{ @actual . size } \n "
296303 else
297304 "Graphs differ\n "
298305 end +
299306 "\n #{ info + "\n " unless info . empty? } " +
300- "Expected:\n #{ @expected . dump ( @info . format , standard_prefixes : true , literal_shorthand : false , validate : false ) rescue @expected . inspect } " +
301- "Results:\n #{ @actual . dump ( @info . format , standard_prefixes : true , literal_shorthand : false , validate : false ) rescue @actual . inspect } " +
307+ "Expected:\n #{ @expected . dump ( @info . format , ** dump_opts ) rescue @expected . inspect } " +
308+ "Results:\n #{ @actual . dump ( @info . format , ** dump_opts ) rescue @actual . inspect } " +
302309 "\n Debug:\n #{ @info . logger } "
303310 end
304311
305312 failure_message_when_negated do |actual |
313+ dump_opts = {
314+ standard_prefixes : true ,
315+ literal_shorthand : false ,
316+ validate : false ,
317+ base : @info . base ,
318+ prefixes : @info . prefixes
319+ }
306320 format = case
307321 when RDF . const_defined? ( :TriG ) then :trig
308322 when RDF . const_defined? ( :Turtle ) then :ttl
@@ -311,7 +325,7 @@ def io_name
311325 info = @info . respond_to? ( :information ) ? @info . information : @info . inspect
312326 "Graphs identical\n " +
313327 "\n #{ info + "\n " unless info . empty? } " +
314- "Results:\n #{ actual . dump ( @info . format , standard_prefixes : true , literal_shorthand : false , validate : false ) rescue @actual . inspect } " +
328+ "Results:\n #{ actual . dump ( @info . format , ** dump_opts ) rescue @actual . inspect } " +
315329 "\n Debug:\n #{ @info . logger } "
316330 end
317331
0 commit comments