database_cleaner 0.5.0 → 0.6.0.rc.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.
- data/Gemfile.lock +145 -0
- data/History.txt +43 -1
- data/README.textile +49 -1
- data/Rakefile +4 -0
- data/TODO +3 -0
- data/VERSION.yml +3 -2
- data/examples/Gemfile +46 -0
- data/examples/Gemfile.lock +145 -0
- data/examples/config/database.yml +7 -0
- data/examples/config/database.yml.example +8 -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/examples/db/sqlite_databases_go_here +0 -0
- data/examples/features/example_multiple_db.feature +23 -0
- data/examples/features/example_multiple_orm.feature +22 -0
- data/examples/features/step_definitions/activerecord_steps.rb +31 -0
- data/examples/features/step_definitions/couchpotato_steps.rb +31 -0
- data/examples/features/step_definitions/datamapper_steps.rb +37 -0
- data/examples/features/step_definitions/mongoid_steps.rb +23 -0
- data/examples/features/step_definitions/mongomapper_steps.rb +31 -0
- data/examples/features/step_definitions/translation_steps.rb +55 -0
- data/examples/features/support/env.rb +49 -10
- data/examples/lib/activerecord_models.rb +34 -5
- data/examples/lib/couchpotato_models.rb +46 -6
- data/examples/lib/datamapper_models.rb +37 -3
- data/examples/lib/mongoid_models.rb +49 -0
- data/examples/lib/mongomapper_models.rb +36 -2
- data/features/cleaning.feature +1 -0
- data/features/cleaning_multiple_dbs.feature +20 -0
- data/features/cleaning_multiple_orms.feature +29 -0
- data/features/step_definitions/database_cleaner_steps.rb +21 -14
- data/features/support/feature_runner.rb +39 -0
- data/lib/database_cleaner/active_record/base.rb +46 -0
- data/lib/database_cleaner/active_record/transaction.rb +10 -10
- data/lib/database_cleaner/active_record/truncation.rb +42 -11
- data/lib/database_cleaner/base.rb +129 -0
- data/lib/database_cleaner/configuration.rb +45 -82
- data/lib/database_cleaner/couch_potato/base.rb +7 -0
- data/lib/database_cleaner/couch_potato/truncation.rb +4 -2
- data/lib/database_cleaner/cucumber.rb +0 -1
- data/lib/database_cleaner/data_mapper/base.rb +21 -0
- data/lib/database_cleaner/data_mapper/transaction.rb +10 -5
- data/lib/database_cleaner/data_mapper/truncation.rb +52 -19
- data/lib/database_cleaner/generic/base.rb +23 -0
- data/lib/database_cleaner/generic/truncation.rb +43 -0
- data/lib/database_cleaner/mongo_mapper/base.rb +20 -0
- data/lib/database_cleaner/mongo_mapper/truncation.rb +9 -3
- data/lib/database_cleaner/mongoid/base.rb +20 -0
- data/lib/database_cleaner/mongoid/truncation.rb +27 -0
- data/spec/database_cleaner/active_record/base_spec.rb +130 -0
- data/spec/database_cleaner/active_record/transaction_spec.rb +65 -0
- data/spec/database_cleaner/active_record/truncation_spec.rb +19 -18
- data/spec/database_cleaner/base_spec.rb +441 -0
- data/spec/database_cleaner/configuration_spec.rb +255 -65
- data/spec/database_cleaner/couch_potato/truncation_spec.rb +4 -3
- data/spec/database_cleaner/data_mapper/base_spec.rb +30 -0
- data/spec/database_cleaner/data_mapper/transaction_spec.rb +23 -0
- data/spec/database_cleaner/data_mapper/truncation_spec.rb +11 -0
- data/spec/database_cleaner/generic/base_spec.rb +22 -0
- data/spec/database_cleaner/generic/truncation_spec.rb +68 -0
- data/spec/database_cleaner/mongo_mapper/base_spec.rb +33 -0
- data/spec/database_cleaner/mongo_mapper/mongo_examples.rb +8 -0
- data/spec/database_cleaner/mongo_mapper/truncation_spec.rb +12 -19
- data/spec/database_cleaner/mongoid/truncation_spec.rb +84 -0
- data/spec/database_cleaner/shared_strategy_spec.rb +13 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -3
- metadata +83 -8
- data/examples/features/step_definitions/example_steps.rb +0 -8
- data/lib/database_cleaner/truncation_base.rb +0 -41
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: http://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
ZenTest (4.3.3)
|
|
5
|
+
activerecord (2.3.8)
|
|
6
|
+
activesupport (= 2.3.8)
|
|
7
|
+
activesupport (2.3.8)
|
|
8
|
+
addressable (2.2.0)
|
|
9
|
+
bson (1.0.4)
|
|
10
|
+
builder (2.1.2)
|
|
11
|
+
columnize (0.3.1)
|
|
12
|
+
couch_potato (0.3.0)
|
|
13
|
+
couchrest (>= 0.24)
|
|
14
|
+
json
|
|
15
|
+
couchrest (1.0.1)
|
|
16
|
+
json (>= 1.4.6)
|
|
17
|
+
mime-types (>= 1.15)
|
|
18
|
+
rest-client (>= 1.5.1)
|
|
19
|
+
cucumber (0.8.5)
|
|
20
|
+
builder (~> 2.1.2)
|
|
21
|
+
diff-lcs (~> 1.1.2)
|
|
22
|
+
gherkin (~> 2.1.4)
|
|
23
|
+
json_pure (~> 1.4.3)
|
|
24
|
+
term-ansicolor (~> 1.0.4)
|
|
25
|
+
data_objects (0.10.2)
|
|
26
|
+
addressable (~> 2.1)
|
|
27
|
+
datamapper (1.0.0)
|
|
28
|
+
dm-aggregates (= 1.0.0)
|
|
29
|
+
dm-constraints (= 1.0.0)
|
|
30
|
+
dm-core (= 1.0.0)
|
|
31
|
+
dm-core (= 1.0.0)
|
|
32
|
+
dm-migrations (= 1.0.0)
|
|
33
|
+
dm-serializer (= 1.0.0)
|
|
34
|
+
dm-timestamps (= 1.0.0)
|
|
35
|
+
dm-transactions (= 1.0.0)
|
|
36
|
+
dm-types (= 1.0.0)
|
|
37
|
+
dm-validations (= 1.0.0)
|
|
38
|
+
diff-lcs (1.1.2)
|
|
39
|
+
dm-aggregates (1.0.0)
|
|
40
|
+
dm-core (~> 1.0.0)
|
|
41
|
+
dm-constraints (1.0.0)
|
|
42
|
+
dm-core (~> 1.0.0)
|
|
43
|
+
dm-migrations (~> 1.0.0)
|
|
44
|
+
dm-core (1.0.0)
|
|
45
|
+
addressable (~> 2.1)
|
|
46
|
+
extlib (~> 0.9.15)
|
|
47
|
+
dm-do-adapter (1.0.0)
|
|
48
|
+
data_objects (~> 0.10.1)
|
|
49
|
+
dm-core (~> 1.0.0)
|
|
50
|
+
dm-migrations (1.0.0)
|
|
51
|
+
dm-core (~> 1.0.0)
|
|
52
|
+
dm-serializer (1.0.0)
|
|
53
|
+
dm-core (~> 1.0.0)
|
|
54
|
+
fastercsv (~> 1.5.3)
|
|
55
|
+
json_pure (~> 1.4.3)
|
|
56
|
+
dm-sqlite-adapter (1.0.0)
|
|
57
|
+
dm-do-adapter (~> 1.0.0)
|
|
58
|
+
do_sqlite3 (~> 0.10.2)
|
|
59
|
+
dm-timestamps (1.0.0)
|
|
60
|
+
dm-core (~> 1.0.0)
|
|
61
|
+
dm-transactions (1.0.0)
|
|
62
|
+
dm-core (~> 1.0.0)
|
|
63
|
+
dm-types (1.0.0)
|
|
64
|
+
dm-core (~> 1.0.0)
|
|
65
|
+
fastercsv (~> 1.5.3)
|
|
66
|
+
json_pure (~> 1.4.3)
|
|
67
|
+
stringex (~> 1.1.0)
|
|
68
|
+
uuidtools (~> 2.1.1)
|
|
69
|
+
dm-validations (1.0.0)
|
|
70
|
+
dm-core (~> 1.0.0)
|
|
71
|
+
do_sqlite3 (0.10.2)
|
|
72
|
+
data_objects (= 0.10.2)
|
|
73
|
+
durran-validatable (2.0.1)
|
|
74
|
+
extlib (0.9.15)
|
|
75
|
+
fastercsv (1.5.3)
|
|
76
|
+
gemcutter (0.6.1)
|
|
77
|
+
gherkin (2.1.5)
|
|
78
|
+
trollop (~> 1.16.2)
|
|
79
|
+
git (1.2.5)
|
|
80
|
+
jeweler (1.4.0)
|
|
81
|
+
gemcutter (>= 0.1.0)
|
|
82
|
+
git (>= 1.2.5)
|
|
83
|
+
rubyforge (>= 2.0.0)
|
|
84
|
+
jnunemaker-validatable (1.8.4)
|
|
85
|
+
activesupport (>= 2.3.4)
|
|
86
|
+
json (1.4.6)
|
|
87
|
+
json_pure (1.4.6)
|
|
88
|
+
linecache (0.43)
|
|
89
|
+
mime-types (1.16)
|
|
90
|
+
mongo (1.0.7)
|
|
91
|
+
bson (>= 1.0.4)
|
|
92
|
+
mongo_mapper (0.8.2)
|
|
93
|
+
activesupport (>= 2.3.4)
|
|
94
|
+
jnunemaker-validatable (~> 1.8.4)
|
|
95
|
+
plucky (~> 0.3.1)
|
|
96
|
+
mongoid (1.9.1)
|
|
97
|
+
activesupport (<= 3.0.0)
|
|
98
|
+
bson (~> 1.0.1)
|
|
99
|
+
durran-validatable (>= 2.0.1)
|
|
100
|
+
mongo (~> 1.0.1)
|
|
101
|
+
will_paginate (< 2.9)
|
|
102
|
+
plucky (0.3.4)
|
|
103
|
+
mongo (~> 1.0.7)
|
|
104
|
+
rake (0.8.7)
|
|
105
|
+
rcov (0.9.8)
|
|
106
|
+
rest-client (1.6.0)
|
|
107
|
+
mime-types (>= 1.16)
|
|
108
|
+
rspec (1.3.0)
|
|
109
|
+
ruby-debug (0.10.3)
|
|
110
|
+
columnize (>= 0.1)
|
|
111
|
+
ruby-debug-base (~> 0.10.3.0)
|
|
112
|
+
ruby-debug-base (0.10.3)
|
|
113
|
+
linecache (>= 0.3)
|
|
114
|
+
rubyforge (2.0.4)
|
|
115
|
+
json_pure (>= 1.1.7)
|
|
116
|
+
sqlite3-ruby (1.3.1)
|
|
117
|
+
stringex (1.1.0)
|
|
118
|
+
term-ansicolor (1.0.5)
|
|
119
|
+
trollop (1.16.2)
|
|
120
|
+
tzinfo (0.3.22)
|
|
121
|
+
uuidtools (2.1.1)
|
|
122
|
+
will_paginate (2.3.14)
|
|
123
|
+
|
|
124
|
+
PLATFORMS
|
|
125
|
+
ruby
|
|
126
|
+
|
|
127
|
+
DEPENDENCIES
|
|
128
|
+
ZenTest
|
|
129
|
+
activerecord (= 2.3.8)
|
|
130
|
+
bundler
|
|
131
|
+
couch_potato (= 0.3.0)
|
|
132
|
+
cucumber
|
|
133
|
+
datamapper (= 1.0.0)
|
|
134
|
+
dm-migrations (= 1.0.0)
|
|
135
|
+
dm-sqlite-adapter (= 1.0.0)
|
|
136
|
+
jeweler
|
|
137
|
+
json_pure
|
|
138
|
+
mongo_mapper (= 0.8.2)
|
|
139
|
+
mongoid (= 1.9.1)
|
|
140
|
+
rake
|
|
141
|
+
rcov
|
|
142
|
+
rspec
|
|
143
|
+
ruby-debug
|
|
144
|
+
sqlite3-ruby
|
|
145
|
+
tzinfo (= 0.3.22)
|
data/History.txt
CHANGED
|
@@ -1,4 +1,46 @@
|
|
|
1
|
-
0.
|
|
1
|
+
== 0.6.x (In Git)
|
|
2
|
+
|
|
3
|
+
== 0.6.0 2010-08-2x - The Multi-ORM/Connection Release
|
|
4
|
+
|
|
5
|
+
This release has the often asked for functionality of being able to clean
|
|
6
|
+
multiple databases within the same project. This involves being able to
|
|
7
|
+
clean databases managed by the same ORM (i.e. different connections) and
|
|
8
|
+
also being able to clean databases managed by distinct ORMs. So, for
|
|
9
|
+
example you can now use DatabaseCleaner on a project that has ActiveRecord
|
|
10
|
+
and Mongoid to help ensure all DBs all in a clean state. Please see the
|
|
11
|
+
README for more information. The old API has been preserved so this release
|
|
12
|
+
is backwards compatible.
|
|
13
|
+
|
|
14
|
+
This release is a result of Jon Rowe's hard work. Many thanks to Jon for all
|
|
15
|
+
of the hours and effort he put into making this feature request a reality.
|
|
16
|
+
|
|
17
|
+
=== New Features
|
|
18
|
+
* Ability to clean multiple database connections managed by the same ORM. (Jon Rowe)
|
|
19
|
+
* Ability to clean multiple DBs managed by different ORMs in same project. (Jon Rowe)
|
|
20
|
+
* Allows for the ActiveRecord config file (database.yml) to contain ERB and process it. (Fletcher Nichol)
|
|
21
|
+
* Mysql2Adapter support. (Kamal Fariz Mahyuddin and John Ferlito)
|
|
22
|
+
|
|
23
|
+
=== Bugfixes
|
|
24
|
+
* Updates the DataMapper truncation strategy to version 0.10.3. (Robert Rouse)
|
|
25
|
+
|
|
26
|
+
== 0.5.2
|
|
27
|
+
|
|
28
|
+
=== Bugfixes
|
|
29
|
+
* Removes extraneous puts call from configuration.rb. (Ben Mabey)
|
|
30
|
+
|
|
31
|
+
== 0.5.1 - The Mongoid Release
|
|
32
|
+
|
|
33
|
+
This release also attempts to fix AR for Rails 3 support. I have seen mixed reviews on this. Some people
|
|
34
|
+
claim the fixes allow for use in Rails3 while others have not had good luck with it. I plan on reworking
|
|
35
|
+
the way AR support is added so that it is more friendly with how Rails 3 uses autoload.
|
|
36
|
+
|
|
37
|
+
=== New features
|
|
38
|
+
* Clean and clean_with methods are now aliased to clean! and clean_with!. (Ben Mabey)
|
|
39
|
+
* Mongoid Support! (Sidney Burks)
|
|
40
|
+
|
|
41
|
+
=== Bugfixes
|
|
42
|
+
* Check PostgreSQL version >= 8.2 before using TRUNCATE CASCADE (James B. Byrne)
|
|
43
|
+
* Correct superclass is used in ActiveRecord connection adapters. (johnathan, Aslak Hellesoy, Ben Mabey)
|
|
2
44
|
|
|
3
45
|
== 0.5.0 2010-02-22 - The CouchPotato Release
|
|
4
46
|
|
data/README.textile
CHANGED
|
@@ -5,7 +5,7 @@ The original use case was to ensure a clean state during tests. Each strategy
|
|
|
5
5
|
is a small amount of code but is code that is usually needed in any ruby app
|
|
6
6
|
that is testing with a database.
|
|
7
7
|
|
|
8
|
-
ActiveRecord, DataMapper, MongoMapper and CouchPotato are supported.
|
|
8
|
+
ActiveRecord, DataMapper, MongoMapper, Mongoid, and CouchPotato are supported.
|
|
9
9
|
|
|
10
10
|
h2. How to use
|
|
11
11
|
|
|
@@ -76,7 +76,55 @@ end
|
|
|
76
76
|
|
|
77
77
|
For use in Cucumber please see the section below.
|
|
78
78
|
|
|
79
|
+
h2. How to use with multiple ORM's
|
|
79
80
|
|
|
81
|
+
Sometimes you need to use multiple ORMs in your application. You can use DatabaseCleaner to clean multiple ORMs, and multiple connections for those ORMs.
|
|
82
|
+
|
|
83
|
+
<pre>
|
|
84
|
+
#How to specify particular orms
|
|
85
|
+
DatabaseCleaner[:active_record].strategy = :transaction
|
|
86
|
+
DatabaseCleaner[:mongo_mapper].strategy = :truncation
|
|
87
|
+
|
|
88
|
+
#How to specify particular connections
|
|
89
|
+
DatabaseCleaner[:active_record,{:connection => :two}]
|
|
90
|
+
</pre>
|
|
91
|
+
|
|
92
|
+
Usage beyond that remains the same with DatabaseCleaner.start calling any setup on the different configured connections, and DatabaseCleaner.clean executing afterwards.
|
|
93
|
+
|
|
94
|
+
Configuration options
|
|
95
|
+
|
|
96
|
+
<table>
|
|
97
|
+
<tr>
|
|
98
|
+
<th>ORM</th>
|
|
99
|
+
<th>How to access</th>
|
|
100
|
+
<th>Notes</th>
|
|
101
|
+
</tr>
|
|
102
|
+
<tr>
|
|
103
|
+
<td>Active Record</td>
|
|
104
|
+
<td>DatabaseCleaner[:active_record]</td>
|
|
105
|
+
<td>Connection specified as :symbol keys, loaded from config/database.yml</td>
|
|
106
|
+
</th>
|
|
107
|
+
<tr>
|
|
108
|
+
<td>Data Mapper</td>
|
|
109
|
+
<td>DatabaseCleaner[:data_mapper]</td>
|
|
110
|
+
<td>Connection specified as :symbol keys, loaded via Datamapper repositories</td>
|
|
111
|
+
</th>
|
|
112
|
+
<tr>
|
|
113
|
+
<td>Mongo Mapper</td>
|
|
114
|
+
<td>DatabaseCleaner[:mongo_mapper]</td>
|
|
115
|
+
<td>Multiple connections not yet supported</td>
|
|
116
|
+
</th>
|
|
117
|
+
<tr>
|
|
118
|
+
<td>Mongoid</td>
|
|
119
|
+
<td>DatabaseCleaner[:mongoid]</td>
|
|
120
|
+
<td>Multiple connections not yet supported</td>
|
|
121
|
+
</th>
|
|
122
|
+
<tr>
|
|
123
|
+
<td>Couch Potato</td>
|
|
124
|
+
<td>DatabaseCleaner[:couch_potato]</td>
|
|
125
|
+
<td>Multiple connections not yet supported</td>
|
|
126
|
+
</tr>
|
|
127
|
+
</table>
|
|
80
128
|
|
|
81
129
|
h2. Why?
|
|
82
130
|
|
data/Rakefile
CHANGED
data/TODO
CHANGED
data/VERSION.yml
CHANGED
data/examples/Gemfile
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
source "http://rubygems.org"
|
|
2
|
+
# group :development do
|
|
3
|
+
# # gem "mysql"
|
|
4
|
+
# # gem "json_pure", "1.4.3"
|
|
5
|
+
#
|
|
6
|
+
#
|
|
7
|
+
# # gem "datamapper", "1.0.0"
|
|
8
|
+
# # gem "dm-migrations", "1.0.0"
|
|
9
|
+
# # gem "dm-sqlite-adapter", "1.0.0"
|
|
10
|
+
#
|
|
11
|
+
# # mongo requirements
|
|
12
|
+
# # gem "mongo", "1.0.1"
|
|
13
|
+
# # gem "mongo_ext", "0.19.3"
|
|
14
|
+
# # gem "bson_ext", "1.0.1"
|
|
15
|
+
# end
|
|
16
|
+
|
|
17
|
+
group :development do
|
|
18
|
+
gem "rake"
|
|
19
|
+
gem "ruby-debug"
|
|
20
|
+
|
|
21
|
+
gem "bundler"
|
|
22
|
+
gem "jeweler"
|
|
23
|
+
|
|
24
|
+
gem "json_pure"
|
|
25
|
+
|
|
26
|
+
#ORM's
|
|
27
|
+
gem "activerecord", "2.3.8"
|
|
28
|
+
gem "datamapper", "1.0.0"
|
|
29
|
+
gem "dm-migrations", "1.0.0"
|
|
30
|
+
gem "dm-sqlite-adapter", "1.0.0"
|
|
31
|
+
gem "mongoid", "1.9.1"
|
|
32
|
+
gem "tzinfo", "0.3.22"
|
|
33
|
+
gem "mongo_mapper", "0.8.2"
|
|
34
|
+
gem "couch_potato", "0.3.0"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
group :test do
|
|
38
|
+
gem "rspec"
|
|
39
|
+
gem "rcov"
|
|
40
|
+
gem "ZenTest"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
group :cucumber do
|
|
44
|
+
gem "cucumber"
|
|
45
|
+
gem 'sqlite3-ruby'
|
|
46
|
+
end
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: http://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
ZenTest (4.3.3)
|
|
5
|
+
activerecord (2.3.8)
|
|
6
|
+
activesupport (= 2.3.8)
|
|
7
|
+
activesupport (2.3.8)
|
|
8
|
+
addressable (2.2.0)
|
|
9
|
+
bson (1.0.4)
|
|
10
|
+
builder (2.1.2)
|
|
11
|
+
columnize (0.3.1)
|
|
12
|
+
couch_potato (0.3.0)
|
|
13
|
+
couchrest (>= 0.24)
|
|
14
|
+
json
|
|
15
|
+
couchrest (1.0.1)
|
|
16
|
+
json (>= 1.4.6)
|
|
17
|
+
mime-types (>= 1.15)
|
|
18
|
+
rest-client (>= 1.5.1)
|
|
19
|
+
cucumber (0.8.5)
|
|
20
|
+
builder (~> 2.1.2)
|
|
21
|
+
diff-lcs (~> 1.1.2)
|
|
22
|
+
gherkin (~> 2.1.4)
|
|
23
|
+
json_pure (~> 1.4.3)
|
|
24
|
+
term-ansicolor (~> 1.0.4)
|
|
25
|
+
data_objects (0.10.2)
|
|
26
|
+
addressable (~> 2.1)
|
|
27
|
+
datamapper (1.0.0)
|
|
28
|
+
dm-aggregates (= 1.0.0)
|
|
29
|
+
dm-constraints (= 1.0.0)
|
|
30
|
+
dm-core (= 1.0.0)
|
|
31
|
+
dm-core (= 1.0.0)
|
|
32
|
+
dm-migrations (= 1.0.0)
|
|
33
|
+
dm-serializer (= 1.0.0)
|
|
34
|
+
dm-timestamps (= 1.0.0)
|
|
35
|
+
dm-transactions (= 1.0.0)
|
|
36
|
+
dm-types (= 1.0.0)
|
|
37
|
+
dm-validations (= 1.0.0)
|
|
38
|
+
diff-lcs (1.1.2)
|
|
39
|
+
dm-aggregates (1.0.0)
|
|
40
|
+
dm-core (~> 1.0.0)
|
|
41
|
+
dm-constraints (1.0.0)
|
|
42
|
+
dm-core (~> 1.0.0)
|
|
43
|
+
dm-migrations (~> 1.0.0)
|
|
44
|
+
dm-core (1.0.0)
|
|
45
|
+
addressable (~> 2.1)
|
|
46
|
+
extlib (~> 0.9.15)
|
|
47
|
+
dm-do-adapter (1.0.0)
|
|
48
|
+
data_objects (~> 0.10.1)
|
|
49
|
+
dm-core (~> 1.0.0)
|
|
50
|
+
dm-migrations (1.0.0)
|
|
51
|
+
dm-core (~> 1.0.0)
|
|
52
|
+
dm-serializer (1.0.0)
|
|
53
|
+
dm-core (~> 1.0.0)
|
|
54
|
+
fastercsv (~> 1.5.3)
|
|
55
|
+
json_pure (~> 1.4.3)
|
|
56
|
+
dm-sqlite-adapter (1.0.0)
|
|
57
|
+
dm-do-adapter (~> 1.0.0)
|
|
58
|
+
do_sqlite3 (~> 0.10.2)
|
|
59
|
+
dm-timestamps (1.0.0)
|
|
60
|
+
dm-core (~> 1.0.0)
|
|
61
|
+
dm-transactions (1.0.0)
|
|
62
|
+
dm-core (~> 1.0.0)
|
|
63
|
+
dm-types (1.0.0)
|
|
64
|
+
dm-core (~> 1.0.0)
|
|
65
|
+
fastercsv (~> 1.5.3)
|
|
66
|
+
json_pure (~> 1.4.3)
|
|
67
|
+
stringex (~> 1.1.0)
|
|
68
|
+
uuidtools (~> 2.1.1)
|
|
69
|
+
dm-validations (1.0.0)
|
|
70
|
+
dm-core (~> 1.0.0)
|
|
71
|
+
do_sqlite3 (0.10.2)
|
|
72
|
+
data_objects (= 0.10.2)
|
|
73
|
+
durran-validatable (2.0.1)
|
|
74
|
+
extlib (0.9.15)
|
|
75
|
+
fastercsv (1.5.3)
|
|
76
|
+
gemcutter (0.6.1)
|
|
77
|
+
gherkin (2.1.5)
|
|
78
|
+
trollop (~> 1.16.2)
|
|
79
|
+
git (1.2.5)
|
|
80
|
+
jeweler (1.4.0)
|
|
81
|
+
gemcutter (>= 0.1.0)
|
|
82
|
+
git (>= 1.2.5)
|
|
83
|
+
rubyforge (>= 2.0.0)
|
|
84
|
+
jnunemaker-validatable (1.8.4)
|
|
85
|
+
activesupport (>= 2.3.4)
|
|
86
|
+
json (1.4.6)
|
|
87
|
+
json_pure (1.4.6)
|
|
88
|
+
linecache (0.43)
|
|
89
|
+
mime-types (1.16)
|
|
90
|
+
mongo (1.0.7)
|
|
91
|
+
bson (>= 1.0.4)
|
|
92
|
+
mongo_mapper (0.8.2)
|
|
93
|
+
activesupport (>= 2.3.4)
|
|
94
|
+
jnunemaker-validatable (~> 1.8.4)
|
|
95
|
+
plucky (~> 0.3.1)
|
|
96
|
+
mongoid (1.9.1)
|
|
97
|
+
activesupport (<= 3.0.0)
|
|
98
|
+
bson (~> 1.0.1)
|
|
99
|
+
durran-validatable (>= 2.0.1)
|
|
100
|
+
mongo (~> 1.0.1)
|
|
101
|
+
will_paginate (< 2.9)
|
|
102
|
+
plucky (0.3.4)
|
|
103
|
+
mongo (~> 1.0.7)
|
|
104
|
+
rake (0.8.7)
|
|
105
|
+
rcov (0.9.8)
|
|
106
|
+
rest-client (1.6.0)
|
|
107
|
+
mime-types (>= 1.16)
|
|
108
|
+
rspec (1.3.0)
|
|
109
|
+
ruby-debug (0.10.3)
|
|
110
|
+
columnize (>= 0.1)
|
|
111
|
+
ruby-debug-base (~> 0.10.3.0)
|
|
112
|
+
ruby-debug-base (0.10.3)
|
|
113
|
+
linecache (>= 0.3)
|
|
114
|
+
rubyforge (2.0.4)
|
|
115
|
+
json_pure (>= 1.1.7)
|
|
116
|
+
sqlite3-ruby (1.3.1)
|
|
117
|
+
stringex (1.1.0)
|
|
118
|
+
term-ansicolor (1.0.5)
|
|
119
|
+
trollop (1.16.2)
|
|
120
|
+
tzinfo (0.3.22)
|
|
121
|
+
uuidtools (2.1.1)
|
|
122
|
+
will_paginate (2.3.14)
|
|
123
|
+
|
|
124
|
+
PLATFORMS
|
|
125
|
+
ruby
|
|
126
|
+
|
|
127
|
+
DEPENDENCIES
|
|
128
|
+
ZenTest
|
|
129
|
+
activerecord (= 2.3.8)
|
|
130
|
+
bundler
|
|
131
|
+
couch_potato (= 0.3.0)
|
|
132
|
+
cucumber
|
|
133
|
+
datamapper (= 1.0.0)
|
|
134
|
+
dm-migrations (= 1.0.0)
|
|
135
|
+
dm-sqlite-adapter (= 1.0.0)
|
|
136
|
+
jeweler
|
|
137
|
+
json_pure
|
|
138
|
+
mongo_mapper (= 0.8.2)
|
|
139
|
+
mongoid (= 1.9.1)
|
|
140
|
+
rake
|
|
141
|
+
rcov
|
|
142
|
+
rspec
|
|
143
|
+
ruby-debug
|
|
144
|
+
sqlite3-ruby
|
|
145
|
+
tzinfo (= 0.3.22)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
two:
|
|
3
|
+
adapter: sqlite3
|
|
4
|
+
database: /Users/bmabey/Programming/ruby/database_cleaner/examples/features/support/../../db/activerecord_two.db
|
|
5
|
+
one:
|
|
6
|
+
adapter: sqlite3
|
|
7
|
+
database: /Users/bmabey/Programming/ruby/database_cleaner/examples/features/support/../../db/activerecord_one.db
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
When /^I create a widget using mongoid$/ do
|
|
2
|
+
MongoidWidget.create!( :id => rand(1000)+1000)
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Then /^I should see ([\d]+) widget using mongoid$/ do |widget_count|
|
|
6
|
+
MongoidWidget.count.should == widget_count.to_i
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When /^I create a widget in one db using mongoid$/ do
|
|
10
|
+
MongoidWidgetUsingDatabaseOne.create!
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When /^I create a widget in another db using mongoid$/ do
|
|
14
|
+
MongoidWidgetUsingDatabaseTwo.create!
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Then /^I should see ([\d]+) widget in one db using mongoid$/ do |widget_count|
|
|
18
|
+
MongoidWidgetUsingDatabaseOne.count.should == widget_count.to_i
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Then /^I should see ([\d]+) widget in another db using mongoid$/ do |widget_count|
|
|
22
|
+
MongoidWidgetUsingDatabaseTwo.count.should == widget_count.to_i
|
|
23
|
+
end
|