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.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTE.markdown +28 -0
  3. data/Gemfile.lock +182 -116
  4. data/History.rdoc +18 -1
  5. data/README.markdown +41 -4
  6. data/Rakefile +1 -17
  7. data/VERSION.yml +2 -3
  8. data/examples/Gemfile +17 -15
  9. data/examples/Gemfile.lock +182 -116
  10. data/examples/features/step_definitions/neo4j_steps.rb +23 -0
  11. data/examples/features/support/env.rb +0 -3
  12. data/examples/lib/mongoid_models.rb +1 -6
  13. data/examples/lib/neo4j_models.rb +17 -0
  14. data/examples/lib/sequel_models.rb +9 -0
  15. data/features/cleaning.feature +6 -0
  16. data/features/cleaning_default_strategy.feature +2 -0
  17. data/features/cleaning_multiple_dbs.feature +2 -0
  18. data/features/cleaning_multiple_orms.feature +19 -0
  19. data/features/step_definitions/database_cleaner_steps.rb +1 -1
  20. data/lib/database_cleaner/active_record/deletion.rb +30 -0
  21. data/lib/database_cleaner/active_record/truncation.rb +29 -1
  22. data/lib/database_cleaner/base.rb +4 -0
  23. data/lib/database_cleaner/configuration.rb +2 -0
  24. data/lib/database_cleaner/data_mapper/truncation.rb +5 -42
  25. data/lib/database_cleaner/mongo/base.rb +2 -0
  26. data/lib/database_cleaner/mongo/truncation.rb +40 -0
  27. data/lib/database_cleaner/mongoid/truncation.rb +8 -1
  28. data/lib/database_cleaner/moped/truncation_base.rb +1 -1
  29. data/lib/database_cleaner/neo4j/base.rb +58 -0
  30. data/lib/database_cleaner/neo4j/deletion.rb +16 -0
  31. data/lib/database_cleaner/neo4j/transaction.rb +35 -0
  32. data/lib/database_cleaner/neo4j/truncation.rb +9 -0
  33. data/lib/database_cleaner/sequel/base.rb +2 -2
  34. data/lib/database_cleaner/sequel/deletion.rb +47 -0
  35. data/lib/database_cleaner/sequel/transaction.rb +5 -5
  36. data/lib/database_cleaner/sequel/truncation.rb +41 -13
  37. data/spec/database_cleaner/active_record/truncation/mysql2_spec.rb +1 -3
  38. data/spec/database_cleaner/active_record/truncation/mysql_spec.rb +2 -4
  39. data/spec/database_cleaner/active_record/truncation/postgresql_spec.rb +13 -4
  40. data/spec/database_cleaner/active_record/truncation/sqlite3_spec.rb +0 -2
  41. data/spec/database_cleaner/base_spec.rb +48 -12
  42. data/spec/database_cleaner/configuration_spec.rb +5 -0
  43. data/spec/database_cleaner/data_mapper/truncation/sqlite3_spec.rb +41 -0
  44. data/spec/database_cleaner/moped/moped_examples.rb +6 -0
  45. data/spec/database_cleaner/moped/truncation_spec.rb +7 -2
  46. data/spec/database_cleaner/neo4j/base_spec.rb +36 -0
  47. data/spec/database_cleaner/neo4j/transaction_spec.rb +25 -0
  48. data/spec/database_cleaner/sequel/deletion_spec.rb +58 -0
  49. data/spec/database_cleaner/sequel/truncation_spec.rb +38 -0
  50. data/spec/support/active_record/mysql2_setup.rb +1 -2
  51. data/spec/support/active_record/mysql_setup.rb +1 -1
  52. data/spec/support/active_record/postgresql_setup.rb +1 -1
  53. data/spec/support/active_record/schema_setup.rb +8 -1
  54. data/spec/support/active_record/sqlite3_setup.rb +1 -1
  55. data/spec/support/data_mapper/schema_setup.rb +15 -0
  56. data/spec/support/data_mapper/sqlite3_setup.rb +39 -0
  57. 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
@@ -1,5 +1,4 @@
1
1
  ---
2
- :minor: 3
3
- :build:
4
- :patch: 0
5
2
  :major: 1
3
+ :minor: 4
4
+ :patch: 0
data/examples/Gemfile CHANGED
@@ -1,32 +1,36 @@
1
- source "http://rubygems.org"
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
- #gem "ruby-debug"
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
- gem "dm-migrations"
17
- gem "dm-sqlite-adapter"
16
+ gem "dm-migrations"
17
+ gem "dm-sqlite-adapter"
18
18
  gem "mongoid"
19
- gem "tzinfo"
20
- gem "mongo_ext"
21
- gem "bson_ext"
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
- gem "sequel", "~>3.21.0"
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
- #gem "rspactor"
38
- #gem "rcov"
39
- #gem "ZenTest"
41
+ gem "sqlite3"
40
42
  end
41
43
 
42
44
  group :cucumber do
@@ -1,40 +1,51 @@
1
1
  GEM
2
- remote: http://rubygems.org/
2
+ remote: https://rubygems.org/
3
3
  specs:
4
- actionpack (3.2.11)
5
- activemodel (= 3.2.11)
6
- activesupport (= 3.2.11)
7
- builder (~> 3.0.0)
8
- erubis (~> 2.7.0)
9
- journey (~> 1.0.4)
10
- rack (~> 1.4.0)
11
- rack-cache (~> 1.2)
12
- rack-test (~> 0.6.1)
13
- sprockets (~> 2.2.1)
14
- activemodel (3.2.11)
15
- activesupport (= 3.2.11)
16
- builder (~> 3.0.0)
17
- activerecord (3.2.11)
18
- activemodel (= 3.2.11)
19
- activesupport (= 3.2.11)
20
- arel (~> 3.0.2)
21
- tzinfo (~> 0.3.29)
22
- activesupport (3.2.11)
23
- i18n (~> 0.6)
24
- multi_json (~> 1.0)
25
- addressable (2.2.8)
26
- arel (3.0.2)
27
- bcrypt-ruby (3.0.1)
28
- bson (1.8.2)
29
- bson_ext (1.8.2)
30
- bson (~> 1.8.2)
31
- builder (3.0.4)
32
- coderay (1.0.8)
33
- couch_potato (0.7.1)
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 (>= 1.0.1)
46
+ couchrest (~> 1.2.0)
36
47
  json (~> 1.6)
37
- couchrest (1.1.3)
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.11)
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.0)
64
- addressable (~> 2.2.6)
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.11)
94
- data_objects (= 0.10.11)
95
- erubis (2.7.0)
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
- gherkin (2.11.5)
98
- json (>= 1.4.6)
99
- git (1.2.5)
100
- guard (1.6.1)
101
- listen (>= 0.6.0)
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.3.3)
126
+ guard-rspec (2.5.4)
106
127
  guard (>= 1.1)
107
128
  rspec (~> 2.11)
108
- hike (1.2.1)
109
- i18n (0.6.1)
110
- jeweler (1.8.4)
111
- bundler (~> 1.0)
112
- git (>= 1.2.5)
113
- rake
114
- rdoc
115
- journey (1.0.4)
116
- json (1.7.6)
117
- json_pure (1.7.6)
118
- listen (0.7.1)
119
- lumberjack (1.0.2)
120
- method_source (0.8.1)
121
- mime-types (1.19)
122
- mongo (1.8.2)
123
- bson (~> 1.8.2)
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 (3.0.16)
130
- activemodel (~> 3.1)
131
- moped (~> 1.1)
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
- moped (1.3.2)
135
- multi_json (1.5.0)
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.11)
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
- origin (1.0.11)
143
- pg (0.14.1)
184
+ os (0.9.6)
185
+ pg (0.17.1)
144
186
  plucky (0.5.2)
145
187
  mongo (~> 1.5)
146
- pry (0.9.10)
147
- coderay (~> 1.0.5)
148
- method_source (~> 0.8)
149
- slop (~> 3.3.1)
150
- rack (1.4.3)
151
- rack-cache (1.2)
152
- rack (>= 0.4)
153
- rack-ssl (1.3.2)
154
- rack
155
- rack-test (0.6.2)
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.2.11)
158
- actionpack (= 3.2.11)
159
- activesupport (= 3.2.11)
160
- rack-ssl (~> 1.3.2)
161
- rake (>= 0.8.7)
162
- rdoc (~> 3.4)
163
- thor (>= 0.14.6, < 2.0)
164
- rake (10.0.3)
165
- rdoc (3.12)
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.4)
168
- rest-client (1.6.7)
169
- mime-types (>= 1.16)
170
- rspec (2.14.1)
171
- rspec-core (~> 2.14.0)
172
- rspec-expectations (~> 2.14.0)
173
- rspec-mocks (~> 2.14.0)
174
- rspec-core (2.14.5)
175
- rspec-expectations (2.14.2)
176
- diff-lcs (>= 1.1.3, < 2.0)
177
- rspec-mocks (2.14.3)
178
- rspec-rails (2.14.0)
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-core (~> 2.14.0)
183
- rspec-expectations (~> 2.14.0)
184
- rspec-mocks (~> 2.14.0)
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.3.3)
187
- sprockets (2.2.2)
188
- hike (~> 1.2)
189
- multi_json (~> 1.0)
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.16.0)
197
- tilt (1.3.3)
198
- tzinfo (0.3.35)
199
- uuidtools (2.1.3)
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