Skip to content

Commit 733f3ee

Browse files
committed
Don't continually redefine normalize method in be_equivalent_graph matcher.
1 parent bf61d16 commit 733f3ee

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

lib/rdf/spec/matchers.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -269,20 +269,6 @@ def io_name
269269

270270
RSpec::Matchers.define :be_equivalent_graph do |expected, info|
271271
match do |actual|
272-
def normalize(graph)
273-
case graph
274-
when RDF::Enumerable then graph
275-
when IO, StringIO
276-
RDF::Repository.new(graph, base_uri: @info.action)
277-
else
278-
# Figure out which parser to use
279-
r = RDF::Repository.new
280-
reader_class = RDF::Reader.for() {graph}
281-
reader_class.new(graph, base_uri: @info.action).each {|s| r << s}
282-
r
283-
end
284-
end
285-
286272
@info = if (info.id rescue false)
287273
info
288274
elsif info.is_a?(Logger)
@@ -327,6 +313,20 @@ def normalize(graph)
327313
"Results:\n#{actual.dump(format, standard_prefixes: true, literal_shorthand: false, validate: false) rescue @actual.inspect}" +
328314
"\nDebug:\n#{@info.logger}"
329315
end
316+
317+
def normalize(graph)
318+
case graph
319+
when RDF::Enumerable then graph
320+
when IO, StringIO
321+
RDF::Repository.new(graph, base_uri: @info.action)
322+
else
323+
# Figure out which parser to use
324+
r = RDF::Repository.new
325+
reader_class = RDF::Reader.for() {graph}
326+
reader_class.new(graph, base_uri: @info.action).each {|s| r << s}
327+
r
328+
end
329+
end
330330
end
331331

332332
require 'json'

0 commit comments

Comments
 (0)