|
72 | 72 |
|
73 | 73 | context "when enumerating statements" do |
74 | 74 | it {is_expected.to respond_to(:statements)} |
75 | | - its(:statements) {is_expected.to be_an_enumerator} |
| 75 | + #its(:statements) {is_expected.to be_an_enumerator} |
76 | 76 |
|
77 | 77 | context "#statements" do |
78 | 78 | specify {expect(subject.statements.to_a.size).to eq @statements.size} |
|
131 | 131 | it {is_expected.to respond_to(:each_triple)} |
132 | 132 | it {is_expected.to respond_to(:enum_triple)} |
133 | 133 |
|
134 | | - its(:triples) {is_expected.to be_an_enumerator} |
| 134 | + #its(:triples) {is_expected.to be_an_enumerator} |
135 | 135 | context "#triples" do |
136 | 136 | specify {expect(subject.triples.to_a.size).to eq @statements.size} |
137 | 137 | specify {expect(subject.triples).to all(be_a_triple)} |
|
175 | 175 | it {is_expected.to respond_to(:each_quad)} |
176 | 176 | it {is_expected.to respond_to(:enum_quad)} |
177 | 177 |
|
178 | | - its(:quads) {is_expected.to be_an_enumerator} |
| 178 | + #its(:quads) {is_expected.to be_an_enumerator} |
179 | 179 | context "#quads" do |
180 | 180 | specify {expect(subject.quads.to_a.size).to eq @statements.size} |
181 | 181 | specify {expect(subject.quads).to all(be_a_quad)} |
|
222 | 222 | it {is_expected.to respond_to(:each_subject)} |
223 | 223 | it {is_expected.to respond_to(:enum_subject)} |
224 | 224 |
|
225 | | - its(:subjects) {is_expected.to be_an_enumerator} |
| 225 | + #its(:subjects) {is_expected.to be_an_enumerator} |
226 | 226 | context "#subjects" do |
227 | 227 | subject { enumerable.subjects } |
228 | 228 | specify {is_expected.to be_an_enumerator} |
229 | 229 | specify {is_expected.to all(be_a_resource)} |
230 | | - context ":unique => false" do |
231 | | - subject { enumerable.subjects(:unique => false) } |
| 230 | + context "unique: false" do |
| 231 | + subject { enumerable.subjects(unique: false) } |
232 | 232 | specify {is_expected.to be_an_enumerator} |
233 | 233 | specify {is_expected.to all(be_a_resource)} |
234 | 234 | end |
|
273 | 273 | it {is_expected.to respond_to(:each_predicate)} |
274 | 274 | it {is_expected.to respond_to(:enum_predicate)} |
275 | 275 |
|
276 | | - its(:predicates) {is_expected.to be_an_enumerator} |
| 276 | + #its(:predicates) {is_expected.to be_an_enumerator} |
277 | 277 | context "#predicates" do |
278 | 278 | subject { enumerable.predicates } |
279 | 279 | specify {is_expected.to be_an_enumerator} |
280 | 280 | specify {is_expected.to all(be_a_uri)} |
281 | | - context ":unique => false" do |
282 | | - subject { enumerable.predicates(:unique => false) } |
| 281 | + context "unique: false" do |
| 282 | + subject { enumerable.predicates(unique: false) } |
283 | 283 | specify {is_expected.to be_an_enumerator} |
284 | 284 | specify {is_expected.to all(be_a_uri)} |
285 | 285 | end |
|
320 | 320 | it {is_expected.to respond_to(:each_object)} |
321 | 321 | it {is_expected.to respond_to(:enum_object)} |
322 | 322 |
|
323 | | - its(:objects) {is_expected.to be_an_enumerator} |
| 323 | + #its(:objects) {is_expected.to be_an_enumerator} |
324 | 324 | context "#objects" do |
325 | 325 | subject { enumerable.objects } |
326 | 326 | specify {is_expected.to be_an_enumerator} |
327 | 327 | specify {is_expected.to all(be_a_term)} |
328 | | - context ":unique => false" do |
329 | | - subject { enumerable.objects(:unique => false) } |
| 328 | + context "unique: false" do |
| 329 | + subject { enumerable.objects(unique: false) } |
330 | 330 | specify {is_expected.to be_an_enumerator} |
331 | 331 | specify {is_expected.to all(be_a_term)} |
332 | 332 | end |
|
363 | 363 | end |
364 | 364 | end |
365 | 365 |
|
366 | | - context "when enumerating contexts" do |
| 366 | + context "when enumerating contexts", unless: RDF::VERSION.to_s >= "1.99" do |
367 | 367 | it {is_expected.to respond_to(:contexts)} |
368 | 368 | it {is_expected.to respond_to(:has_context?)} |
369 | 369 | it {is_expected.to respond_to(:each_context)} |
|
375 | 375 | specify {is_expected.to be_an_enumerator} |
376 | 376 | specify {is_expected.to all(be_a_resource)} |
377 | 377 | context "unique: false" do |
378 | | - subject { enumerable.contexts(:unique => false) } |
| 378 | + subject { enumerable.contexts(unique: false) } |
379 | 379 | specify {is_expected.to be_an_enumerator} |
380 | 380 | specify {is_expected.to all(be_a_resource)} |
381 | 381 | end |
|
423 | 423 | describe "#each_graph" do |
424 | 424 | subject { enumerable.each_graph } |
425 | 425 | it {is_expected.to be_an_enumerator} |
426 | | - specify {is_expected.to all(be_a_graph)} if @supports_context |
| 426 | + specify {is_expected.to all(be_a_graph)} if @supports_named_graphs |
| 427 | + specify {expect(subject.each_graph).to all(be_a_graph)} |
| 428 | + |
| 429 | + it "has appropriate number of graphs" do |
| 430 | + graph_names = @statements.map { |s| s.graph_name }.uniq.compact |
| 431 | + expect(subject.each_graph.to_a.size).to eq (graph_names.size + 1) |
| 432 | + end if @supports_named_graphs |
427 | 433 | end |
428 | 434 |
|
429 | 435 | describe "#enum_graph" do |
430 | 436 | subject { enumerable.enum_graph } |
431 | 437 | it {is_expected.to be_an_enumerator} |
432 | 438 | it {is_expected.to be_countable} |
433 | 439 | it "enumerates the same as #each_graph" do |
434 | | - expect(subject.to_a).to include(*enumerable.each_graph.to_a) if @supports_context # expect with match problematic |
| 440 | + expect(subject.to_a).to include(*enumerable.each_graph.to_a) if @supports_named_graphs # expect with match problematic |
435 | 441 | end |
436 | 442 | end |
437 | 443 | end |
438 | 444 |
|
439 | | - context "when enumerating graphs" do |
| 445 | + context "when enumerating graphs", if: RDF::VERSION.to_s >= "1.99" do |
440 | 446 | it {is_expected.to respond_to(:graph_names)} |
441 | 447 | it {is_expected.to respond_to(:has_graph?)} |
442 | | - it {is_expected.to respond_to(:each_graph)} |
443 | | - it {is_expected.to respond_to(:enum_graph)} |
444 | 448 |
|
445 | | - its(:graph_names) {is_expected.to be_a(Array)} |
446 | 449 | describe "#graph_names" do |
447 | 450 | subject { enumerable.graph_names } |
448 | 451 | specify {is_expected.to be_a(Array)} |
449 | 452 | specify {is_expected.to all(be_a_resource)} |
450 | | - context ":unique => false" do |
451 | | - subject { enumerable.graph_names(:unique => false) } |
| 453 | + context "unique: false" do |
| 454 | + subject { enumerable.graph_names(unique: false) } |
452 | 455 | specify {is_expected.to be_a(Array)} |
453 | 456 | specify {is_expected.to all(be_a_resource)} |
454 | 457 | end |
455 | 458 | end |
456 | 459 |
|
457 | | - it "should implement #has_graph?" do |
| 460 | + describe "#has_graph?" do |
458 | 461 | if @supports_named_graphs |
459 | 462 | @statements.each do |statement| |
460 | 463 | if statement.has_graph? |
|
465 | 468 | expect(enumerable).not_to have_graph(uri) |
466 | 469 | end |
467 | 470 | end |
468 | | - |
469 | | - its(:each_graph) {is_expected.to be_an_enumerator} |
470 | | - |
471 | | - describe "#each_graph" do |
472 | | - let(:graph_names) {@statements.map { |s| s.graph_name }.uniq.compact} |
473 | | - subject { enumerable.each_graph } |
474 | | - it {is_expected.to be_an_enumerator} |
475 | | - specify {expect(subject.each_graph).to all(be_a_graph)} |
476 | | - it "has appropriate number of graphs" do |
477 | | - expect(subject.each_graph.to_a.size).to eq (graph_names.size + 1) |
478 | | - end if @supports_named_graphs |
479 | | - end |
480 | | - |
481 | | - describe "#enum_graph" do |
482 | | - subject { enumerable.enum_graph } |
483 | | - it {is_expected.to be_an_enumerator} |
484 | | - it {is_expected.to be_countable} |
485 | | - it "enumerates the same as #each_graph" do |
486 | | - expect(subject.to_a).to include(*enumerable.each_graph.to_a) |
487 | | - end if @supports_named_graphs # expect with match problematic |
488 | | - end |
489 | 471 | end |
490 | 472 |
|
491 | 473 | context "when converting" do |
|
0 commit comments