Sha256: 23ba8cbb3fd3aec2501b18d5dca850a4304c1b5dd4655587de57ffac14b45041

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'
require 'active_record'
require 'support/active_record/mysql2_setup'
require 'database_cleaner/active_record/truncation'
require 'database_cleaner/active_record/truncation/shared_fast_truncation'

module ActiveRecord
  module ConnectionAdapters
    describe do 
      before(:all) { active_record_mysql2_setup }

      let(:adapter) { Mysql2Adapter }
      let(:connection) { active_record_mysql2_connection }

      describe "#truncate_table" do
        it "should truncate the table" do
          2.times { User.create }

          connection.truncate_table('users')
          User.count.should == 0
        end

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

          connection.truncate_table('users')

          User.create.id.should == 1
        end
      end

      it_behaves_like "an adapter with pre-count truncation" do
        let(:adapter) { Mysql2Adapter }
        let(:connection) { active_record_mysql2_connection }
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
database_cleaner-1.1.1 spec/database_cleaner/active_record/truncation/mysql2_spec.rb
database_cleaner-1.1.0 spec/database_cleaner/active_record/truncation/mysql2_spec.rb
database_cleaner-1.0.1 spec/database_cleaner/active_record/truncation/mysql2_spec.rb
database_cleaner-1.0.0.RC1 spec/database_cleaner/active_record/truncation/mysql2_spec.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/database_cleaner-0.9.1/spec/database_cleaner/active_record/truncation/mysql2_spec.rb
database_cleaner-0.9.1 spec/database_cleaner/active_record/truncation/mysql2_spec.rb