Sha256: 5943b43a53b28e05eed24900cd4b8a625f370cfd7292e7bbf1f5628763491abe

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

require 'rubygems'
require 'bundler'
Bundler.require(:default, :test)
require 'simplecov'
SimpleCov.start
$LOAD_PATH << File.expand_path('../../lib', __FILE__)
require 'hotseat'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
#Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

# copied and modified from https://github.com/couchrest/couchrest/blob/master/spec/spec_helper.rb
unless defined?(TESTDB)
  COUCHHOST = ENV['COUCHHOST'] || "http://127.0.0.1:5984"
  TESTDB = "hotseat%2Ftest"
  TEST_SERVER = CouchRest.new COUCHHOST
  TEST_SERVER.default_database = TESTDB
  DB = TEST_SERVER.database(TESTDB)
end

def reset_test_db!
  DB.recreate! rescue nil
  DB
end

def delete_test_db!
  DB.delete! rescue nil
end

def clean_up_test_dbs
  cr = TEST_SERVER
  test_dbs = cr.databases.select { |db| db =~ /^#{URI.unescape(TESTDB)}/ }
  test_dbs.each do |db|
    cr.database(db).delete! rescue nil
  end
end

RSpec.configure do |config|
  config.after(:all) do
    clean_up_test_dbs
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hotseat-0.7.0 spec/spec_helper.rb
hotseat-0.6.0 spec/spec_helper.rb
hotseat-0.5.1 spec/spec_helper.rb
hotseat-0.5.0 spec/spec_helper.rb
hotseat-0.4.0 spec/spec_helper.rb
hotseat-0.3.0 spec/spec_helper.rb
hotseat-0.2.0 spec/spec_helper.rb
hotseat-0.1.2 spec/spec_helper.rb
hotseat-0.1.1 spec/spec_helper.rb