Skip to content

Commit 551d128

Browse files
committed
Update Info again to allow for base and prefixes, which are passed to dump.
1 parent 61d02e2 commit 551d128

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

lib/rdf/spec/matchers.rb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@ def io_name
266266
end
267267
end
268268

269-
Info = Struct.new(:id, :logger, :action, :result, :format, :options) do
270-
def initialize(id:, logger: nil, action: nil, result: nil, format: nil, options: {}); super end
271-
end
269+
Info = Struct.new(:id, :logger, :action, :result, :format, :base, :prefixes)
272270

273271
RSpec::Matchers.define :be_equivalent_graph do |expected, info|
274272
match do |actual|
@@ -277,7 +275,7 @@ def initialize(id:, logger: nil, action: nil, result: nil, format: nil, options:
277275
elsif info.is_a?(Logger)
278276
Info.new(logger: info)
279277
elsif info.is_a?(Hash)
280-
Info.new(options: info, **info)
278+
Info.new(info[:id], info[:logger], info[:action], info[:result], info[:format], info[:base], info[:prefixes])
281279
else
282280
Info.new(info)
283281
end
@@ -292,7 +290,13 @@ def initialize(id:, logger: nil, action: nil, result: nil, format: nil, options:
292290
end
293291

294292
failure_message do |actual|
295-
dump_opts = {standard_prefixes: true, literal_shorthand: false, validate: false}.merge(@info.options)
293+
dump_opts = {
294+
standard_prefixes: true,
295+
literal_shorthand: false,
296+
validate: false,
297+
base_uri: @info.base,
298+
prefixes: @info.prefixes
299+
}
296300
info = @info.respond_to?(:information) ? @info.information : @info.inspect
297301
if @expected.is_a?(RDF::Enumerable) && @actual.size != @expected.size
298302
"Graph entry counts differ:\nexpected: #{@expected.size}\nactual: #{@actual.size}\n"
@@ -306,7 +310,13 @@ def initialize(id:, logger: nil, action: nil, result: nil, format: nil, options:
306310
end
307311

308312
failure_message_when_negated do |actual|
309-
dump_opts = {standard_prefixes: true, literal_shorthand: false, validate: false}.merge(@info.options)
313+
dump_opts = {
314+
standard_prefixes: true,
315+
literal_shorthand: false,
316+
validate: false,
317+
base: @info.base,
318+
prefixes: @info.prefixes
319+
}
310320
format = case
311321
when RDF.const_defined?(:TriG) then :trig
312322
when RDF.const_defined?(:Turtle) then :ttl

0 commit comments

Comments
 (0)