Sha256: 8ec48c9029520a9af6b23f9c8171947ec485746d92d62b7797761dd06a3f0cac

Contents?: true

Size: 1.06 KB

Versions: 19

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'
require 'dm-core'
require 'dm-sqlite-adapter'
require File.expand_path('../../../../support/data_mapper/sqlite3_setup', __FILE__)
require 'database_cleaner/data_mapper/truncation'

module DataMapper
  module ConnectionAdapters
    describe do
      before(:all) { data_mapper_sqlite3_setup }

      let(:adapter) { DataMapperSQLite3Adapter }

      let(:connection) do
        data_mapper_sqlite3_connection
      end

      before(:each) do
        connection.truncate_tables(DataMapper::Model.descendants.map { |d| d.storage_names[:default] || d.name.underscore })
      end

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

          connection.truncate_table(DmUser.storage_names[:default])
          DmUser.count.should eq 0
        end

        it "resets AUTO_INCREMENT index of table" do
          2.times { DmUser.create }
          DmUser.destroy

          connection.truncate_table(DmUser.storage_names[:default])

          DmUser.create.id.should eq 1
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
database_cleaner-1.6.2 spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
database_cleaner-1.6.1 spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
database_cleaner-1.6.0 spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
autocompl-0.2.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
autocompl-0.2.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
autocompl-0.2.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
autocompl-0.1.2 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
autocompl-0.1.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
autocompl-0.1.0 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
database_cleaner-1.5.3 spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
database_cleaner-1.5.2 spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
database_cleaner-1.5.1 spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
database_cleaner-1.5.0 spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/database_cleaner-1.4.1/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/database_cleaner-1.4.1/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/database_cleaner-1.4.1/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
database_cleaner-1.4.1 spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
database_cleaner-1.4.0 spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb