Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions lib/rdf/spec/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,23 @@
end
end

describe "#transaction" do
describe "#transaction'" do
it 'gives an immutable transaction' do
expect { subject.transaction { insert([]) } }.to raise_error TypeError
end

it 'commits a successful transaction' do
statement = RDF::Statement(:s, RDF.type, :o)
expect(subject).to receive(:commit_transaction).and_call_original
if subject.mutable?
subject.clear!
statement = RDF::Statement(:s, RDF.type, :o)
expect(subject).to receive(:commit_transaction).and_call_original

expect do
subject.transaction(mutable: true) do
insert(statement)
end
end.to change { subject.statements }.to contain_exactly(statement)
expect do
subject.transaction(mutable: true) do
insert(statement)
end
end.to change { subject.statements }.to contain_exactly(statement)
end
end

it 'rolls back a failed transaction' do
Expand All @@ -73,15 +76,16 @@
end
end

context "with snapshot support" do

describe '#snapshot' do
it 'is not implemented when #supports(:snapshots) is false' do
unless subject.supports?(:snapshots)
expect { subject.snapshot }.to raise_error NotImplementedError
end
describe '#snapshot' do
it 'is not implemented when #supports(:snapshots) is false' do
unless subject.supports?(:snapshots)
expect { subject.snapshot }.to raise_error NotImplementedError
end
end
end

context "with snapshot support" do
before {skip "Does not support Snapshots" unless subject.supports?(:snapshots)}

it 'returns a queryable #snapshot' do
if subject.supports? :snapshots
Expand Down