summaryrefslogtreecommitdiff
path: root/test/support/integration_test.rb
blob: 44f05463763caf48220ed6bb2d67051eea7220ff (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
module Tapicero
  class IntegrationTest < MiniTest::Unit::TestCase

    def create_user
      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']
    end

    def user_database
      host.database(config.options[:db_prefix] + @user_id)
    end

    def database
      @database ||= host.database(database_name)
    end

    def database_name
      config.complete_db_name('users')
    end

    def host
      @host ||= CouchRest.new(config.couch_host)
    end

    def config
      Tapicero.config
    end
  end
end