Sha256: 9128d8245eecf5c11eb0605704af6a552204043c725979312aac984fbfed6702

Contents?: true

Size: 1.05 KB

Versions: 27

Compression:

Stored size: 1.05 KB

Contents

shared_examples_for "an adapter with pre-count truncation" do
  describe "#pre_count_truncate_tables" do
    
    context "with :reset_ids set true" do
      it "truncates the table" do
        2.times { User.create }

        connection.pre_count_truncate_tables(%w[users], :reset_ids => true)
        User.count.should be_zero
      end

      it "resets AUTO_INCREMENT index of table" do
        2.times { User.create }
        User.delete_all

        connection.pre_count_truncate_tables(%w[users]) # true is also the default
        User.create.id.should eq 1
      end
    end

    
    context "with :reset_ids set false" do
      it "truncates the table" do
        2.times { User.create }

        connection.pre_count_truncate_tables(%w[users], :reset_ids => false)
        User.count.should be_zero
      end

      it "does not reset AUTO_INCREMENT index of table" do
        2.times { User.create }
        User.delete_all

        connection.pre_count_truncate_tables(%w[users], :reset_ids => false)

        User.create.id.should eq 3
      end
    end
  end
end

Version data entries

27 entries across 22 versions & 4 rubygems

Version Path
database_cleaner-1.6.2 spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
database_cleaner-1.6.1 spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
database_cleaner-1.6.0 spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
database_cleaner-1.5.3 spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
database_cleaner-1.5.2 spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
database_cleaner-1.5.1 spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
database_cleaner-1.5.0 spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/database_cleaner-1.4.1/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/database_cleaner-1.4.1/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/database_cleaner-1.4.1/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
database_cleaner-1.4.1 spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
database_cleaner-1.4.0 spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/database_cleaner-1.2.0/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb