我希望能够开始我的测试,指向一个不存在的couchdb数据库,以便我可以从空白画布进行测试。我该怎么做?
describe MyCouchModel do
before :all do
described_class.drop # This doesn't work!
end
it 'should be empty' do
described-class.all.length.should == 0
end
end
答案 0 :(得分:1)
我在另一个库的某些测试中发现了这个:
MyCouchModel.database.delete!
所以在测试中你可以做到:
describe MyCouchModel do
before :all do
described_class.database.delete!
described_class.database.create!
end
end