|
65 | 65 | end |
66 | 66 |
|
67 | 67 | context "Test Files" do |
68 | | - Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), 'test-files/*-input.*'))) do |filename| |
69 | | - test = File.basename(filename).sub(/-input\..*$/, '') |
70 | | - frame = filename.sub(/-input\..*$/, '-frame.json') |
71 | | - framed = filename.sub(/-input\..*$/, '-framed.json') |
72 | | - compacted = filename.sub(/-input\..*$/, '-compacted.json') |
73 | | - context = filename.sub(/-input\..*$/, '-context.json') |
74 | | - expanded = filename.sub(/-input\..*$/, '-expanded.json') |
75 | | - ttl = filename.sub(/-input\..*$/, '-rdf.ttl') |
| 68 | + %w(oj json_gem ok_json yajl).map(&:to_sym).each do |adapter| |
| 69 | + context "with MultiJson adapter #{adapter.inspect}" do |
| 70 | + Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), 'test-files/*-input.*'))) do |filename| |
| 71 | + test = File.basename(filename).sub(/-input\..*$/, '') |
| 72 | + frame = filename.sub(/-input\..*$/, '-frame.json') |
| 73 | + framed = filename.sub(/-input\..*$/, '-framed.json') |
| 74 | + compacted = filename.sub(/-input\..*$/, '-compacted.json') |
| 75 | + context = filename.sub(/-input\..*$/, '-context.json') |
| 76 | + expanded = filename.sub(/-input\..*$/, '-expanded.json') |
| 77 | + ttl = filename.sub(/-input\..*$/, '-rdf.ttl') |
76 | 78 |
|
77 | | - context test do |
78 | | - it "expands" do |
79 | | - options = {debug: @debug} |
80 | | - options[:expandContext] = File.open(context) if context |
81 | | - jld = described_class.expand(File.open(filename), options) |
82 | | - expect(jld).to produce(JSON.load(File.open(expanded)), @debug) |
83 | | - end if File.exist?(expanded) |
| 79 | + context test do |
| 80 | + it "expands" do |
| 81 | + options = {debug: @debug, adapter: adapter} |
| 82 | + options[:expandContext] = File.open(context) if context |
| 83 | + jld = described_class.expand(File.open(filename), options) |
| 84 | + expect(jld).to produce(JSON.load(File.open(expanded)), @debug) |
| 85 | + end if File.exist?(expanded) |
84 | 86 |
|
85 | | - it "compacts" do |
86 | | - jld = described_class.compact(File.open(filename), File.open(context), debug: @debug) |
87 | | - expect(jld).to produce(JSON.load(File.open(compacted)), @debug) |
88 | | - end if File.exist?(compacted) && File.exist?(context) |
| 87 | + it "compacts" do |
| 88 | + jld = described_class.compact(File.open(filename), File.open(context), adapter: adapter, debug: @debug) |
| 89 | + expect(jld).to produce(JSON.load(File.open(compacted)), @debug) |
| 90 | + end if File.exist?(compacted) && File.exist?(context) |
89 | 91 |
|
90 | | - it "frame" do |
91 | | - jld = described_class.frame(File.open(filename), File.open(frame), debug: @debug) |
92 | | - expect(jld).to produce(JSON.load(File.open(framed)), @debug) |
93 | | - end if File.exist?(framed) && File.exist?(frame) |
| 92 | + it "frame" do |
| 93 | + jld = described_class.frame(File.open(filename), File.open(frame), adapter: adapter, debug: @debug) |
| 94 | + expect(jld).to produce(JSON.load(File.open(framed)), @debug) |
| 95 | + end if File.exist?(framed) && File.exist?(frame) |
94 | 96 |
|
95 | | - it "toRdf" do |
96 | | - expect(RDF::Repository.load(filename, debug: @debug)).to be_equivalent_graph(RDF::Repository.load(ttl), trace: @debug) |
97 | | - end if File.exist?(ttl) |
| 97 | + it "toRdf" do |
| 98 | + expect(RDF::Repository.load(filename, adapter: adapter, debug: @debug)).to be_equivalent_graph(RDF::Repository.load(ttl), trace: @debug) |
| 99 | + end if File.exist?(ttl) |
| 100 | + end |
| 101 | + end |
98 | 102 | end |
99 | 103 | end |
100 | 104 | end |
|
0 commit comments