Skip to content

Commit a68360f

Browse files
committed
Add failing test doing list manipulations inside a transaction on the default repository implementation. This works with serialized transactions.
1 parent 5d3fe83 commit a68360f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

spec/repository_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,20 @@
6262
expect(subject.statements.first).to eq existing_statement
6363
expect(subject.statements.first).to be_inferred
6464
end
65+
66+
it "performs coherent list updates" do
67+
# List updates require reading from the repository mid-transaction, which requires a SerializedTransaction
68+
repo = RDF::Repository.new
69+
lh = RDF::Node.new("o")
70+
repo << RDF::Statement.new(RDF::URI('s'), RDF::URI('p'), lh)
71+
expect(repo.count).to eq 1
72+
repo.transaction(mutable: true) do |tx|
73+
list = RDF::List.new(subject: lh, graph: tx, values: %w(a b c))
74+
expect(tx.count).to eq 7
75+
list[0, 2] = %(d)
76+
expect(tx.count).to eq 5
77+
end
78+
expect(repo.count).to eq 5
79+
80+
end
6581
end

0 commit comments

Comments
 (0)