6b2e5f84ad
* A server can have multiple defined available databases set to be used by documents (think DM repos) * A server can have a default database so documents can easily share the same db connection * Let a document class have a default database to use * Give access to a document uri * extracted some of the document features to a mixin
34 lines
No EOL
966 B
Ruby
34 lines
No EOL
966 B
Ruby
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
|
|
describe CouchRest::Server do
|
|
|
|
before(:all) do
|
|
@couch = CouchRest::Server.new
|
|
end
|
|
|
|
after(:all) do
|
|
@couch.available_databases.each do |ref, db|
|
|
db.delete!
|
|
end
|
|
end
|
|
|
|
describe "available databases" do
|
|
it "should let you add more databases" do
|
|
@couch.available_databases.should be_empty
|
|
@couch.define_available_database(:default, "cr-server-test-db")
|
|
@couch.available_databases.keys.should include(:default)
|
|
end
|
|
|
|
it "should verify that a database is available" do
|
|
@couch.available_database?(:default).should be_true
|
|
@couch.available_database?("cr-server-test-db").should be_true
|
|
@couch.available_database?(:matt).should be_false
|
|
end
|
|
|
|
it "should let you set a default database" do
|
|
@couch.default_database = 'cr-server-test-default-db'
|
|
@couch.available_database?(:default).should be_true
|
|
end
|
|
end
|
|
|
|
end |