summaryrefslogtreecommitdiff
path: root/test/test_helper.rb
blob: 1442148ae98ce842fc6da186e8f5b3d9cbbfb64a (plain)
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
47
require 'rubygems'
gem 'minitest'
require 'minitest/autorun'
require 'pathname'

unless defined? BASE_DIR
  BASE_DIR = Pathname.new(__FILE__) + '../..'
end

begin
  require 'debugger'
rescue LoadError
end

unless defined? DEBUG
  DEBUG = ENV["DEBUG"]
end

$:.unshift BASE_DIR + 'lib'

require 'mocha/setup'

require 'tapicero/version'
Tapicero::CONFIGS << "test/config.yaml"
Tapicero::RERAISE = true
require 'tapicero'

require_relative 'support/integration_test'

require_relative 'support/tapicero_process'
TapiceroProcess.kill!
MiniTest.after_run {
  TapiceroProcess.kill!
}

# delete prior user dbs so they don't fill up the local couchdb.
CouchRest::Server.new.tap do |server|
  server.databases.each do |db_name|
    if db_name =~ /^user-[a-f0-9]{32}$/
      server.database(db_name).delete!
    end
  end
end

puts
puts "   REMINDER: check /tmp/tapicero.log for errors"
puts