2009-01-29 07:55:42 +01:00
|
|
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
|
|
|
|
|
|
describe CouchRest::Server do
|
|
|
|
|
|
|
|
describe "available databases" do
|
2009-02-06 02:06:12 +01:00
|
|
|
before(:each) do
|
|
|
|
@couch = CouchRest::Server.new
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:each) do
|
|
|
|
@couch.available_databases.each do |ref, db|
|
|
|
|
db.delete!
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-01-29 07:55:42 +01:00
|
|
|
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
|
2009-02-06 02:06:12 +01:00
|
|
|
@couch.define_available_database(:default, "cr-server-test-db")
|
2009-01-29 07:55:42 +01:00
|
|
|
@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
|