Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望能够开始我的测试指向一个不存在的 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
我在另一个库的一些测试中发现了这一点:
MyCouchModel.database.delete!
所以在测试中你可以这样做:
describe MyCouchModel do before :all do described_class.database.delete! described_class.database.create! end end