|
17 | 17 |
|
18 | 18 | let(:mutable) { repository } |
19 | 19 | let(:dataset) { repository } |
| 20 | + subject { repository } |
20 | 21 |
|
21 | 22 | context 'as dataset' do |
22 | 23 | require 'rdf/spec/dataset' |
|
38 | 39 | end |
39 | 40 | end |
40 | 41 | end |
41 | | - |
| 42 | + |
42 | 43 | describe "#transaction" do |
43 | 44 | it 'gives an immutable transaction' do |
44 | 45 | expect { subject.transaction { insert([]) } }.to raise_error TypeError |
|
71 | 72 | end |
72 | 73 |
|
73 | 74 | context "with snapshot support" do |
| 75 | + |
| 76 | + describe '#snapshot' do |
| 77 | + it 'is not implemented when #supports(:snapshots) is false' do |
| 78 | + unless subject.supports?(:snapshots) |
| 79 | + expect { subject.snapshot }.to raise_error NotImplementedError |
| 80 | + end |
| 81 | + end |
| 82 | + end |
| 83 | + |
74 | 84 | it 'returns a queryable #snapshot' do |
75 | | - if repository.supports? :snapshots |
76 | | - expect(repository.snapshot).to be_a RDF::Queryable |
| 85 | + if subject.supports? :snapshots |
| 86 | + expect(subject.snapshot).to be_a RDF::Queryable |
| 87 | + expect(mutable.snapshot).to be_a RDF::Dataset |
77 | 88 | end |
78 | 89 | end |
79 | 90 |
|
|
85 | 96 | end |
86 | 97 |
|
87 | 98 | it 'gives an accurate snapshot' do |
88 | | - if repository.supports? :snapshots |
89 | | - snap = repository.snapshot |
| 99 | + if subject.supports? :snapshots |
| 100 | + snap = subject.snapshot |
90 | 101 | expect(snap.query([:s, :p, :o])) |
91 | | - .to contain_exactly(*repository.query([:s, :p, :o])) |
| 102 | + .to contain_exactly(*subject.query([:s, :p, :o])) |
92 | 103 | end |
93 | 104 | end |
94 | 105 |
|
95 | 106 | it 'gives static snapshot' do |
96 | | - if repository.supports? :snapshots |
97 | | - snap = repository.snapshot |
98 | | - expect { repository.clear } |
| 107 | + if subject.supports? :snapshots |
| 108 | + snap = subject.snapshot |
| 109 | + expect { subject.clear } |
99 | 110 | .not_to change { snap.query([:s, :p, :o]).to_a } |
100 | 111 | end |
101 | 112 | end |
|
0 commit comments