Merge pull request #363 from brienw/feature/neo4j_auth_options

Adds support for additional Neo4j::Session.open options
This commit is contained in:
Ernesto Tagwerker 2015-06-29 17:38:23 -03:00
commit d2a7ee40bf
2 changed files with 12 additions and 1 deletions

View file

@ -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

View file

@ -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