Vitaliy edited this page Jan 29, 2014 · 8 revisions

To run testing locally you will need to have two instances of the server running. There is some good advice on how to set up a second instance on the neo4j site. Connect to the second instance in your testing environment, for example:

if Rails.env.development?
  @neo  = Neography::Rest.new({:port => 7474})
elsif Rails.env.test?
  @neo  = Neography::Rest.new({:port => 7475})

Use Cypher to drop all nodes* and relationships from the database:

config.around(:each) do
  @neo.execute_query("START n0=node(0),nx=node(*) MATCH n0-[r0]-(),nx-[rx]-() WHERE nx <> n0 DELETE r0,rx,nx")
  • All nodes except node 0