Sha256: cb1f3a8877fd8c754b4674b250838a6423ce0581b24fc36d9584adb2849ffaa6

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper'
require 'database_cleaner/couch_potato/truncation'
require 'couch_potato'

module DatabaseCleaner
  module CouchPotato

    describe Truncation do
      before(:each) do
        @database = mock('database')
        ::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

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
bitfluent-database_cleaner-0.5.2 spec/database_cleaner/couch_potato/truncation_spec.rb
database_cleaner-0.5.2 spec/database_cleaner/couch_potato/truncation_spec.rb
database_cleaner-0.5.1 spec/database_cleaner/couch_potato/truncation_spec.rb
jonrowe-database_cleaner-0.5.2 spec/database_cleaner/couch_potato/truncation_spec.rb
saimonmoore-database_cleaner-0.5.0 spec/database_cleaner/couch_potato/truncation_spec.rb
database_cleaner-0.5.0 spec/database_cleaner/couch_potato/truncation_spec.rb