Skip to content

Commit

Permalink
Merge pull request #65 from ruby-rdf/feature/transactable-bnodes
Browse files Browse the repository at this point in the history
Feature/transactable bnodes
  • Loading branch information
Thomas Johnson committed Sep 30, 2016
2 parents 6a722c9 + 0acb718 commit 5dccaef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
29 changes: 0 additions & 29 deletions lib/rdf/spec/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,6 @@
end
end

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

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

it 'rolls back a failed transaction' do
original_contents = subject.statements
expect(subject).to receive(:rollback_transaction).and_call_original

expect do
subject.transaction(mutable: true) do
delete(*@statements)
raise 'my error'
end
end.to raise_error RuntimeError

expect(subject.statements).to contain_exactly(*original_contents)
end
end

context "with snapshot support" do

describe '#snapshot' do
Expand Down
4 changes: 3 additions & 1 deletion lib/rdf/spec/transactable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
end

it 'commits a successful transaction' do
statement = RDF::Statement(:s, RDF.type, :o)
statement = RDF::Statement(RDF::URI('http://example.com/s'),
RDF.type,
RDF::URI('http://example.com/o'))
expect(subject).to receive(:commit_transaction).and_call_original

expect do
Expand Down

0 comments on commit 5dccaef

Please sign in to comment.