diff --git a/Gemfile.lock b/Gemfile.lock index a663958..7d659d4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,95 +44,6 @@ GEM couchrest (1.2.0) mime-types (~> 1.15) multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) - multi_json (~> 1.0) rest-client (~> 1.6.1) cucumber (1.2.1) builder (>= 2.1.2) diff --git a/lib/database_cleaner/active_record/truncation.rb b/lib/database_cleaner/active_record/truncation.rb index b53986b..fb1a52c 100755 --- a/lib/database_cleaner/active_record/truncation.rb +++ b/lib/database_cleaner/active_record/truncation.rb @@ -3,7 +3,9 @@ require 'active_record/base' require 'active_record/connection_adapters/abstract_adapter' #Load available connection adapters -%w( abstract_mysql_adapter postgresql_adapter sqlite3_adapter ).each do |known_adapter| +%w( + abstract_mysql_adapter postgresql_adapter sqlite3_adapter mysql_adapter mysql2_adapter +).each do |known_adapter| begin require "active_record/connection_adapters/#{known_adapter}" rescue LoadError @@ -185,6 +187,7 @@ module ActiveRecord end AbstractMysqlAdapter.class_eval { include ::DatabaseCleaner::ConnectionAdapters::AbstractMysqlAdapter } if defined?(AbstractMysqlAdapter) Mysql2Adapter.class_eval { include ::DatabaseCleaner::ConnectionAdapters::AbstractMysqlAdapter } if defined?(Mysql2Adapter) + MysqlAdapter.class_eval { include ::DatabaseCleaner::ConnectionAdapters::AbstractMysqlAdapter } if defined?(MysqlAdapter) SQLiteAdapter.class_eval { include ::DatabaseCleaner::ConnectionAdapters::SQLiteAdapter } if defined?(SQLiteAdapter) SQLite3Adapter.class_eval { include ::DatabaseCleaner::ConnectionAdapters::SQLiteAdapter } if defined?(SQLite3Adapter) PostgreSQLAdapter.class_eval { include ::DatabaseCleaner::ConnectionAdapters::PostgreSQLAdapter } if defined?(PostgreSQLAdapter) diff --git a/spec/database_cleaner/active_record/truncation/mysql2_spec.rb b/spec/database_cleaner/active_record/truncation/mysql2_spec.rb index 5af4715..0a36ab8 100644 --- a/spec/database_cleaner/active_record/truncation/mysql2_spec.rb +++ b/spec/database_cleaner/active_record/truncation/mysql2_spec.rb @@ -6,10 +6,9 @@ require 'database_cleaner/active_record/truncation/shared_fast_truncation' module ActiveRecord module ConnectionAdapters - describe do + describe do before(:all) { active_record_mysql2_setup } - let(:adapter) { Mysql2Adapter } let(:connection) { active_record_mysql2_connection } describe "#truncate_table" do @@ -31,7 +30,6 @@ module ActiveRecord end it_behaves_like "an adapter with pre-count truncation" do - let(:adapter) { Mysql2Adapter } let(:connection) { active_record_mysql2_connection } end end diff --git a/spec/database_cleaner/active_record/truncation/mysql_spec.rb b/spec/database_cleaner/active_record/truncation/mysql_spec.rb index 0508fe5..a6eb8e9 100644 --- a/spec/database_cleaner/active_record/truncation/mysql_spec.rb +++ b/spec/database_cleaner/active_record/truncation/mysql_spec.rb @@ -6,10 +6,9 @@ require 'database_cleaner/active_record/truncation/shared_fast_truncation' module ActiveRecord module ConnectionAdapters - describe do + describe do before(:all) { active_record_mysql_setup } - let(:adapter) { MysqlAdapter } let(:connection) { active_record_mysql_connection } describe "#truncate_table" do @@ -29,9 +28,8 @@ module ActiveRecord User.create.id.should eq 1 end end - + it_behaves_like "an adapter with pre-count truncation" do - let(:adapter) { MysqlAdapter } let(:connection) { active_record_mysql_connection } end end diff --git a/spec/database_cleaner/active_record/truncation/postgresql_spec.rb b/spec/database_cleaner/active_record/truncation/postgresql_spec.rb index f687a82..80a0d38 100644 --- a/spec/database_cleaner/active_record/truncation/postgresql_spec.rb +++ b/spec/database_cleaner/active_record/truncation/postgresql_spec.rb @@ -9,8 +9,6 @@ module ActiveRecord describe do before(:all) { active_record_pg_setup } - let(:adapter) { PostgreSQLAdapter } - let(:connection) do active_record_pg_connection end @@ -38,7 +36,6 @@ module ActiveRecord end it_behaves_like "an adapter with pre-count truncation" do - let(:adapter) { PostgreSQLAdapter } let(:connection) { active_record_pg_connection } end diff --git a/spec/database_cleaner/active_record/truncation/sqlite3_spec.rb b/spec/database_cleaner/active_record/truncation/sqlite3_spec.rb index d43a57f..75c212b 100644 --- a/spec/database_cleaner/active_record/truncation/sqlite3_spec.rb +++ b/spec/database_cleaner/active_record/truncation/sqlite3_spec.rb @@ -8,8 +8,6 @@ module ActiveRecord describe do before(:all) { active_record_sqlite3_setup } - let(:adapter) { SQLite3Adapter } - let(:connection) do active_record_sqlite3_connection end