Sha256: 0dff1b88b48bd361a5667ed6e5a0a60b92248d8a7ac172c4235c9cc0dcc570f3

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

require 'rubygems'
require 'test/unit'

require 'context'   # with github: gem install jeremymcanally-context
require 'matchy'    # best bet for now: clone from github and build yourself; when jeremy fixes matchy, jeremymcanally-matchy
require 'zebra'     # until jeremy updates matchy, download and build yourself, after that, with github: gem install giraffesoft-zebra

begin
  require 'ruby-debug'
  Debugger.start
rescue
  puts "no ruby-debug installed? REAlLY? ok, if that's how you roll..."
end

$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'lib/exegesis'

class TestingDatabase
  include Exegesis::Database
end

class Test::Unit::TestCase
  
  def fixtures_path fixtures
    File.join(File.dirname(__FILE__), 'fixtures', fixtures)
  end
  
  def db_server
    @db_server ||= Exegesis::Server.new('http://localhost:5984')
  end
  
  # todo: extract to some helper methods to include ala RR, etc
  def reset_db(name=nil)
    RestClient.delete "http://localhost:5984/#{db(name)}" rescue nil
    db_server.create_database(db(name))
    @db = TestingDatabase.new(db_server, db(name))
  end
  
  def db(name)
    "exegesis-test#{name.nil? ? '' : "-#{name}"}"
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mattly-exegesis-0.2.0 test/test_helper.rb
mattly-exegesis-0.2.1 test/test_helper.rb
mattly-exegesis-0.2.2 test/test_helper.rb