Sha256: d3b5cd296125ea4409e346e523ccdaa0cba6e39d16555e2dbd2b7dfafaa243f2

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'
require 'active_record'
require 'support/active_record/postgresql_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_pg_setup }

      let(:adapter) { PostgreSQLAdapter }

      let(:connection) do
        active_record_pg_connection
      end

      before(:each) do
        connection.truncate_tables connection.tables
      end

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

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

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

          connection.truncate_table('users')

          User.create.id.should eq 1
        end
      end

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

    end
  end
end

Version data entries

8 entries across 3 versions & 2 rubygems

Version Path
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/database_cleaner-1.2.0/spec/database_cleaner/active_record/truncation/postgresql_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/spec/database_cleaner/active_record/truncation/postgresql_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/database_cleaner-1.2.0/spec/database_cleaner/active_record/truncation/postgresql_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/database_cleaner-1.2.0/spec/database_cleaner/active_record/truncation/postgresql_spec.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/spec/database_cleaner/active_record/truncation/postgresql_spec.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/postgresql_spec.rb
database_cleaner-1.3.0 spec/database_cleaner/active_record/truncation/postgresql_spec.rb
database_cleaner-1.2.0 spec/database_cleaner/active_record/truncation/postgresql_spec.rb