1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
require File.dirname(__FILE__) + '/../../spec_helper'
require 'database_cleaner/couch_potato/truncation'
require 'couch_potato'
module DatabaseCleaner
module CouchPotato
describe Truncation do
let(:database) { double('database') }
before(:each) do
::CouchPotato.stub(:couchrest_database).and_return(database)
end
it "should re-create the database" do
database.should_receive(:recreate!)
Truncation.new.clean
end
it "should raise an error when the :only option is used" do
running {
Truncation.new(:only => ['document-type'])
}.should raise_error(ArgumentError)
end
it "should raise an error when the :except option is used" do
running {
Truncation.new(:except => ['document-type'])
}.should raise_error(ArgumentError)
end
it "should raise an error when invalid options are provided" do
running {
Truncation.new(:foo => 'bar')
}.should raise_error(ArgumentError)
end
end
end
end
|