Skip to content

Commit

Permalink
spec for InvalidCypherTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
dpisarewski committed Jan 6, 2015
1 parent 9a69115 commit 10f0c26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/neo4j-server/cypher_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions spec/neo4j-server/e2e/cypher_transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 10f0c26

Please sign in to comment.