mirror of
				https://github.com/DatabaseCleaner/database_cleaner
				synced 2023-03-27 23:22:03 -04:00 
			
		
		
		
	Merge branch 'master' into neo4j
This commit is contained in:
		
						commit
						8ab0be7c63
					
				
					 9 changed files with 43 additions and 110 deletions
				
			
		
							
								
								
									
										28
									
								
								CONTRIBUTE.markdown
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								CONTRIBUTE.markdown
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,28 @@
 | 
			
		|||
# Guidelines for contributing
 | 
			
		||||
 | 
			
		||||
## 1. Fork & Clone
 | 
			
		||||
 | 
			
		||||
Since you probably don't have rights to the main repo, you should Fork it (big
 | 
			
		||||
button up top). After that, clone your fork locally and optionally add an
 | 
			
		||||
upstream:
 | 
			
		||||
 | 
			
		||||
    git remote add upstream git@github.com:DatabaseCleaner/database_cleaner.git
 | 
			
		||||
 | 
			
		||||
## 2. Make sure the tests run fine
 | 
			
		||||
 | 
			
		||||
- `bundle install`
 | 
			
		||||
- Copy `db/sample.config.yml` to `db/config.yml` and edit it
 | 
			
		||||
- Make sure to create the databases specified in `db/config.yml`
 | 
			
		||||
- Run the tests with `bundle exec rspec`
 | 
			
		||||
 | 
			
		||||
Note that if you don't have all the supported databases installed and running,
 | 
			
		||||
some tests will fail.
 | 
			
		||||
 | 
			
		||||
## 3. Prepare your contribution
 | 
			
		||||
 | 
			
		||||
This is all up to you but a few points should be kept in mind:
 | 
			
		||||
 | 
			
		||||
- Please write tests for your contribution
 | 
			
		||||
- Make sure that previous tests still pass
 | 
			
		||||
- Push it to a branch of your fork
 | 
			
		||||
- Submit a pull request
 | 
			
		||||
							
								
								
									
										14
									
								
								Gemfile
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								Gemfile
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -14,20 +14,20 @@ group :development, :test do
 | 
			
		|||
  #ORM's
 | 
			
		||||
  gem "activerecord"
 | 
			
		||||
  gem "datamapper"
 | 
			
		||||
    gem "dm-migrations"
 | 
			
		||||
    gem "dm-sqlite-adapter"
 | 
			
		||||
  gem "dm-migrations"
 | 
			
		||||
  gem "dm-sqlite-adapter"
 | 
			
		||||
  gem "mongoid"
 | 
			
		||||
    gem "tzinfo"
 | 
			
		||||
    gem "mongo_ext"
 | 
			
		||||
    gem "bson_ext"
 | 
			
		||||
    gem "mongoid-tree"
 | 
			
		||||
  gem "tzinfo"
 | 
			
		||||
  gem "mongo_ext"
 | 
			
		||||
  gem "bson_ext"
 | 
			
		||||
  gem "mongoid-tree"
 | 
			
		||||
 | 
			
		||||
  gem "mongo_mapper"
 | 
			
		||||
  gem "moped"
 | 
			
		||||
  gem "neo4j-core"
 | 
			
		||||
  gem "couch_potato"
 | 
			
		||||
 | 
			
		||||
  gem "sequel",               "~>3.21.0"
 | 
			
		||||
  gem "sequel", "~> 3.21.0"
 | 
			
		||||
  #gem "ibm_db"  # I don't want to add this dependency, even as a dev one since it requires DB2 to be installed
 | 
			
		||||
  gem 'mysql', '~> 2.8.1'
 | 
			
		||||
  gem 'mysql2'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										89
									
								
								Gemfile.lock
									
										
									
									
									
								
							
							
						
						
									
										89
									
								
								Gemfile.lock
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -48,95 +48,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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ Each strategy is a small amount of code but is code that is usually needed in an
 | 
			
		|||
 | 
			
		||||
ActiveRecord, DataMapper, Sequel, MongoMapper, Mongoid, CouchPotato, Ohm and Redis are supported.
 | 
			
		||||
 | 
			
		||||
[](http://travis-ci.org/bmabey/database_cleaner)
 | 
			
		||||
[](https://travis-ci.org/DatabaseCleaner/database_cleaner)
 | 
			
		||||
 | 
			
		||||
Here is an overview of the strategies supported for each library:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue