diff --git a/lib/neo4j-server/cypher_transaction.rb b/lib/neo4j-server/cypher_transaction.rb index 13a3791f..5f849664 100644 --- a/lib/neo4j-server/cypher_transaction.rb +++ b/lib/neo4j-server/cypher_transaction.rb @@ -110,7 +110,7 @@ def close end def _query(cypher_query, params = nil) - fail 'Transaction invalid, unable to perform query' + fail 'Transaction is invalid, unable to perform query' end end diff --git a/spec/neo4j-server/e2e/cypher_transaction_spec.rb b/spec/neo4j-server/e2e/cypher_transaction_spec.rb index 284243fd..297ed0d0 100644 --- a/spec/neo4j-server/e2e/cypher_transaction_spec.rb +++ b/spec/neo4j-server/e2e/cypher_transaction_spec.rb @@ -78,6 +78,14 @@ module Server end end + it 'cannot continue operations if a transaction is invalid' do + node = Neo4j::Node.create(name: 'andreas') + Neo4j::Transaction.run do |tx| + tx.register_invalid_transaction(Neo4j::Server::InvalidCypherTransaction) + expect { node[:name] = 'foo' }.to raise_error 'Transaction is invalid, unable to perform query' + end + end + it 'can use Transaction block style' do node = Neo4j::Transaction.run { Neo4j::Node.create(name: 'andreas') } expect(node['name']).to eq('andreas')