문제

I want to be able to start my tests pointing at a non-existant couchdb database, so that I can test from a blank canvas. How should I do this?

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
도움이 되었습니까?

해결책

I found this inside some tests for another library:

MyCouchModel.database.delete!

So in a test you could do:

describe MyCouchModel do
  before :all do
    described_class.database.delete!
    described_class.database.create!
  end
end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top