database_cleaner 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee5d65788bad454f27cf157e4015b137c7f1df81
4
- data.tar.gz: 824981f5faf89ee047760c5059f5ffc0315fd953
3
+ metadata.gz: 18b2553b2e2fecdaf872e7274771ccd7a38ab3c3
4
+ data.tar.gz: 33ea944750c6db5f050fa088c3971dc137ae3e23
5
5
  SHA512:
6
- metadata.gz: 89fe47e944fa6151f788c80607472c72316db36b516ade7780c11e9830bb7d55e977601453d865775fdedaddcae6109d8c163288e6aeebd974efcdfc61c95dff
7
- data.tar.gz: 93c1ebe47ddbe32f66524711cba00adb70e13c9a501d6cd8caaf785f17771a9e7625e65d73afecb2847dbeb8b367003c0aa99ab4362f2c161c89557251b38257
6
+ metadata.gz: c1fb21202bf49eaf1db4a30d5ab353722c3f9c7f6cc10685cb60d36a2c5beb92402bd702595732451862851a50be4960631a4cd2d37ae93b515ac6e85642e5c3
7
+ data.tar.gz: cd709be8380c719396270c0cbc51e8c2f745115e20d34a263bcc6c7e385f45f6ee33db0d26a1fbfd328329c379b083660e7c7ba704039a10d48225093556b0b4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- database_cleaner (1.5.0)
4
+ database_cleaner (1.5.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 5
4
- :patch: 0
4
+ :patch: 1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- database_cleaner (1.5.0)
4
+ database_cleaner (1.5.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
@@ -0,0 +1,14 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :name
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table :users
10
+ end
11
+ end
12
+
13
+ class ::User < ActiveRecord::Base
14
+ end
@@ -0,0 +1,14 @@
1
+ class CreateAgents < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :agents do |t|
4
+ t.string :name
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ drop_table :agents
10
+ end
11
+ end
12
+
13
+ class ::Agent < ActiveRecord::Base
14
+ 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.0
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-09-01 00:00:00.000000000 Z
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