forked from neoid-gem/neoid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec_helper.rb
46 lines (34 loc) · 1.06 KB
/
spec_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require 'neoid'
require 'active_record'
require 'neography'
require 'rest-client'
# ENV['NEOID_LOG'] = 'true'
uri = URI.parse(ENV["NEO4J_URL"] ? ENV["NEO4J_URL"] : ENV['TRAVIS'] ? "http://localhost:7474" : "http://localhost:7574")
$neo = Neography::Rest.new(uri.to_s)
Neography.configure do |c|
c.server = uri.host
c.port = uri.port
if uri.user && uri.password
c.authentication = 'basic'
c.username = uri.user
c.password = uri.password
end
end
Neoid.db = $neo
logger, ActiveRecord::Base.logger = ActiveRecord::Base.logger, Logger.new('/dev/null')
ActiveRecord::Base.configurations = YAML::load(IO.read(File.join(File.dirname(__FILE__), 'support/database.yml')))
ActiveRecord::Base.establish_connection('sqlite3')
require 'support/schema'
require 'support/models'
ActiveRecord::Base.logger = logger
RSpec.configure do |config|
config.mock_with :rspec
config.before(:all) do
end
config.before(:each) do
Neoid.node_models.each(&:destroy_all)
Neoid.clean_db(:yes_i_am_sure)
Neoid.reset_cached_variables
end
end
Neoid.initialize_all