From c3cb71ca5e6d32960e4493d85799f3706ea91fe8 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 4 Feb 2014 11:25:43 +0100 Subject: test user deletion --- test/support/integration_test.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'test/support') diff --git a/test/support/integration_test.rb b/test/support/integration_test.rb index 44f0546..b28c0e1 100644 --- a/test/support/integration_test.rb +++ b/test/support/integration_test.rb @@ -1,15 +1,23 @@ module Tapicero class IntegrationTest < MiniTest::Unit::TestCase - def create_user + def create_user(fast = false) result = database.save_doc :some => :content raise RuntimeError.new(result.inspect) unless result['ok'] - sleep 1 # allow tapicero to do its job - @user_id = result['id'] + sleep 1 unless fast # allow tapicero to do its job + @user = {'_id' => result["id"], '_rev' => result["rev"]} + end + + def delete_user(fast = false) + return if @user.nil? or @user['_deleted'] + result = database.delete_doc @user + raise RuntimeError.new(result.inspect) unless result['ok'] + @user['_deleted'] = true + sleep 1 unless fast # allow tapicero to do its job end def user_database - host.database(config.options[:db_prefix] + @user_id) + host.database(config.options[:db_prefix] + @user['_id']) end def database -- cgit v1.2.3