database_cleaner 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CONTRIBUTE.markdown +28 -0
- data/Gemfile.lock +182 -116
- data/History.rdoc +18 -1
- data/README.markdown +41 -4
- data/Rakefile +1 -17
- data/VERSION.yml +2 -3
- data/examples/Gemfile +17 -15
- data/examples/Gemfile.lock +182 -116
- data/examples/features/step_definitions/neo4j_steps.rb +23 -0
- data/examples/features/support/env.rb +0 -3
- data/examples/lib/mongoid_models.rb +1 -6
- data/examples/lib/neo4j_models.rb +17 -0
- data/examples/lib/sequel_models.rb +9 -0
- data/features/cleaning.feature +6 -0
- data/features/cleaning_default_strategy.feature +2 -0
- data/features/cleaning_multiple_dbs.feature +2 -0
- data/features/cleaning_multiple_orms.feature +19 -0
- data/features/step_definitions/database_cleaner_steps.rb +1 -1
- data/lib/database_cleaner/active_record/deletion.rb +30 -0
- data/lib/database_cleaner/active_record/truncation.rb +29 -1
- data/lib/database_cleaner/base.rb +4 -0
- data/lib/database_cleaner/configuration.rb +2 -0
- data/lib/database_cleaner/data_mapper/truncation.rb +5 -42
- data/lib/database_cleaner/mongo/base.rb +2 -0
- data/lib/database_cleaner/mongo/truncation.rb +40 -0
- data/lib/database_cleaner/mongoid/truncation.rb +8 -1
- data/lib/database_cleaner/moped/truncation_base.rb +1 -1
- data/lib/database_cleaner/neo4j/base.rb +58 -0
- data/lib/database_cleaner/neo4j/deletion.rb +16 -0
- data/lib/database_cleaner/neo4j/transaction.rb +35 -0
- data/lib/database_cleaner/neo4j/truncation.rb +9 -0
- data/lib/database_cleaner/sequel/base.rb +2 -2
- data/lib/database_cleaner/sequel/deletion.rb +47 -0
- data/lib/database_cleaner/sequel/transaction.rb +5 -5
- data/lib/database_cleaner/sequel/truncation.rb +41 -13
- data/spec/database_cleaner/active_record/truncation/mysql2_spec.rb +1 -3
- data/spec/database_cleaner/active_record/truncation/mysql_spec.rb +2 -4
- data/spec/database_cleaner/active_record/truncation/postgresql_spec.rb +13 -4
- data/spec/database_cleaner/active_record/truncation/sqlite3_spec.rb +0 -2
- data/spec/database_cleaner/base_spec.rb +48 -12
- data/spec/database_cleaner/configuration_spec.rb +5 -0
- data/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb +41 -0
- data/spec/database_cleaner/moped/moped_examples.rb +6 -0
- data/spec/database_cleaner/moped/truncation_spec.rb +7 -2
- data/spec/database_cleaner/neo4j/base_spec.rb +36 -0
- data/spec/database_cleaner/neo4j/transaction_spec.rb +25 -0
- data/spec/database_cleaner/sequel/deletion_spec.rb +58 -0
- data/spec/database_cleaner/sequel/truncation_spec.rb +38 -0
- data/spec/support/active_record/mysql2_setup.rb +1 -2
- data/spec/support/active_record/mysql_setup.rb +1 -1
- data/spec/support/active_record/postgresql_setup.rb +1 -1
- data/spec/support/active_record/schema_setup.rb +8 -1
- data/spec/support/active_record/sqlite3_setup.rb +1 -1
- data/spec/support/data_mapper/schema_setup.rb +15 -0
- data/spec/support/data_mapper/sqlite3_setup.rb +39 -0
- metadata +136 -111
data/Rakefile
CHANGED
@@ -3,26 +3,10 @@ require "bundler"
|
|
3
3
|
Bundler.setup
|
4
4
|
|
5
5
|
require 'rake'
|
6
|
-
|
7
|
-
begin
|
8
|
-
require 'jeweler'
|
9
|
-
Jeweler::Tasks.new do |s|
|
10
|
-
s.name = "database_cleaner"
|
11
|
-
s.summary = %Q{Strategies for cleaning databases. Can be used to ensure a clean state for testing.}
|
12
|
-
s.email = "ben@benmabey.com"
|
13
|
-
s.homepage = "http://github.com/bmabey/database_cleaner"
|
14
|
-
s.description = "Strategies for cleaning databases. Can be used to ensure a clean state for testing."
|
15
|
-
s.files = FileList["[A-Z]*.*", "{examples,lib,features,spec}/**/*", "Rakefile", "cucumber.yml"]
|
16
|
-
s.authors = ["Ben Mabey"]
|
17
|
-
# s.licence = 'MIT'
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
21
|
-
end
|
22
|
-
|
23
6
|
require 'rspec/core'
|
24
7
|
require 'rspec/core/rake_task'
|
25
8
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
9
|
+
|
26
10
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
27
11
|
end
|
28
12
|
|
data/VERSION.yml
CHANGED
data/examples/Gemfile
CHANGED
@@ -1,32 +1,36 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
# TODO: move these to the gemspec...
|
3
3
|
|
4
|
-
group :development do
|
4
|
+
group :development, :test do
|
5
5
|
gem "rake"
|
6
|
-
|
7
|
-
|
6
|
+
gem "ruby-debug", :platform => :ruby_18
|
7
|
+
gem "ruby-debug19", :platform => :ruby_19
|
8
8
|
gem "bundler"
|
9
|
-
gem "jeweler"
|
10
9
|
|
11
10
|
gem "json_pure"
|
12
11
|
|
12
|
+
gem "activerecord-mysql2-adapter"
|
13
13
|
#ORM's
|
14
14
|
gem "activerecord"
|
15
15
|
gem "datamapper"
|
16
|
-
|
17
|
-
|
16
|
+
gem "dm-migrations"
|
17
|
+
gem "dm-sqlite-adapter"
|
18
18
|
gem "mongoid"
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
gem "tzinfo"
|
20
|
+
gem "mongo_ext"
|
21
|
+
gem "bson_ext"
|
22
|
+
gem "mongoid-tree"
|
23
|
+
|
22
24
|
gem "mongo_mapper"
|
25
|
+
gem "moped"
|
26
|
+
gem "neo4j-core"
|
23
27
|
gem "couch_potato"
|
24
|
-
|
28
|
+
|
29
|
+
gem "sequel", "~> 3.21.0"
|
25
30
|
#gem "ibm_db" # I don't want to add this dependency, even as a dev one since it requires DB2 to be installed
|
26
31
|
gem 'mysql', '~> 2.8.1'
|
27
32
|
gem 'mysql2'
|
28
33
|
gem 'pg'
|
29
|
-
gem 'sqlite3'
|
30
34
|
gem 'ohm', '~> 0.1.3'
|
31
35
|
|
32
36
|
gem 'guard-rspec'
|
@@ -34,9 +38,7 @@ end
|
|
34
38
|
|
35
39
|
group :test do
|
36
40
|
gem "rspec-rails"
|
37
|
-
|
38
|
-
#gem "rcov"
|
39
|
-
#gem "ZenTest"
|
41
|
+
gem "sqlite3"
|
40
42
|
end
|
41
43
|
|
42
44
|
group :cucumber do
|
data/examples/Gemfile.lock
CHANGED
@@ -1,40 +1,51 @@
|
|
1
1
|
GEM
|
2
|
-
remote:
|
2
|
+
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
rack
|
12
|
-
rack-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionpack (3.0.0)
|
6
|
+
activemodel (= 3.0.0)
|
7
|
+
activesupport (= 3.0.0)
|
8
|
+
builder (~> 2.1.2)
|
9
|
+
erubis (~> 2.6.6)
|
10
|
+
i18n (~> 0.4.1)
|
11
|
+
rack (~> 1.2.1)
|
12
|
+
rack-mount (~> 0.6.12)
|
13
|
+
rack-test (~> 0.5.4)
|
14
|
+
tzinfo (~> 0.3.23)
|
15
|
+
activemodel (3.0.0)
|
16
|
+
activesupport (= 3.0.0)
|
17
|
+
builder (~> 2.1.2)
|
18
|
+
i18n (~> 0.4.1)
|
19
|
+
activerecord (3.0.0)
|
20
|
+
activemodel (= 3.0.0)
|
21
|
+
activesupport (= 3.0.0)
|
22
|
+
arel (~> 1.0.0)
|
23
|
+
tzinfo (~> 0.3.23)
|
24
|
+
activerecord-mysql2-adapter (0.0.3)
|
25
|
+
mysql2
|
26
|
+
activesupport (3.0.0)
|
27
|
+
addressable (2.3.6)
|
28
|
+
archive-tar-minitar (0.5.2)
|
29
|
+
arel (1.0.1)
|
30
|
+
activesupport (~> 3.0.0)
|
31
|
+
bcrypt (3.1.7)
|
32
|
+
bcrypt (3.1.7-java)
|
33
|
+
bcrypt-ruby (3.1.5)
|
34
|
+
bcrypt (>= 3.1.3)
|
35
|
+
bcrypt-ruby (3.1.5-java)
|
36
|
+
bcrypt (>= 3.1.3)
|
37
|
+
bson (1.11.1)
|
38
|
+
bson (1.11.1-java)
|
39
|
+
bson_ext (1.11.1)
|
40
|
+
bson (~> 1.11.1)
|
41
|
+
builder (2.1.2)
|
42
|
+
coderay (1.1.0)
|
43
|
+
columnize (0.8.9)
|
44
|
+
couch_potato (1.3.0)
|
34
45
|
activemodel
|
35
|
-
couchrest (
|
46
|
+
couchrest (~> 1.2.0)
|
36
47
|
json (~> 1.6)
|
37
|
-
couchrest (1.
|
48
|
+
couchrest (1.2.0)
|
38
49
|
mime-types (~> 1.15)
|
39
50
|
multi_json (~> 1.0)
|
40
51
|
rest-client (~> 1.6.1)
|
@@ -43,7 +54,7 @@ GEM
|
|
43
54
|
diff-lcs (>= 1.1.3)
|
44
55
|
gherkin (~> 2.11.0)
|
45
56
|
json (>= 1.4.6)
|
46
|
-
data_objects (0.10.
|
57
|
+
data_objects (0.10.14)
|
47
58
|
addressable (~> 2.1)
|
48
59
|
datamapper (1.2.0)
|
49
60
|
dm-aggregates (~> 1.2.0)
|
@@ -60,8 +71,8 @@ GEM
|
|
60
71
|
dm-core (~> 1.2.0)
|
61
72
|
dm-constraints (1.2.0)
|
62
73
|
dm-core (~> 1.2.0)
|
63
|
-
dm-core (1.2.
|
64
|
-
addressable (~> 2.
|
74
|
+
dm-core (1.2.1)
|
75
|
+
addressable (~> 2.3)
|
65
76
|
dm-do-adapter (1.2.0)
|
66
77
|
data_objects (~> 0.10.6)
|
67
78
|
dm-core (~> 1.2.0)
|
@@ -90,119 +101,170 @@ GEM
|
|
90
101
|
uuidtools (~> 2.1)
|
91
102
|
dm-validations (1.2.0)
|
92
103
|
dm-core (~> 1.2.0)
|
93
|
-
do_sqlite3 (0.10.
|
94
|
-
data_objects (= 0.10.
|
95
|
-
erubis (2.
|
104
|
+
do_sqlite3 (0.10.14)
|
105
|
+
data_objects (= 0.10.14)
|
106
|
+
erubis (2.6.6)
|
107
|
+
abstract (>= 1.0.0)
|
108
|
+
faraday (0.9.0)
|
109
|
+
multipart-post (>= 1.2, < 3)
|
110
|
+
faraday_middleware (0.9.1)
|
111
|
+
faraday (>= 0.7.4, < 0.10)
|
96
112
|
fastercsv (1.5.5)
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
113
|
+
ffi (1.9.6)
|
114
|
+
ffi (1.9.6-java)
|
115
|
+
formatador (0.2.5)
|
116
|
+
gherkin (2.11.6)
|
117
|
+
json (>= 1.7.6)
|
118
|
+
gherkin (2.11.6-java)
|
119
|
+
json (>= 1.7.6)
|
120
|
+
guard (1.8.3)
|
121
|
+
formatador (>= 0.2.4)
|
122
|
+
listen (~> 1.3)
|
102
123
|
lumberjack (>= 1.0.2)
|
103
124
|
pry (>= 0.9.10)
|
104
125
|
thor (>= 0.14.6)
|
105
|
-
guard-rspec (2.
|
126
|
+
guard-rspec (2.5.4)
|
106
127
|
guard (>= 1.1)
|
107
128
|
rspec (~> 2.11)
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
129
|
+
httparty (0.13.3)
|
130
|
+
json (~> 1.8)
|
131
|
+
multi_xml (>= 0.5.2)
|
132
|
+
httpclient (2.5.3.3)
|
133
|
+
i18n (0.4.2)
|
134
|
+
json (1.8.1)
|
135
|
+
json (1.8.1-java)
|
136
|
+
json_pure (1.8.1)
|
137
|
+
linecache (0.46)
|
138
|
+
rbx-require-relative (> 0.0.4)
|
139
|
+
linecache19 (0.5.12)
|
140
|
+
ruby_core_source (>= 0.1.4)
|
141
|
+
listen (1.3.1)
|
142
|
+
rb-fsevent (>= 0.9.3)
|
143
|
+
rb-inotify (>= 0.9)
|
144
|
+
rb-kqueue (>= 0.2)
|
145
|
+
lumberjack (1.0.9)
|
146
|
+
method_source (0.8.2)
|
147
|
+
mime-types (1.25.1)
|
148
|
+
mongo (1.11.1)
|
149
|
+
bson (= 1.11.1)
|
124
150
|
mongo_ext (0.19.3)
|
125
151
|
mongo_mapper (0.12.0)
|
126
152
|
activemodel (~> 3.0)
|
127
153
|
activesupport (~> 3.0)
|
128
154
|
plucky (~> 0.5.2)
|
129
|
-
mongoid (
|
130
|
-
activemodel (~> 3.
|
131
|
-
|
132
|
-
origin (~> 1.0)
|
155
|
+
mongoid (2.2.6)
|
156
|
+
activemodel (~> 3.0.0)
|
157
|
+
mongo (~> 1.3)
|
133
158
|
tzinfo (~> 0.3.22)
|
134
|
-
|
135
|
-
|
159
|
+
mongoid-tree (0.7.0)
|
160
|
+
mongoid (~> 2.0)
|
161
|
+
moped (1.5.2)
|
162
|
+
multi_json (1.2.0)
|
163
|
+
multi_xml (0.5.5)
|
164
|
+
multipart-post (2.0.0)
|
136
165
|
mysql (2.8.1)
|
137
|
-
mysql2 (0.3.
|
166
|
+
mysql2 (0.3.16)
|
167
|
+
neo4j-community (2.1.5)
|
168
|
+
neo4j-core (3.0.8)
|
169
|
+
activesupport
|
170
|
+
faraday (~> 0.9.0)
|
171
|
+
faraday_middleware (~> 0.9.1)
|
172
|
+
httparty
|
173
|
+
httpclient
|
174
|
+
json
|
175
|
+
neo4j-community (~> 2.1.1)
|
176
|
+
net-http-persistent
|
177
|
+
os
|
178
|
+
zip
|
138
179
|
nest (1.1.2)
|
139
180
|
redis
|
181
|
+
net-http-persistent (2.9.4)
|
140
182
|
ohm (0.1.5)
|
141
183
|
nest (~> 1.0)
|
142
|
-
|
143
|
-
pg (0.
|
184
|
+
os (0.9.6)
|
185
|
+
pg (0.17.1)
|
144
186
|
plucky (0.5.2)
|
145
187
|
mongo (~> 1.5)
|
146
|
-
pry (0.
|
147
|
-
coderay (~> 1.0
|
148
|
-
method_source (~> 0.8)
|
149
|
-
slop (~> 3.
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
rack
|
188
|
+
pry (0.10.1)
|
189
|
+
coderay (~> 1.1.0)
|
190
|
+
method_source (~> 0.8.1)
|
191
|
+
slop (~> 3.4)
|
192
|
+
pry (0.10.1-java)
|
193
|
+
coderay (~> 1.1.0)
|
194
|
+
method_source (~> 0.8.1)
|
195
|
+
slop (~> 3.4)
|
196
|
+
spoon (~> 0.0)
|
197
|
+
rack (1.2.8)
|
198
|
+
rack-mount (0.6.14)
|
199
|
+
rack (>= 1.0.0)
|
200
|
+
rack-test (0.5.7)
|
156
201
|
rack (>= 1.0)
|
157
|
-
railties (3.
|
158
|
-
actionpack (= 3.
|
159
|
-
activesupport (= 3.
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
202
|
+
railties (3.0.0)
|
203
|
+
actionpack (= 3.0.0)
|
204
|
+
activesupport (= 3.0.0)
|
205
|
+
rake (>= 0.8.4)
|
206
|
+
thor (~> 0.14.0)
|
207
|
+
rake (10.3.2)
|
208
|
+
rb-fsevent (0.9.4)
|
209
|
+
rb-inotify (0.9.5)
|
210
|
+
ffi (>= 0.5.0)
|
211
|
+
rb-kqueue (0.2.3)
|
212
|
+
ffi (>= 0.5.0)
|
213
|
+
rbx-require-relative (0.0.9)
|
214
|
+
rdoc (4.1.2)
|
166
215
|
json (~> 1.4)
|
167
|
-
redis (3.0
|
168
|
-
rest-client (1.6.
|
169
|
-
mime-types (
|
170
|
-
|
171
|
-
|
172
|
-
rspec-
|
173
|
-
rspec-
|
174
|
-
|
175
|
-
rspec-
|
176
|
-
|
177
|
-
|
178
|
-
rspec-
|
216
|
+
redis (3.1.0)
|
217
|
+
rest-client (1.6.8)
|
218
|
+
mime-types (~> 1.16)
|
219
|
+
rdoc (>= 2.4.2)
|
220
|
+
rspec (2.11.0)
|
221
|
+
rspec-core (~> 2.11.0)
|
222
|
+
rspec-expectations (~> 2.11.0)
|
223
|
+
rspec-mocks (~> 2.11.0)
|
224
|
+
rspec-core (2.11.1)
|
225
|
+
rspec-expectations (2.11.3)
|
226
|
+
diff-lcs (~> 1.1.3)
|
227
|
+
rspec-mocks (2.11.3)
|
228
|
+
rspec-rails (2.11.4)
|
179
229
|
actionpack (>= 3.0)
|
180
230
|
activesupport (>= 3.0)
|
181
231
|
railties (>= 3.0)
|
182
|
-
rspec
|
183
|
-
|
184
|
-
|
232
|
+
rspec (~> 2.11.0)
|
233
|
+
ruby-debug (0.10.4)
|
234
|
+
columnize (>= 0.1)
|
235
|
+
ruby-debug-base (~> 0.10.4.0)
|
236
|
+
ruby-debug-base (0.10.4)
|
237
|
+
linecache (>= 0.3)
|
238
|
+
ruby-debug-base19 (0.11.25)
|
239
|
+
columnize (>= 0.3.1)
|
240
|
+
linecache19 (>= 0.5.11)
|
241
|
+
ruby_core_source (>= 0.1.4)
|
242
|
+
ruby-debug19 (0.11.6)
|
243
|
+
columnize (>= 0.3.1)
|
244
|
+
linecache19 (>= 0.5.11)
|
245
|
+
ruby-debug-base19 (>= 0.11.19)
|
246
|
+
ruby_core_source (0.1.5)
|
247
|
+
archive-tar-minitar (>= 0.5.2)
|
185
248
|
sequel (3.21.0)
|
186
|
-
slop (3.
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
rack (~> 1.0)
|
191
|
-
tilt (~> 1.1, != 1.3.0)
|
192
|
-
sqlite3 (1.3.6)
|
249
|
+
slop (3.6.0)
|
250
|
+
spoon (0.0.4)
|
251
|
+
ffi
|
252
|
+
sqlite3 (1.3.9)
|
193
253
|
sqlite3-ruby (1.3.3)
|
194
254
|
sqlite3 (>= 1.3.3)
|
195
255
|
stringex (1.5.1)
|
196
|
-
thor (0.
|
197
|
-
|
198
|
-
|
199
|
-
|
256
|
+
thor (0.14.6)
|
257
|
+
tzinfo (0.3.41)
|
258
|
+
uuidtools (2.1.5)
|
259
|
+
zip (2.0.2)
|
200
260
|
|
201
261
|
PLATFORMS
|
262
|
+
java
|
202
263
|
ruby
|
203
264
|
|
204
265
|
DEPENDENCIES
|
205
266
|
activerecord
|
267
|
+
activerecord-mysql2-adapter
|
206
268
|
bson_ext
|
207
269
|
bundler
|
208
270
|
couch_potato
|
@@ -211,17 +273,21 @@ DEPENDENCIES
|
|
211
273
|
dm-migrations
|
212
274
|
dm-sqlite-adapter
|
213
275
|
guard-rspec
|
214
|
-
jeweler
|
215
276
|
json_pure
|
216
277
|
mongo_ext
|
217
278
|
mongo_mapper
|
218
279
|
mongoid
|
280
|
+
mongoid-tree
|
281
|
+
moped
|
219
282
|
mysql (~> 2.8.1)
|
220
283
|
mysql2
|
284
|
+
neo4j-core
|
221
285
|
ohm (~> 0.1.3)
|
222
286
|
pg
|
223
287
|
rake
|
224
288
|
rspec-rails
|
289
|
+
ruby-debug
|
290
|
+
ruby-debug19
|
225
291
|
sequel (~> 3.21.0)
|
226
292
|
sqlite3
|
227
293
|
sqlite3-ruby
|