From 9dd56c75872f8cf1496b20e1bc09dcafbf6358e7 Mon Sep 17 00:00:00 2001 From: Brien Wankel Date: Thu, 28 May 2015 19:15:29 -0700 Subject: [PATCH 1/2] Now allows inclusion of additional Neo4j session parameters --- lib/database_cleaner/neo4j/base.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/database_cleaner/neo4j/base.rb b/lib/database_cleaner/neo4j/base.rb index a789dc1..8a794e3 100644 --- a/lib/database_cleaner/neo4j/base.rb +++ b/lib/database_cleaner/neo4j/base.rb @@ -50,8 +50,12 @@ module DatabaseCleaner database[:path] end + def db_params + database.reject!{|key, value| [:type, :path].include? key } + end + def session - @session ||= ::Neo4j::Session.open(db_type, db_path) + @session ||= ::Neo4j::Session.open(db_type, db_path, db_params) end end end From 4601a3647218c28088acaaad62886846b827daf4 Mon Sep 17 00:00:00 2001 From: Brien Wankel Date: Mon, 29 Jun 2015 09:43:29 -0700 Subject: [PATCH 2/2] Adds spec coverage for additional Neo4j connection options --- spec/database_cleaner/neo4j/base_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/database_cleaner/neo4j/base_spec.rb b/spec/database_cleaner/neo4j/base_spec.rb index ffd7f2a..50c7d18 100644 --- a/spec/database_cleaner/neo4j/base_spec.rb +++ b/spec/database_cleaner/neo4j/base_spec.rb @@ -24,6 +24,13 @@ module DatabaseCleaner subject.db.should eq db_conf end + it "should respect additional connection parameters" do + db_conf = {:type => :server_db, :path => 'http://localhost:7474', basic_auth: {username: 'user', password: 'pass'}} + subject.db = db_conf + stub_const("Neo4j::Session", double()).should_receive(:open).with(:server_db, 'http://localhost:7474', {basic_auth: {username: 'user', password: 'pass'}}) { true } + subject.start + end + it "should default to nil" do subject.db.should be_nil end