Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: v0.1.0
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (34 sloc) 0.966 kb
require 'rubygems'
require 'bundler/setup'
require 'json'
ROOT = File.expand_path("../..", __FILE__)
$LOAD_PATH.unshift(File.join(ROOT, "lib"))
require 'couchup'
# Spec stuff
require 'awesome_print'
require 'couchrest'
HOST = ENV['HOST'] || "127.0.0.1"
PORT = ENV['PORT'] || "5984"
TEST_DATABASE = 'couchup_test'
def database
@db ||= CouchRest.database!("http://#{HOST}:#{PORT}/#{TEST_DATABASE}")
end
def reset_data!
database.documents(:include_docs => true)["rows"].collect{|r| r["doc"]}.each {|d|database.delete_doc(d) unless d["_id"] =~ /_design/}
end
def ap(*params)
# no op
end
RSpec.configure do |config|
config.before(:all) do
begin
database.delete!
database.create!
Couchup::Couchup.host = HOST
Couchup::Couchup.port = PORT
Couchup::Couchup.database = TEST_DATABASE
rescue
ap "Looks like the couch db does not exist. Use HOST and or PORT env param to set the couchdb server"
end
end
end
Jump to Line
Something went wrong with that request. Please try again.