database_cleaner 1.6.2 → 1.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CONTRIBUTE.markdown +1 -2
- data/Gemfile.lock +132 -93
- data/History.rdoc +67 -0
- data/README.markdown +88 -217
- data/Rakefile +12 -8
- data/{lib → adapters/database_cleaner-active_record/lib}/database_cleaner/active_record/base.rb +14 -5
- data/{lib → adapters/database_cleaner-active_record/lib}/database_cleaner/active_record/deletion.rb +19 -17
- data/{lib → adapters/database_cleaner-active_record/lib}/database_cleaner/active_record/truncation.rb +25 -20
- data/adapters/database_cleaner-active_record/lib/database_cleaner/active_record/version.rb +5 -0
- data/adapters/database_cleaner-active_record/lib/database_cleaner/active_record.rb +6 -0
- data/adapters/database_cleaner-active_record/lib/database_cleaner-active_record.rb +1 -0
- data/adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato/version.rb +5 -0
- data/adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato.rb +11 -0
- data/adapters/database_cleaner-couch_potato/lib/database_cleaner-couch_potato.rb +1 -0
- data/{lib → adapters/database_cleaner-data_mapper/lib}/database_cleaner/data_mapper/base.rb +4 -0
- data/{lib → adapters/database_cleaner-data_mapper/lib}/database_cleaner/data_mapper/truncation.rb +4 -3
- data/adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/version.rb +5 -0
- data/adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper.rb +4 -0
- data/adapters/database_cleaner-data_mapper/lib/database_cleaner-data_mapper.rb +1 -0
- data/{lib → adapters/database_cleaner-mongo/lib}/database_cleaner/mongo/truncation.rb +2 -0
- data/adapters/database_cleaner-mongo/lib/database_cleaner/mongo/version.rb +5 -0
- data/adapters/database_cleaner-mongo/lib/database_cleaner/mongo.rb +10 -0
- data/adapters/database_cleaner-mongo/lib/database_cleaner-mongo.rb +1 -0
- data/{lib → adapters/database_cleaner-mongo_mapper/lib}/database_cleaner/mongo_mapper/base.rb +4 -0
- data/adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/truncation.rb +35 -0
- data/adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/version.rb +5 -0
- data/adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper.rb +4 -0
- data/adapters/database_cleaner-mongo_mapper/lib/database_cleaner-mongo_mapper.rb +1 -0
- data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/mongo1_truncation_mixin.rb +26 -0
- data/{lib/database_cleaner/mongo2/truncation_mixin.rb → adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/mongo2_truncation_mixin.rb} +3 -4
- data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/mongoid_truncation_mixin.rb +65 -0
- data/{lib → adapters/database_cleaner-mongoid/lib}/database_cleaner/mongoid/truncation.rb +6 -6
- data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/version.rb +5 -0
- data/adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid.rb +10 -0
- data/adapters/database_cleaner-mongoid/lib/database_cleaner-mongoid.rb +1 -0
- data/{lib → adapters/database_cleaner-moped/lib}/database_cleaner/moped/base.rb +1 -1
- data/{lib → adapters/database_cleaner-moped/lib}/database_cleaner/moped/truncation_base.rb +4 -0
- data/adapters/database_cleaner-moped/lib/database_cleaner/moped/version.rb +5 -0
- data/adapters/database_cleaner-moped/lib/database_cleaner/moped.rb +10 -0
- data/adapters/database_cleaner-moped/lib/database_cleaner-moped.rb +1 -0
- data/{lib → adapters/database_cleaner-neo4j/lib}/database_cleaner/neo4j/base.rb +4 -0
- data/adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/version.rb +5 -0
- data/adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j.rb +6 -0
- data/adapters/database_cleaner-neo4j/lib/database_cleaner-neo4j.rb +1 -0
- data/adapters/database_cleaner-ohm/lib/database_cleaner/ohm/truncation.rb +24 -0
- data/adapters/database_cleaner-ohm/lib/database_cleaner/ohm/version.rb +5 -0
- data/adapters/database_cleaner-ohm/lib/database_cleaner/ohm.rb +12 -0
- data/adapters/database_cleaner-ohm/lib/database_cleaner-ohm.rb +1 -0
- data/{lib → adapters/database_cleaner-redis/lib}/database_cleaner/redis/base.rb +4 -0
- data/adapters/database_cleaner-redis/lib/database_cleaner/redis/version.rb +5 -0
- data/adapters/database_cleaner-redis/lib/database_cleaner/redis.rb +4 -0
- data/adapters/database_cleaner-redis/lib/database_cleaner-redis.rb +1 -0
- data/{lib → adapters/database_cleaner-sequel/lib}/database_cleaner/sequel/base.rb +4 -0
- data/{lib → adapters/database_cleaner-sequel/lib}/database_cleaner/sequel/truncation.rb +16 -15
- data/adapters/database_cleaner-sequel/lib/database_cleaner/sequel/version.rb +5 -0
- data/adapters/database_cleaner-sequel/lib/database_cleaner/sequel.rb +6 -0
- data/adapters/database_cleaner-sequel/lib/database_cleaner-sequel.rb +1 -0
- data/lib/database_cleaner/base.rb +94 -105
- data/lib/database_cleaner/configuration.rb +87 -83
- data/lib/database_cleaner/deprecation.rb +26 -0
- data/lib/database_cleaner/null_strategy.rb +6 -6
- data/lib/database_cleaner/orm_autodetector.rb +41 -0
- data/lib/database_cleaner/safeguard.rb +107 -0
- data/lib/database_cleaner/spec/database_helper.rb +82 -0
- data/lib/database_cleaner/spec/shared_examples.rb +15 -0
- data/lib/database_cleaner/spec.rb +2 -0
- data/lib/database_cleaner/version.rb +3 -0
- data/lib/database_cleaner.rb +41 -2
- metadata +113 -126
- data/VERSION.yml +0 -4
- 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/lib/database_cleaner/mongo2/base.rb +0 -16
- data/lib/database_cleaner/mongo_mapper/truncation.rb +0 -19
- data/lib/database_cleaner/ohm/truncation.rb +0 -15
- 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
- /data/{lib → adapters/database_cleaner-active_record/lib}/database_cleaner/active_record/transaction.rb +0 -0
- /data/{lib → adapters/database_cleaner-couch_potato/lib}/database_cleaner/couch_potato/base.rb +0 -0
- /data/{lib → adapters/database_cleaner-couch_potato/lib}/database_cleaner/couch_potato/truncation.rb +0 -0
- /data/{lib → adapters/database_cleaner-data_mapper/lib}/database_cleaner/data_mapper/transaction.rb +0 -0
- /data/{lib → adapters/database_cleaner-mongo/lib}/database_cleaner/mongo/base.rb +0 -0
- /data/{lib → adapters/database_cleaner-mongo/lib}/database_cleaner/mongo/truncation_mixin.rb +0 -0
- /data/{lib → adapters/database_cleaner-mongoid/lib}/database_cleaner/mongoid/base.rb +0 -0
- /data/{lib → adapters/database_cleaner-moped/lib}/database_cleaner/moped/truncation.rb +0 -0
- /data/{lib → adapters/database_cleaner-neo4j/lib}/database_cleaner/neo4j/deletion.rb +0 -0
- /data/{lib → adapters/database_cleaner-neo4j/lib}/database_cleaner/neo4j/transaction.rb +0 -0
- /data/{lib → adapters/database_cleaner-neo4j/lib}/database_cleaner/neo4j/truncation.rb +0 -0
- /data/{lib → adapters/database_cleaner-redis/lib}/database_cleaner/redis/truncation.rb +0 -0
- /data/{lib → adapters/database_cleaner-sequel/lib}/database_cleaner/sequel/deletion.rb +0 -0
- /data/{lib → adapters/database_cleaner-sequel/lib}/database_cleaner/sequel/transaction.rb +0 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module DatabaseCleaner
|
4
|
+
module Spec
|
5
|
+
class DatabaseHelper < Struct.new(:db)
|
6
|
+
def self.with_all_dbs &block
|
7
|
+
%w[mysql mysql2 sqlite3 postgres].map(&:to_sym).each do |db|
|
8
|
+
yield new(db)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def setup
|
13
|
+
create_db
|
14
|
+
establish_connection
|
15
|
+
load_schema
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :connection
|
19
|
+
|
20
|
+
def teardown
|
21
|
+
drop_db
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def establish_connection(config = default_config)
|
27
|
+
raise NotImplementedError
|
28
|
+
end
|
29
|
+
|
30
|
+
def create_db
|
31
|
+
if db == :sqlite3
|
32
|
+
# NO-OP
|
33
|
+
elsif db == :postgres
|
34
|
+
establish_connection default_config.merge('database' => 'postgres')
|
35
|
+
connection.execute "CREATE DATABASE #{default_config['database']}" rescue nil
|
36
|
+
else
|
37
|
+
establish_connection default_config.merge("database" => nil)
|
38
|
+
connection.execute "CREATE DATABASE IF NOT EXISTS #{default_config['database']}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def load_schema
|
43
|
+
connection.execute <<-SQL
|
44
|
+
CREATE TABLE IF NOT EXISTS users (
|
45
|
+
id SERIAL PRIMARY KEY,
|
46
|
+
name INTEGER
|
47
|
+
);
|
48
|
+
SQL
|
49
|
+
|
50
|
+
connection.execute <<-SQL
|
51
|
+
CREATE TABLE IF NOT EXISTS agents (
|
52
|
+
name INTEGER
|
53
|
+
);
|
54
|
+
SQL
|
55
|
+
end
|
56
|
+
|
57
|
+
def drop_db
|
58
|
+
if db == :sqlite3
|
59
|
+
begin
|
60
|
+
File.unlink(db_config['sqlite3']['database'])
|
61
|
+
rescue Errno::ENOENT
|
62
|
+
end
|
63
|
+
elsif db == :postgres
|
64
|
+
# FIXME
|
65
|
+
connection.execute "DROP TABLE IF EXISTS users"
|
66
|
+
connection.execute "DROP TABLE IF EXISTS agents"
|
67
|
+
else
|
68
|
+
connection.execute "DROP DATABASE IF EXISTS #{default_config['database']}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def db_config
|
73
|
+
config_path = 'spec/support/config.yml'
|
74
|
+
@db_config ||= YAML.load(IO.read(config_path))
|
75
|
+
end
|
76
|
+
|
77
|
+
def default_config
|
78
|
+
db_config[db.to_s]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
RSpec.shared_examples_for "a generic strategy" do
|
2
|
+
it { is_expected.to respond_to(:db) }
|
3
|
+
end
|
4
|
+
|
5
|
+
RSpec.shared_examples_for "a generic truncation strategy" do
|
6
|
+
it { is_expected.to respond_to(:start) }
|
7
|
+
it { is_expected.to respond_to(:clean) }
|
8
|
+
it { is_expected.to respond_to(:cleaning) }
|
9
|
+
end
|
10
|
+
|
11
|
+
RSpec.shared_examples_for "a generic transaction strategy" do
|
12
|
+
it { is_expected.to respond_to(:start) }
|
13
|
+
it { is_expected.to respond_to(:clean) }
|
14
|
+
it { is_expected.to respond_to(:cleaning) }
|
15
|
+
end
|
data/lib/database_cleaner.rb
CHANGED
@@ -1,8 +1,47 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
|
2
|
+
require 'database_cleaner/version'
|
2
3
|
require 'database_cleaner/configuration'
|
4
|
+
require 'database_cleaner/deprecation'
|
5
|
+
require 'forwardable'
|
3
6
|
|
4
7
|
module DatabaseCleaner
|
5
|
-
|
6
|
-
|
8
|
+
class << self
|
9
|
+
extend Forwardable
|
10
|
+
delegate [
|
11
|
+
:[],
|
12
|
+
:app_root=,
|
13
|
+
:app_root,
|
14
|
+
:logger=,
|
15
|
+
:logger,
|
16
|
+
:cleaners,
|
17
|
+
:cleaners=,
|
18
|
+
:strategy=,
|
19
|
+
:orm=,
|
20
|
+
:start,
|
21
|
+
:clean,
|
22
|
+
:clean_with,
|
23
|
+
:cleaning,
|
24
|
+
|
25
|
+
# TODO remove in 2.0
|
26
|
+
:clean!,
|
27
|
+
:clean_with!,
|
28
|
+
:init_cleaners,
|
29
|
+
:add_cleaner,
|
30
|
+
:connections,
|
31
|
+
:remove_duplicates,
|
32
|
+
] => :configuration
|
33
|
+
|
34
|
+
attr_accessor :allow_remote_database_url, :allow_production, :url_whitelist
|
35
|
+
|
36
|
+
def can_detect_orm?
|
37
|
+
DatabaseCleaner.deprecate "Calling `DatabaseCleaner.can_detect_orm?` is deprecated, and will be removed in database_cleaner 2.0 with no replacement."
|
38
|
+
DatabaseCleaner::Base.autodetect_orm
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def configuration
|
44
|
+
@configuration ||= Configuration.new
|
45
|
+
end
|
7
46
|
end
|
8
47
|
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.8.5
|
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: 2020-05-04 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rake
|
@@ -178,6 +179,20 @@ dependencies:
|
|
178
179
|
- - ">="
|
179
180
|
- !ruby/object:Gem::Version
|
180
181
|
version: '0'
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: mongo
|
184
|
+
requirement: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - "~>"
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: 1.12.0
|
189
|
+
type: :development
|
190
|
+
prerelease: false
|
191
|
+
version_requirements: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - "~>"
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: 1.12.0
|
181
196
|
- !ruby/object:Gem::Dependency
|
182
197
|
name: moped
|
183
198
|
requirement: !ruby/object:Gem::Requirement
|
@@ -263,19 +278,33 @@ dependencies:
|
|
263
278
|
- !ruby/object:Gem::Version
|
264
279
|
version: '0'
|
265
280
|
- !ruby/object:Gem::Dependency
|
266
|
-
name:
|
281
|
+
name: listen
|
267
282
|
requirement: !ruby/object:Gem::Requirement
|
268
283
|
requirements:
|
269
284
|
- - "~>"
|
270
285
|
- !ruby/object:Gem::Version
|
271
|
-
version:
|
286
|
+
version: 3.0.0
|
272
287
|
type: :development
|
273
288
|
prerelease: false
|
274
289
|
version_requirements: !ruby/object:Gem::Requirement
|
275
290
|
requirements:
|
276
291
|
- - "~>"
|
277
292
|
- !ruby/object:Gem::Version
|
278
|
-
version:
|
293
|
+
version: 3.0.0
|
294
|
+
- !ruby/object:Gem::Dependency
|
295
|
+
name: rspec
|
296
|
+
requirement: !ruby/object:Gem::Requirement
|
297
|
+
requirements:
|
298
|
+
- - ">="
|
299
|
+
- !ruby/object:Gem::Version
|
300
|
+
version: '0'
|
301
|
+
type: :development
|
302
|
+
prerelease: false
|
303
|
+
version_requirements: !ruby/object:Gem::Requirement
|
304
|
+
requirements:
|
305
|
+
- - ">="
|
306
|
+
- !ruby/object:Gem::Version
|
307
|
+
version: '0'
|
279
308
|
- !ruby/object:Gem::Dependency
|
280
309
|
name: cucumber
|
281
310
|
requirement: !ruby/object:Gem::Requirement
|
@@ -374,9 +403,10 @@ dependencies:
|
|
374
403
|
- - ">="
|
375
404
|
- !ruby/object:Gem::Version
|
376
405
|
version: '0'
|
377
|
-
description: Strategies for cleaning databases. Can be used to ensure a clean
|
406
|
+
description: Strategies for cleaning databases. Can be used to ensure a clean slate
|
378
407
|
for testing.
|
379
|
-
email:
|
408
|
+
email:
|
409
|
+
- ernesto@ombulabs.com
|
380
410
|
executables: []
|
381
411
|
extensions: []
|
382
412
|
extra_rdoc_files:
|
@@ -391,131 +421,89 @@ files:
|
|
391
421
|
- README.markdown
|
392
422
|
- Rakefile
|
393
423
|
- TODO
|
394
|
-
-
|
424
|
+
- adapters/database_cleaner-active_record/lib/database_cleaner-active_record.rb
|
425
|
+
- adapters/database_cleaner-active_record/lib/database_cleaner/active_record.rb
|
426
|
+
- adapters/database_cleaner-active_record/lib/database_cleaner/active_record/base.rb
|
427
|
+
- adapters/database_cleaner-active_record/lib/database_cleaner/active_record/deletion.rb
|
428
|
+
- adapters/database_cleaner-active_record/lib/database_cleaner/active_record/transaction.rb
|
429
|
+
- adapters/database_cleaner-active_record/lib/database_cleaner/active_record/truncation.rb
|
430
|
+
- adapters/database_cleaner-active_record/lib/database_cleaner/active_record/version.rb
|
431
|
+
- adapters/database_cleaner-couch_potato/lib/database_cleaner-couch_potato.rb
|
432
|
+
- adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato.rb
|
433
|
+
- adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato/base.rb
|
434
|
+
- adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato/truncation.rb
|
435
|
+
- adapters/database_cleaner-couch_potato/lib/database_cleaner/couch_potato/version.rb
|
436
|
+
- adapters/database_cleaner-data_mapper/lib/database_cleaner-data_mapper.rb
|
437
|
+
- adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper.rb
|
438
|
+
- adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/base.rb
|
439
|
+
- adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/transaction.rb
|
440
|
+
- adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/truncation.rb
|
441
|
+
- adapters/database_cleaner-data_mapper/lib/database_cleaner/data_mapper/version.rb
|
442
|
+
- adapters/database_cleaner-mongo/lib/database_cleaner-mongo.rb
|
443
|
+
- adapters/database_cleaner-mongo/lib/database_cleaner/mongo.rb
|
444
|
+
- adapters/database_cleaner-mongo/lib/database_cleaner/mongo/base.rb
|
445
|
+
- adapters/database_cleaner-mongo/lib/database_cleaner/mongo/truncation.rb
|
446
|
+
- adapters/database_cleaner-mongo/lib/database_cleaner/mongo/truncation_mixin.rb
|
447
|
+
- adapters/database_cleaner-mongo/lib/database_cleaner/mongo/version.rb
|
448
|
+
- adapters/database_cleaner-mongo_mapper/lib/database_cleaner-mongo_mapper.rb
|
449
|
+
- adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper.rb
|
450
|
+
- adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/base.rb
|
451
|
+
- adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/truncation.rb
|
452
|
+
- adapters/database_cleaner-mongo_mapper/lib/database_cleaner/mongo_mapper/version.rb
|
453
|
+
- adapters/database_cleaner-mongoid/lib/database_cleaner-mongoid.rb
|
454
|
+
- adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid.rb
|
455
|
+
- adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/base.rb
|
456
|
+
- adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/mongo1_truncation_mixin.rb
|
457
|
+
- adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/mongo2_truncation_mixin.rb
|
458
|
+
- adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/mongoid_truncation_mixin.rb
|
459
|
+
- adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/truncation.rb
|
460
|
+
- adapters/database_cleaner-mongoid/lib/database_cleaner/mongoid/version.rb
|
461
|
+
- adapters/database_cleaner-moped/lib/database_cleaner-moped.rb
|
462
|
+
- adapters/database_cleaner-moped/lib/database_cleaner/moped.rb
|
463
|
+
- adapters/database_cleaner-moped/lib/database_cleaner/moped/base.rb
|
464
|
+
- adapters/database_cleaner-moped/lib/database_cleaner/moped/truncation.rb
|
465
|
+
- adapters/database_cleaner-moped/lib/database_cleaner/moped/truncation_base.rb
|
466
|
+
- adapters/database_cleaner-moped/lib/database_cleaner/moped/version.rb
|
467
|
+
- adapters/database_cleaner-neo4j/lib/database_cleaner-neo4j.rb
|
468
|
+
- adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j.rb
|
469
|
+
- adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/base.rb
|
470
|
+
- adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/deletion.rb
|
471
|
+
- adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/transaction.rb
|
472
|
+
- adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/truncation.rb
|
473
|
+
- adapters/database_cleaner-neo4j/lib/database_cleaner/neo4j/version.rb
|
474
|
+
- adapters/database_cleaner-ohm/lib/database_cleaner-ohm.rb
|
475
|
+
- adapters/database_cleaner-ohm/lib/database_cleaner/ohm.rb
|
476
|
+
- adapters/database_cleaner-ohm/lib/database_cleaner/ohm/truncation.rb
|
477
|
+
- adapters/database_cleaner-ohm/lib/database_cleaner/ohm/version.rb
|
478
|
+
- adapters/database_cleaner-redis/lib/database_cleaner-redis.rb
|
479
|
+
- adapters/database_cleaner-redis/lib/database_cleaner/redis.rb
|
480
|
+
- adapters/database_cleaner-redis/lib/database_cleaner/redis/base.rb
|
481
|
+
- adapters/database_cleaner-redis/lib/database_cleaner/redis/truncation.rb
|
482
|
+
- adapters/database_cleaner-redis/lib/database_cleaner/redis/version.rb
|
483
|
+
- adapters/database_cleaner-sequel/lib/database_cleaner-sequel.rb
|
484
|
+
- adapters/database_cleaner-sequel/lib/database_cleaner/sequel.rb
|
485
|
+
- adapters/database_cleaner-sequel/lib/database_cleaner/sequel/base.rb
|
486
|
+
- adapters/database_cleaner-sequel/lib/database_cleaner/sequel/deletion.rb
|
487
|
+
- adapters/database_cleaner-sequel/lib/database_cleaner/sequel/transaction.rb
|
488
|
+
- adapters/database_cleaner-sequel/lib/database_cleaner/sequel/truncation.rb
|
489
|
+
- adapters/database_cleaner-sequel/lib/database_cleaner/sequel/version.rb
|
395
490
|
- 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
491
|
- lib/database_cleaner.rb
|
431
|
-
- lib/database_cleaner/active_record/base.rb
|
432
|
-
- lib/database_cleaner/active_record/deletion.rb
|
433
|
-
- lib/database_cleaner/active_record/transaction.rb
|
434
|
-
- lib/database_cleaner/active_record/truncation.rb
|
435
492
|
- lib/database_cleaner/base.rb
|
436
493
|
- lib/database_cleaner/configuration.rb
|
437
|
-
- lib/database_cleaner/couch_potato/base.rb
|
438
|
-
- lib/database_cleaner/couch_potato/truncation.rb
|
439
494
|
- lib/database_cleaner/cucumber.rb
|
440
|
-
- lib/database_cleaner/
|
441
|
-
- lib/database_cleaner/data_mapper/transaction.rb
|
442
|
-
- lib/database_cleaner/data_mapper/truncation.rb
|
495
|
+
- lib/database_cleaner/deprecation.rb
|
443
496
|
- lib/database_cleaner/generic/base.rb
|
444
497
|
- lib/database_cleaner/generic/transaction.rb
|
445
498
|
- lib/database_cleaner/generic/truncation.rb
|
446
|
-
- lib/database_cleaner/mongo/base.rb
|
447
|
-
- lib/database_cleaner/mongo/truncation.rb
|
448
|
-
- lib/database_cleaner/mongo/truncation_mixin.rb
|
449
|
-
- lib/database_cleaner/mongo2/base.rb
|
450
|
-
- lib/database_cleaner/mongo2/truncation_mixin.rb
|
451
|
-
- lib/database_cleaner/mongo_mapper/base.rb
|
452
|
-
- lib/database_cleaner/mongo_mapper/truncation.rb
|
453
|
-
- lib/database_cleaner/mongoid/base.rb
|
454
|
-
- lib/database_cleaner/mongoid/truncation.rb
|
455
|
-
- lib/database_cleaner/moped/base.rb
|
456
|
-
- lib/database_cleaner/moped/truncation.rb
|
457
|
-
- lib/database_cleaner/moped/truncation_base.rb
|
458
|
-
- lib/database_cleaner/neo4j/base.rb
|
459
|
-
- lib/database_cleaner/neo4j/deletion.rb
|
460
|
-
- lib/database_cleaner/neo4j/transaction.rb
|
461
|
-
- lib/database_cleaner/neo4j/truncation.rb
|
462
499
|
- lib/database_cleaner/null_strategy.rb
|
463
|
-
- lib/database_cleaner/
|
464
|
-
- lib/database_cleaner/
|
465
|
-
- lib/database_cleaner/
|
466
|
-
- lib/database_cleaner/
|
467
|
-
- lib/database_cleaner/
|
468
|
-
- lib/database_cleaner/
|
469
|
-
|
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
|
-
homepage: http://github.com/DatabaseCleaner/database_cleaner
|
500
|
+
- lib/database_cleaner/orm_autodetector.rb
|
501
|
+
- lib/database_cleaner/safeguard.rb
|
502
|
+
- lib/database_cleaner/spec.rb
|
503
|
+
- lib/database_cleaner/spec/database_helper.rb
|
504
|
+
- lib/database_cleaner/spec/shared_examples.rb
|
505
|
+
- lib/database_cleaner/version.rb
|
506
|
+
homepage: https://github.com/DatabaseCleaner/database_cleaner
|
519
507
|
licenses:
|
520
508
|
- MIT
|
521
509
|
metadata: {}
|
@@ -534,10 +522,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
534
522
|
- !ruby/object:Gem::Version
|
535
523
|
version: '0'
|
536
524
|
requirements: []
|
537
|
-
|
538
|
-
rubygems_version: 2.6.8
|
525
|
+
rubygems_version: 3.0.8
|
539
526
|
signing_key:
|
540
527
|
specification_version: 4
|
541
|
-
summary: Strategies for cleaning databases.
|
528
|
+
summary: Strategies for cleaning databases. Can be used to ensure a clean slate for
|
542
529
|
testing.
|
543
530
|
test_files: []
|
data/VERSION.yml
DELETED
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
|
-
|
@@ -1,22 +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 orms
|
7
|
-
|
8
|
-
Scenario: dirty the db
|
9
|
-
When I create a widget in one orm
|
10
|
-
And I create a widget in another orm
|
11
|
-
Then I should see 1 widget in one orm
|
12
|
-
And I should see 1 widget in another orm
|
13
|
-
|
14
|
-
Scenario: assume a clean db
|
15
|
-
When I create a widget in one orm
|
16
|
-
Then I should see 1 widget in one orm
|
17
|
-
And I should see 0 widget in another orm
|
18
|
-
|
19
|
-
Scenario: assume a clean db
|
20
|
-
When I create a widget in another orm
|
21
|
-
Then I should see 0 widget in one orm
|
22
|
-
And I should see 1 widget in another orm
|
@@ -1,31 +0,0 @@
|
|
1
|
-
Given /^I have setup database cleaner to clean multiple databases using activerecord$/ do
|
2
|
-
#DatabaseCleaner
|
3
|
-
# require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
|
4
|
-
#
|
5
|
-
# DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
|
6
|
-
# DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I create a widget using activerecord$/ do
|
10
|
-
ActiveRecordWidget.create!
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^I should see ([\d]+) widget using activerecord$/ do |widget_count|
|
14
|
-
ActiveRecordWidget.count.should == widget_count.to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I create a widget in one db using activerecord$/ do
|
18
|
-
ActiveRecordWidgetUsingDatabaseOne.create!
|
19
|
-
end
|
20
|
-
|
21
|
-
When /^I create a widget in another db using activerecord$/ do
|
22
|
-
ActiveRecordWidgetUsingDatabaseTwo.create!
|
23
|
-
end
|
24
|
-
|
25
|
-
Then /^I should see ([\d]+) widget in one db using activerecord$/ do |widget_count|
|
26
|
-
ActiveRecordWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
27
|
-
end
|
28
|
-
|
29
|
-
Then /^I should see ([\d]+) widget in another db using activerecord$/ do |widget_count|
|
30
|
-
ActiveRecordWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
31
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
Given /^I have setup database cleaner to clean multiple databases using couchpotato$/ do
|
2
|
-
#DatabaseCleaner
|
3
|
-
# require "#{File.dirname(__FILE__)}/../../../lib/couchpotato_models"
|
4
|
-
#
|
5
|
-
# DatabaseCleaner[:couchpotato, {:connection => :one} ].strategy = :truncation
|
6
|
-
# DatabaseCleaner[:couchpotato, {:connection => :two} ].strategy = :truncation
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I create a widget using couchpotato$/ do
|
10
|
-
CouchPotatoWidget.create!
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^I should see ([\d]+) widget using couchpotato$/ do |widget_count|
|
14
|
-
CouchPotatoWidget.count.should == widget_count.to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I create a widget in one db using couchpotato$/ do
|
18
|
-
CouchPotatoWidgetUsingDatabaseOne.create!
|
19
|
-
end
|
20
|
-
|
21
|
-
When /^I create a widget in another db using couchpotato$/ do
|
22
|
-
CouchPotatoWidgetUsingDatabaseTwo.create!
|
23
|
-
end
|
24
|
-
|
25
|
-
Then /^I should see ([\d]+) widget in one db using couchpotato$/ do |widget_count|
|
26
|
-
CouchPotatoWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
27
|
-
end
|
28
|
-
|
29
|
-
Then /^I should see ([\d]+) widget in another db using couchpotato$/ do |widget_count|
|
30
|
-
CouchPotatoWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
31
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
Given /^I have setup database cleaner to clean multiple databases using datamapper$/ do
|
2
|
-
#DatabaseCleaner
|
3
|
-
# require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
|
4
|
-
#
|
5
|
-
# DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
|
6
|
-
# DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I create a widget using datamapper$/ do
|
10
|
-
DataMapperWidget.create!
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^I should see ([\d]+) widget using datamapper$/ do |widget_count|
|
14
|
-
DataMapperWidget.count.should == widget_count.to_i
|
15
|
-
end
|
16
|
-
|
17
|
-
When /^I create a widget in one db using datamapper$/ do
|
18
|
-
begin
|
19
|
-
DataMapperWidgetUsingDatabaseOne.create!
|
20
|
-
rescue StandardError => e
|
21
|
-
BREAK = e.backtrace
|
22
|
-
debugger
|
23
|
-
DataMapperWidgetUsingDatabaseOne.create!
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
When /^I create a widget in another db using datamapper$/ do
|
28
|
-
DataMapperWidgetUsingDatabaseTwo.create!
|
29
|
-
end
|
30
|
-
|
31
|
-
Then /^I should see ([\d]+) widget in one db using datamapper$/ do |widget_count|
|
32
|
-
DataMapperWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
33
|
-
end
|
34
|
-
|
35
|
-
Then /^I should see ([\d]+) widget in another db using datamapper$/ do |widget_count|
|
36
|
-
DataMapperWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
37
|
-
end
|