database_cleaner 1.6.2 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +3 -3
- data/History.rdoc +23 -0
- data/README.markdown +24 -1
- data/VERSION.yml +2 -2
- data/lib/database_cleaner.rb +6 -2
- data/lib/database_cleaner/active_record/base.rb +1 -1
- data/lib/database_cleaner/active_record/deletion.rb +9 -7
- data/lib/database_cleaner/base.rb +2 -0
- data/lib/database_cleaner/safeguard.rb +72 -0
- metadata +6 -86
- data/examples/Gemfile +0 -1
- data/examples/Gemfile.lock +0 -1
- data/examples/config/database.yml.example +0 -8
- data/examples/config/redis.yml +0 -8
- data/examples/db/sqlite_databases_go_here +0 -0
- data/examples/features/example.feature +0 -11
- data/examples/features/example_multiple_db.feature +0 -23
- data/examples/features/example_multiple_orm.feature +0 -22
- data/examples/features/step_definitions/activerecord_steps.rb +0 -31
- data/examples/features/step_definitions/couchpotato_steps.rb +0 -31
- data/examples/features/step_definitions/datamapper_steps.rb +0 -37
- data/examples/features/step_definitions/mongoid_steps.rb +0 -23
- data/examples/features/step_definitions/mongomapper_steps.rb +0 -31
- data/examples/features/step_definitions/neo4j_steps.rb +0 -23
- data/examples/features/step_definitions/ohm_steps.rb +0 -31
- data/examples/features/step_definitions/redis_steps.rb +0 -31
- data/examples/features/step_definitions/translation_steps.rb +0 -55
- data/examples/features/support/env.rb +0 -61
- data/examples/lib/activerecord_models.rb +0 -41
- data/examples/lib/couchpotato_models.rb +0 -61
- data/examples/lib/datamapper_models.rb +0 -50
- data/examples/lib/mongoid_models.rb +0 -44
- data/examples/lib/mongomapper_models.rb +0 -51
- data/examples/lib/neo4j_models.rb +0 -17
- data/examples/lib/ohm_models.rb +0 -43
- data/examples/lib/redis_models.rb +0 -65
- data/examples/lib/sequel_models.rb +0 -9
- data/features/cleaning.feature +0 -30
- data/features/cleaning_default_strategy.feature +0 -23
- data/features/cleaning_multiple_dbs.feature +0 -22
- data/features/cleaning_multiple_orms.feature +0 -67
- data/features/step_definitions/database_cleaner_steps.rb +0 -33
- data/features/support/env.rb +0 -4
- data/features/support/feature_runner.rb +0 -39
- data/spec/database_cleaner/active_record/base_spec.rb +0 -188
- data/spec/database_cleaner/active_record/transaction_spec.rb +0 -176
- data/spec/database_cleaner/active_record/truncation/mysql2_spec.rb +0 -38
- data/spec/database_cleaner/active_record/truncation/mysql_spec.rb +0 -38
- data/spec/database_cleaner/active_record/truncation/postgresql_spec.rb +0 -75
- data/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb +0 -40
- data/spec/database_cleaner/active_record/truncation/sqlite3_spec.rb +0 -40
- data/spec/database_cleaner/active_record/truncation_spec.rb +0 -180
- data/spec/database_cleaner/base_spec.rb +0 -617
- data/spec/database_cleaner/configuration_spec.rb +0 -345
- data/spec/database_cleaner/couch_potato/truncation_spec.rb +0 -41
- data/spec/database_cleaner/data_mapper/base_spec.rb +0 -30
- data/spec/database_cleaner/data_mapper/transaction_spec.rb +0 -23
- data/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb +0 -41
- data/spec/database_cleaner/data_mapper/truncation_spec.rb +0 -11
- data/spec/database_cleaner/generic/base_spec.rb +0 -61
- data/spec/database_cleaner/generic/truncation_spec.rb +0 -118
- data/spec/database_cleaner/mongo/mongo_examples.rb +0 -26
- data/spec/database_cleaner/mongo/truncation_spec.rb +0 -72
- data/spec/database_cleaner/mongo_mapper/base_spec.rb +0 -33
- data/spec/database_cleaner/mongo_mapper/mongo_examples.rb +0 -8
- data/spec/database_cleaner/mongo_mapper/truncation_spec.rb +0 -74
- data/spec/database_cleaner/moped/moped_examples.rb +0 -32
- data/spec/database_cleaner/moped/truncation_spec.rb +0 -80
- data/spec/database_cleaner/neo4j/base_spec.rb +0 -43
- data/spec/database_cleaner/neo4j/transaction_spec.rb +0 -25
- data/spec/database_cleaner/null_strategy_spec.rb +0 -28
- data/spec/database_cleaner/ohm/truncation_spec.rb +0 -70
- data/spec/database_cleaner/redis/base_spec.rb +0 -43
- data/spec/database_cleaner/redis/truncation_spec.rb +0 -63
- data/spec/database_cleaner/sequel/base_spec.rb +0 -32
- data/spec/database_cleaner/sequel/deletion_spec.rb +0 -58
- data/spec/database_cleaner/sequel/transaction_spec.rb +0 -21
- data/spec/database_cleaner/sequel/truncation/sqlite3_spec.rb +0 -0
- data/spec/database_cleaner/sequel/truncation_spec.rb +0 -182
- data/spec/database_cleaner/shared_strategy.rb +0 -15
- data/spec/rcov.opts +0 -1
- data/spec/spec_helper.rb +0 -21
- data/spec/support/active_record/database_setup.rb +0 -6
- data/spec/support/active_record/migrations/20150101010000_create_users.rb +0 -14
- data/spec/support/active_record/migrations/20150101020000_create_agents.rb +0 -14
- data/spec/support/active_record/mysql2_setup.rb +0 -39
- data/spec/support/active_record/mysql_setup.rb +0 -38
- data/spec/support/active_record/postgresql_setup.rb +0 -48
- data/spec/support/active_record/schema_setup.rb +0 -17
- data/spec/support/active_record/sqlite3_setup.rb +0 -40
- data/spec/support/data_mapper/schema_setup.rb +0 -15
- data/spec/support/data_mapper/sqlite3_setup.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5a0ef67709709d9ad8373dbc723dc3c5b965766a7e48b40badf5d4392558a6bd
|
4
|
+
data.tar.gz: 141f0a4e38d548ca0f100dd25f7c305cf459d87970eff5b8283d1a7b79eb0734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8161cfd306d227da75c2d997eeae124f191d9382b81a7e884ac43a5e272b4a931386427e700ef11af9f5416f6916c467c77104e46441b6b9a5e6329191c3516
|
7
|
+
data.tar.gz: 52f01680d172a214fa97d9f495c644b329014c74e53c862aa7aa7c91c26b0ca0769e684632997c564a2001f60fc212e03dabca789e0b27b3d1a93d1cd964f5aa
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
database_cleaner (1.6.
|
4
|
+
database_cleaner (1.6.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -141,8 +141,8 @@ GEM
|
|
141
141
|
httpclient (2.5.3.3)
|
142
142
|
i18n (0.4.2)
|
143
143
|
jdbc-sqlite3 (3.8.10.1)
|
144
|
-
json (1.8.
|
145
|
-
json (1.8.
|
144
|
+
json (1.8.6)
|
145
|
+
json (1.8.6-java)
|
146
146
|
json_pure (1.8.1)
|
147
147
|
listen (1.3.1)
|
148
148
|
rb-fsevent (>= 0.9.3)
|
data/History.rdoc
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
== Development (master)
|
2
2
|
|
3
|
+
=== Bug Fixes
|
4
|
+
=== Changes
|
5
|
+
|
6
|
+
== 1.7.0 2017-04-19
|
7
|
+
|
8
|
+
=== Bug Fixes
|
9
|
+
* Remove unnecessary folders from gem: https://github.com/DatabaseCleaner/database_cleaner/pull/508
|
10
|
+
* Properly quote table names: https://github.com/DatabaseCleaner/database_cleaner/pull/501
|
11
|
+
* Use more idiomatic Ruby in README: https://github.com/DatabaseCleaner/database_cleaner/pull/510
|
12
|
+
* Return ::ActiveRecord::Base from `establish_connection`: https://github.com/DatabaseCleaner/database_cleaner/pull/399
|
13
|
+
|
14
|
+
=== Changes
|
15
|
+
* Safeguard against running in production or running against a remote database: https://github.com/DatabaseCleaner/database_cleaner/pull/521
|
16
|
+
|
17
|
+
== 1.6.2 2017-10-29
|
18
|
+
|
19
|
+
=== Bug Fixes
|
20
|
+
* ActiveRecord::Base namespace patch: https://github.com/DatabaseCleaner/database_cleaner/pull/490
|
21
|
+
* Better exclusion condition based on Rails version: https://github.com/DatabaseCleaner/database_cleaner/pull/487
|
22
|
+
|
23
|
+
=== Changes
|
24
|
+
* Better documentation. Typos were fixed. Sequel deletion is supported: https://github.com/DatabaseCleaner/database_cleaner/pull/500
|
25
|
+
|
3
26
|
== 1.6.1 2017-05-09
|
4
27
|
|
5
28
|
=== Bug Fixes
|
data/README.markdown
CHANGED
@@ -295,7 +295,7 @@ RSpec.configure do |config|
|
|
295
295
|
# with the specs, so continue to use transaction strategy for speed.
|
296
296
|
driver_shares_db_connection_with_specs = Capybara.current_driver == :rack_test
|
297
297
|
|
298
|
-
|
298
|
+
unless driver_shares_db_connection_with_specs
|
299
299
|
# Driver is probably for an external browser with an app
|
300
300
|
# under test that does *not* share a database connection with the
|
301
301
|
# specs, so use truncation strategy.
|
@@ -502,6 +502,29 @@ Dir["#{Rails.root}/app/models/**/*.rb"].each do |model|
|
|
502
502
|
end
|
503
503
|
```
|
504
504
|
|
505
|
+
## Safeguards
|
506
|
+
|
507
|
+
DatabaseCleaner comes with safeguards against:
|
508
|
+
|
509
|
+
* Running in production (checking for `ENV`, `RACK_ENV`, and `RAILS_ENV`)
|
510
|
+
* Running against a remote database (checking for a `DATABASE_URL` that does not include `localhost`)
|
511
|
+
|
512
|
+
Both safeguards can be disabled separately as follows.
|
513
|
+
|
514
|
+
Using environment variables:
|
515
|
+
|
516
|
+
```
|
517
|
+
export DATABASE_CLEANER_ALLOW_PRODUCTION=true
|
518
|
+
export DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true
|
519
|
+
```
|
520
|
+
|
521
|
+
In Ruby:
|
522
|
+
|
523
|
+
```ruby
|
524
|
+
DatabaseCleaner.allow_production = true
|
525
|
+
DatabaseCleaner.allow_remote_database_url = true
|
526
|
+
```
|
527
|
+
|
505
528
|
## Debugging
|
506
529
|
|
507
530
|
In rare cases DatabaseCleaner will encounter errors that it will log. By default it uses STDOUT set to the ERROR level but you can configure this to use whatever Logger you desire.
|
data/VERSION.yml
CHANGED
data/lib/database_cleaner.rb
CHANGED
@@ -2,7 +2,11 @@ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.i
|
|
2
2
|
require 'database_cleaner/configuration'
|
3
3
|
|
4
4
|
module DatabaseCleaner
|
5
|
-
|
6
|
-
|
5
|
+
class << self
|
6
|
+
attr_accessor :allow_remote_database_url, :allow_production
|
7
|
+
|
8
|
+
def can_detect_orm?
|
9
|
+
DatabaseCleaner::Base.autodetect_orm
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
@@ -66,14 +66,16 @@ module DatabaseCleaner::ActiveRecord
|
|
66
66
|
if @cache_tables && !@table_stats_query.nil?
|
67
67
|
return @table_stats_query
|
68
68
|
else
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
table_schema = '#{db_name}'
|
75
|
-
AND #{::DatabaseCleaner::ActiveRecord::Base.exclusion_condition('table_name')};
|
69
|
+
tables = connection.select_values(<<-SQL)
|
70
|
+
SELECT table_name
|
71
|
+
FROM information_schema.tables
|
72
|
+
WHERE table_schema = '#{db_name}'
|
73
|
+
AND #{::DatabaseCleaner::ActiveRecord::Base.exclusion_condition('table_name')};
|
76
74
|
SQL
|
75
|
+
queries = tables.map do |table|
|
76
|
+
"SELECT #{connection.quote(table)} AS table_name, COUNT(*) AS exact_row_count FROM #{connection.quote_table_name(table)}"
|
77
|
+
end
|
78
|
+
@table_stats_query = queries.join(' UNION ')
|
77
79
|
end
|
78
80
|
end
|
79
81
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'database_cleaner/null_strategy'
|
2
|
+
require 'database_cleaner/safeguard'
|
2
3
|
module DatabaseCleaner
|
3
4
|
class Base
|
4
5
|
include Comparable
|
@@ -15,6 +16,7 @@ module DatabaseCleaner
|
|
15
16
|
end
|
16
17
|
self.db = opts[:connection] || opts[:model] if opts.has_key?(:connection) || opts.has_key?(:model)
|
17
18
|
set_default_orm_strategy
|
19
|
+
Safeguard.new.run
|
18
20
|
end
|
19
21
|
|
20
22
|
def db=(desired_db)
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module DatabaseCleaner
|
2
|
+
class Safeguard
|
3
|
+
class Error < Exception
|
4
|
+
class RemoteDatabaseUrl < Error
|
5
|
+
def initialize
|
6
|
+
super("ENV['DATABASE_URL'] is set to a remote URL. Please refer to https://github.com/DatabaseCleaner/database_cleaner#safeguards")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class ProductionEnv < Error
|
11
|
+
def initialize(env)
|
12
|
+
super("ENV['#{env}'] is set to production. Please refer to https://github.com/DatabaseCleaner/database_cleaner#safeguards")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class RemoteDatabaseUrl
|
18
|
+
LOCAL = %w(localhost 127.0.0.1)
|
19
|
+
|
20
|
+
def run
|
21
|
+
raise Error::RemoteDatabaseUrl if !skip? && given?
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def given?
|
27
|
+
remote?(ENV['DATABASE_URL'])
|
28
|
+
end
|
29
|
+
|
30
|
+
def remote?(url)
|
31
|
+
url && !LOCAL.any? { |str| url.include?(str) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def skip?
|
35
|
+
ENV['DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL'] ||
|
36
|
+
DatabaseCleaner.allow_remote_database_url
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Production
|
41
|
+
KEYS = %w(ENV RACK_ENV RAILS_ENV)
|
42
|
+
|
43
|
+
def run
|
44
|
+
raise Error::ProductionEnv.new(key) if !skip? && given?
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def given?
|
50
|
+
!!key
|
51
|
+
end
|
52
|
+
|
53
|
+
def key
|
54
|
+
@key ||= KEYS.detect { |key| ENV[key] == 'production' }
|
55
|
+
end
|
56
|
+
|
57
|
+
def skip?
|
58
|
+
ENV['DATABASE_CLEANER_ALLOW_PRODUCTION'] ||
|
59
|
+
DatabaseCleaner.allow_production
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
CHECKS = [
|
64
|
+
RemoteDatabaseUrl,
|
65
|
+
Production
|
66
|
+
]
|
67
|
+
|
68
|
+
def run
|
69
|
+
CHECKS.each { |const| const.new.run }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: database_cleaner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Mabey
|
8
|
+
- Ernesto Tagwerker
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2018-04-19 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rake
|
@@ -376,7 +377,7 @@ dependencies:
|
|
376
377
|
version: '0'
|
377
378
|
description: Strategies for cleaning databases. Can be used to ensure a clean state
|
378
379
|
for testing.
|
379
|
-
email:
|
380
|
+
email: ernesto@ombulabs.com
|
380
381
|
executables: []
|
381
382
|
extensions: []
|
382
383
|
extra_rdoc_files:
|
@@ -393,40 +394,6 @@ files:
|
|
393
394
|
- TODO
|
394
395
|
- VERSION.yml
|
395
396
|
- cucumber.yml
|
396
|
-
- examples/Gemfile
|
397
|
-
- examples/Gemfile.lock
|
398
|
-
- examples/config/database.yml.example
|
399
|
-
- examples/config/redis.yml
|
400
|
-
- examples/db/sqlite_databases_go_here
|
401
|
-
- examples/features/example.feature
|
402
|
-
- examples/features/example_multiple_db.feature
|
403
|
-
- examples/features/example_multiple_orm.feature
|
404
|
-
- examples/features/step_definitions/activerecord_steps.rb
|
405
|
-
- examples/features/step_definitions/couchpotato_steps.rb
|
406
|
-
- examples/features/step_definitions/datamapper_steps.rb
|
407
|
-
- examples/features/step_definitions/mongoid_steps.rb
|
408
|
-
- examples/features/step_definitions/mongomapper_steps.rb
|
409
|
-
- examples/features/step_definitions/neo4j_steps.rb
|
410
|
-
- examples/features/step_definitions/ohm_steps.rb
|
411
|
-
- examples/features/step_definitions/redis_steps.rb
|
412
|
-
- examples/features/step_definitions/translation_steps.rb
|
413
|
-
- examples/features/support/env.rb
|
414
|
-
- examples/lib/activerecord_models.rb
|
415
|
-
- examples/lib/couchpotato_models.rb
|
416
|
-
- examples/lib/datamapper_models.rb
|
417
|
-
- examples/lib/mongoid_models.rb
|
418
|
-
- examples/lib/mongomapper_models.rb
|
419
|
-
- examples/lib/neo4j_models.rb
|
420
|
-
- examples/lib/ohm_models.rb
|
421
|
-
- examples/lib/redis_models.rb
|
422
|
-
- examples/lib/sequel_models.rb
|
423
|
-
- features/cleaning.feature
|
424
|
-
- features/cleaning_default_strategy.feature
|
425
|
-
- features/cleaning_multiple_dbs.feature
|
426
|
-
- features/cleaning_multiple_orms.feature
|
427
|
-
- features/step_definitions/database_cleaner_steps.rb
|
428
|
-
- features/support/env.rb
|
429
|
-
- features/support/feature_runner.rb
|
430
397
|
- lib/database_cleaner.rb
|
431
398
|
- lib/database_cleaner/active_record/base.rb
|
432
399
|
- lib/database_cleaner/active_record/deletion.rb
|
@@ -463,58 +430,11 @@ files:
|
|
463
430
|
- lib/database_cleaner/ohm/truncation.rb
|
464
431
|
- lib/database_cleaner/redis/base.rb
|
465
432
|
- lib/database_cleaner/redis/truncation.rb
|
433
|
+
- lib/database_cleaner/safeguard.rb
|
466
434
|
- lib/database_cleaner/sequel/base.rb
|
467
435
|
- lib/database_cleaner/sequel/deletion.rb
|
468
436
|
- lib/database_cleaner/sequel/transaction.rb
|
469
437
|
- lib/database_cleaner/sequel/truncation.rb
|
470
|
-
- spec/database_cleaner/active_record/base_spec.rb
|
471
|
-
- spec/database_cleaner/active_record/transaction_spec.rb
|
472
|
-
- spec/database_cleaner/active_record/truncation/mysql2_spec.rb
|
473
|
-
- spec/database_cleaner/active_record/truncation/mysql_spec.rb
|
474
|
-
- spec/database_cleaner/active_record/truncation/postgresql_spec.rb
|
475
|
-
- spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
|
476
|
-
- spec/database_cleaner/active_record/truncation/sqlite3_spec.rb
|
477
|
-
- spec/database_cleaner/active_record/truncation_spec.rb
|
478
|
-
- spec/database_cleaner/base_spec.rb
|
479
|
-
- spec/database_cleaner/configuration_spec.rb
|
480
|
-
- spec/database_cleaner/couch_potato/truncation_spec.rb
|
481
|
-
- spec/database_cleaner/data_mapper/base_spec.rb
|
482
|
-
- spec/database_cleaner/data_mapper/transaction_spec.rb
|
483
|
-
- spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb
|
484
|
-
- spec/database_cleaner/data_mapper/truncation_spec.rb
|
485
|
-
- spec/database_cleaner/generic/base_spec.rb
|
486
|
-
- spec/database_cleaner/generic/truncation_spec.rb
|
487
|
-
- spec/database_cleaner/mongo/mongo_examples.rb
|
488
|
-
- spec/database_cleaner/mongo/truncation_spec.rb
|
489
|
-
- spec/database_cleaner/mongo_mapper/base_spec.rb
|
490
|
-
- spec/database_cleaner/mongo_mapper/mongo_examples.rb
|
491
|
-
- spec/database_cleaner/mongo_mapper/truncation_spec.rb
|
492
|
-
- spec/database_cleaner/moped/moped_examples.rb
|
493
|
-
- spec/database_cleaner/moped/truncation_spec.rb
|
494
|
-
- spec/database_cleaner/neo4j/base_spec.rb
|
495
|
-
- spec/database_cleaner/neo4j/transaction_spec.rb
|
496
|
-
- spec/database_cleaner/null_strategy_spec.rb
|
497
|
-
- spec/database_cleaner/ohm/truncation_spec.rb
|
498
|
-
- spec/database_cleaner/redis/base_spec.rb
|
499
|
-
- spec/database_cleaner/redis/truncation_spec.rb
|
500
|
-
- spec/database_cleaner/sequel/base_spec.rb
|
501
|
-
- spec/database_cleaner/sequel/deletion_spec.rb
|
502
|
-
- spec/database_cleaner/sequel/transaction_spec.rb
|
503
|
-
- spec/database_cleaner/sequel/truncation/sqlite3_spec.rb
|
504
|
-
- spec/database_cleaner/sequel/truncation_spec.rb
|
505
|
-
- spec/database_cleaner/shared_strategy.rb
|
506
|
-
- spec/rcov.opts
|
507
|
-
- spec/spec_helper.rb
|
508
|
-
- spec/support/active_record/database_setup.rb
|
509
|
-
- spec/support/active_record/migrations/20150101010000_create_users.rb
|
510
|
-
- spec/support/active_record/migrations/20150101020000_create_agents.rb
|
511
|
-
- spec/support/active_record/mysql2_setup.rb
|
512
|
-
- spec/support/active_record/mysql_setup.rb
|
513
|
-
- spec/support/active_record/postgresql_setup.rb
|
514
|
-
- spec/support/active_record/schema_setup.rb
|
515
|
-
- spec/support/active_record/sqlite3_setup.rb
|
516
|
-
- spec/support/data_mapper/schema_setup.rb
|
517
|
-
- spec/support/data_mapper/sqlite3_setup.rb
|
518
438
|
homepage: http://github.com/DatabaseCleaner/database_cleaner
|
519
439
|
licenses:
|
520
440
|
- MIT
|
@@ -535,7 +455,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
535
455
|
version: '0'
|
536
456
|
requirements: []
|
537
457
|
rubyforge_project:
|
538
|
-
rubygems_version: 2.
|
458
|
+
rubygems_version: 2.7.3
|
539
459
|
signing_key:
|
540
460
|
specification_version: 4
|
541
461
|
summary: Strategies for cleaning databases. Can be used to ensure a clean state for
|
data/examples/Gemfile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
examples/../Gemfile
|
data/examples/Gemfile.lock
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
examples/../Gemfile.lock
|
@@ -1,8 +0,0 @@
|
|
1
|
-
#This is an example of what database.yml *should* look like (when I wrote it)
|
2
|
-
#The real database.yml is generated automatically by the active record model lib (so it can be correct)
|
3
|
-
two:
|
4
|
-
adapter: sqlite3
|
5
|
-
database: /path/to/examples/features/support/../../db/activerecord_two.db
|
6
|
-
one:
|
7
|
-
adapter: sqlite3
|
8
|
-
database: /path/to/examples/features/support/../../db/activerecord_one.db
|
data/examples/config/redis.yml
DELETED
File without changes
|
@@ -1,11 +0,0 @@
|
|
1
|
-
Feature: example
|
2
|
-
In order to test DataBase Cleaner
|
3
|
-
Here are some scenarios that rely on the DB being clean!
|
4
|
-
|
5
|
-
Scenario: dirty the db
|
6
|
-
When I create a widget
|
7
|
-
Then I should see 1 widget
|
8
|
-
|
9
|
-
Scenario: assume a clean db
|
10
|
-
When I create a widget
|
11
|
-
Then I should see 1 widget
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Feature: example
|
2
|
-
In order to test DataBase Cleaner
|
3
|
-
Here are some scenarios that rely on the DB being clean!
|
4
|
-
|
5
|
-
# Background:
|
6
|
-
# Given I have setup DatabaseCleaner to clean multiple databases
|
7
|
-
#
|
8
|
-
Scenario: dirty the db
|
9
|
-
When I create a widget in one db
|
10
|
-
And I create a widget in another db
|
11
|
-
Then I should see 1 widget in one db
|
12
|
-
And I should see 1 widget in another db
|
13
|
-
|
14
|
-
Scenario: assume a clean db
|
15
|
-
When I create a widget in one db
|
16
|
-
Then I should see 1 widget in one db
|
17
|
-
And I should see 0 widget in another db
|
18
|
-
|
19
|
-
Scenario: assume a clean db
|
20
|
-
When I create a widget in another db
|
21
|
-
Then I should see 0 widget in one db
|
22
|
-
And I should see 1 widget in another db
|
23
|
-
|