Domanda

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
È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top