require File.expand_path('spec/spec_helper') require 'geoff-importer' describe Geoff::Importer do let(:db_path) { './db/test'} let(:geoff_string) { '(A) {"name": "Alice", "test_array":["value1", "value2"]}' } context 'running db' do it 'raises error if db is passed in as string' do db = Java::OrgNeo4jKernel::EmbeddedGraphDatabase.new(db_path) expect { Geoff::Importer.import(geoff_string, db_path) }.to raise_error db.shutdown end it 'inserts geoff into the db when passed with db instance' do db = Java::OrgNeo4jKernel::EmbeddedGraphDatabase.new(db_path) Geoff::Importer.import(geoff_string, db) db.shutdown end end context 'non-running db' do it 'inserts geoff into the db' do Geoff::Importer.import(geoff_string, db_path) end end end