database_cleaner 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/VERSION.yml +1 -1
- data/examples/Gemfile.lock +1 -1
- data/examples/config/database.yml +7 -0
- data/examples/db/activerecord_one.db +0 -0
- data/examples/db/activerecord_two.db +0 -0
- data/examples/db/datamapper_default.db +0 -0
- data/examples/db/datamapper_one.db +0 -0
- data/examples/db/datamapper_two.db +0 -0
- data/lib/database_cleaner/mongo2/base.rb +16 -0
- data/lib/database_cleaner/mongo2/truncation_mixin.rb +37 -0
- data/spec/support/active_record/migrations/20150101010000_create_users.rb +14 -0
- data/spec/support/active_record/migrations/20150101020000_create_agents.rb +14 -0
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18b2553b2e2fecdaf872e7274771ccd7a38ab3c3
|
4
|
+
data.tar.gz: 33ea944750c6db5f050fa088c3971dc137ae3e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1fb21202bf49eaf1db4a30d5ab353722c3f9c7f6cc10685cb60d36a2c5beb92402bd702595732451862851a50be4960631a4cd2d37ae93b515ac6e85642e5c3
|
7
|
+
data.tar.gz: cd709be8380c719396270c0cbc51e8c2f745115e20d34a263bcc6c7e385f45f6ee33db0d26a1fbfd328329c379b083660e7c7ba704039a10d48225093556b0b4
|
data/Gemfile.lock
CHANGED
data/VERSION.yml
CHANGED
data/examples/Gemfile.lock
CHANGED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
one:
|
3
|
+
adapter: sqlite3
|
4
|
+
database: "/Users/etagwerker/Projects/database_cleaner/examples/features/support/../../db/activerecord_one.db"
|
5
|
+
two:
|
6
|
+
adapter: sqlite3
|
7
|
+
database: "/Users/etagwerker/Projects/database_cleaner/examples/features/support/../../db/activerecord_two.db"
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module DatabaseCleaner
|
2
|
+
module Mongo2
|
3
|
+
def self.available_strategies
|
4
|
+
%w[truncation]
|
5
|
+
end
|
6
|
+
module Base
|
7
|
+
def db=(desired_db)
|
8
|
+
@db = desired_db
|
9
|
+
end
|
10
|
+
|
11
|
+
def db
|
12
|
+
@db || raise("You have not specified a database. (see Mongo2::Database)")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module DatabaseCleaner
|
2
|
+
module Mongo2
|
3
|
+
module TruncationMixin
|
4
|
+
|
5
|
+
def clean
|
6
|
+
if @only
|
7
|
+
collections.each { |c| database[c].find.delete_many if @only.include?(c) }
|
8
|
+
else
|
9
|
+
collections.each { |c| database[c].find.delete_many unless @tables_to_exclude.include?(c) }
|
10
|
+
end
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def database
|
17
|
+
if @db.nil? || @db == :default
|
18
|
+
::Mongoid::Clients.default
|
19
|
+
else
|
20
|
+
::Mongoid::Clients.with_name(@db)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def collections
|
25
|
+
if db != :default
|
26
|
+
database.use(db)
|
27
|
+
end
|
28
|
+
|
29
|
+
database['system.namespaces'].find(:name => { '$not' => /\.system\.|\$/ }).to_a.map do |collection|
|
30
|
+
_, name = collection['name'].split('.', 2)
|
31
|
+
name
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_cleaner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Mabey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -395,8 +395,14 @@ files:
|
|
395
395
|
- cucumber.yml
|
396
396
|
- examples/Gemfile
|
397
397
|
- examples/Gemfile.lock
|
398
|
+
- examples/config/database.yml
|
398
399
|
- examples/config/database.yml.example
|
399
400
|
- examples/config/redis.yml
|
401
|
+
- examples/db/activerecord_one.db
|
402
|
+
- examples/db/activerecord_two.db
|
403
|
+
- examples/db/datamapper_default.db
|
404
|
+
- examples/db/datamapper_one.db
|
405
|
+
- examples/db/datamapper_two.db
|
400
406
|
- examples/db/sqlite_databases_go_here
|
401
407
|
- examples/features/example.feature
|
402
408
|
- examples/features/example_multiple_db.feature
|
@@ -446,6 +452,8 @@ files:
|
|
446
452
|
- lib/database_cleaner/mongo/base.rb
|
447
453
|
- lib/database_cleaner/mongo/truncation.rb
|
448
454
|
- lib/database_cleaner/mongo/truncation_mixin.rb
|
455
|
+
- lib/database_cleaner/mongo2/base.rb
|
456
|
+
- lib/database_cleaner/mongo2/truncation_mixin.rb
|
449
457
|
- lib/database_cleaner/mongo_mapper/base.rb
|
450
458
|
- lib/database_cleaner/mongo_mapper/truncation.rb
|
451
459
|
- lib/database_cleaner/mongoid/base.rb
|
@@ -503,6 +511,8 @@ files:
|
|
503
511
|
- spec/rcov.opts
|
504
512
|
- spec/spec_helper.rb
|
505
513
|
- spec/support/active_record/database_setup.rb
|
514
|
+
- spec/support/active_record/migrations/20150101010000_create_users.rb
|
515
|
+
- spec/support/active_record/migrations/20150101020000_create_agents.rb
|
506
516
|
- spec/support/active_record/mysql2_setup.rb
|
507
517
|
- spec/support/active_record/mysql_setup.rb
|
508
518
|
- spec/support/active_record/postgresql_setup.rb
|