database_cleaner 1.3.0 → 1.4.0

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.
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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4527ac30a6efa3d7c5938b87344a51f1ab0c7314
4
+ data.tar.gz: cbdaea723b3b1a2de12449af9b3cef9539e2dd4e
5
+ SHA512:
6
+ metadata.gz: 196e5a7355500166c4738165b498bb2c4886a1091317a1a9fb99552efcc4f659109f0093778bf3cbfd88eb4afcdec431c30b9f591a037c9900cffd707b7b9670
7
+ data.tar.gz: 664d22fb94baa71bc7610cb919c3ea8180a55117667b5ac671a6d826c27b586cb40ec1ff4e447f1bc554ac6bb3aa50da5296c55244a1e623250ac99014d7998f
@@ -0,0 +1,28 @@
1
+ # Guidelines for contributing
2
+
3
+ ## 1. Fork & Clone
4
+
5
+ Since you probably don't have rights to the main repo, you should Fork it (big
6
+ button up top). After that, clone your fork locally and optionally add an
7
+ upstream:
8
+
9
+ git remote add upstream git@github.com:DatabaseCleaner/database_cleaner.git
10
+
11
+ ## 2. Make sure the tests run fine
12
+
13
+ - `bundle install`
14
+ - Copy `db/sample.config.yml` to `db/config.yml` and edit it
15
+ - Make sure to create the databases specified in `db/config.yml`
16
+ - Run the tests with `bundle exec rspec`
17
+
18
+ Note that if you don't have all the supported databases installed and running,
19
+ some tests will fail.
20
+
21
+ ## 3. Prepare your contribution
22
+
23
+ This is all up to you but a few points should be kept in mind:
24
+
25
+ - Please write tests for your contribution
26
+ - Make sure that previous tests still pass
27
+ - Push it to a branch of your fork
28
+ - Submit a pull request
data/Gemfile.lock CHANGED
@@ -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
data/History.rdoc CHANGED
@@ -1,7 +1,24 @@
1
+ == Development (master)
2
+
3
+ === New Features/Changes
4
+ * Using the deletion strategy with Mysql now only deletes those tables
5
+ which have had records added to them. (@MadRabbit)
6
+ * Add support for `pre_count` on Sequel with Mysql. (@vrinek)
7
+ * Add support for neo4j. (@dpisarewski)
8
+ * Cache collection names in mongo's truncation strategy. (@nyarly)
9
+ * Support for mongoid multiple connections. (@nyarly)
10
+ * Support for deletion with Sequel. (@cyberdelia)
11
+
12
+ === Bug Fixes
13
+ * Fix `undefined method error` with DataMapper SQLite adaptor. (@lanej)
14
+ * Fully define Mysql2 adaptor constant. (@jgonera)
15
+ * Don't truncate schema tables in Postgres. (@billywatson)
16
+ * Fix issue #284. (@MartinNowak)
17
+
1
18
  == 1.3.0 2014-05-23
2
19
 
3
20
  === New Features/Changes
4
- * Introduced `DatabaseCleaener::cleaninng` method that takes a block. (@ethco)
21
+ * Introduced `DatabaseCleaner::cleaning` method that takes a block. (@ethco)
5
22
  * Improved Sequel support and added more tests (@ethco, @rhunter)
6
23
 
7
24
  === Bug Fixes
data/README.markdown CHANGED
@@ -7,7 +7,7 @@ Each strategy is a small amount of code but is code that is usually needed in an
7
7
 
8
8
  ActiveRecord, DataMapper, Sequel, MongoMapper, Mongoid, CouchPotato, Ohm and Redis are supported.
9
9
 
10
- [![Build Status](https://secure.travis-ci.org/bmabey/database_cleaner.png)](http://travis-ci.org/bmabey/database_cleaner)
10
+ [![Build Status](https://travis-ci.org/DatabaseCleaner/database_cleaner.svg?branch=master)](https://travis-ci.org/DatabaseCleaner/database_cleaner)
11
11
 
12
12
  Here is an overview of the strategies supported for each library:
13
13
 
@@ -67,9 +67,17 @@ Here is an overview of the strategies supported for each library:
67
67
  <td>No</td>
68
68
  <td>No</td>
69
69
  </tr>
70
+ <tr>
71
+ <td>Neo4j</td>
72
+ <td>Yes</td>
73
+ <td>Yes*</td>
74
+ <td>Yes*</td>
75
+ </tr>
70
76
  </tbody>
71
77
  </table>
72
78
 
79
+ * Truncation and Deletion strategies for Neo4j will just delete all nodes and relationships from the database.
80
+
73
81
  <table>
74
82
  <tbody>
75
83
  <tr>
@@ -333,6 +341,11 @@ Usage beyond that remains the same with `DatabaseCleaner.start` calling any setu
333
341
  <td><code>DatabaseCleaner[:ohm]</code></td>
334
342
  <td>Connection specified as Redis URI</td>
335
343
  </tr>
344
+ <tr>
345
+ <td>Neo4j</td>
346
+ <td><code>DatabaseCleaner[:neo4j]</code></td>
347
+ <td>Database type and path(URI) <code>DatabaseCleaner[:neo4j, connection: {type: :server_db, path: 'http://localhost:7475'}].</code></td>
348
+ </tr>
336
349
  </tbody>
337
350
  </table>
338
351
 
@@ -359,15 +372,39 @@ DatabaseCleaner[:mongoid].strategy = :truncation
359
372
 
360
373
  ### STDERR is being flooded when using Postgres
361
374
 
362
- If you are using Postgres and have foreign key constraints, the truncation strategy will cause a lot of extra noise to appear on STDERR (in the form of "NOTICE truncate cascades" messages). To silence these warnings set the following log level in your `postgresql.conf` file:
375
+ If you are using Postgres and have foreign key constraints, the truncation strategy will cause a lot of extra noise to appear on STDERR (in the form of "NOTICE truncate cascades" messages).
376
+
377
+ To silence these warnings set the following log level in your `postgresql.conf` file:
363
378
 
364
379
  ```ruby
365
380
  client_min_messages = warning
366
381
  ```
367
382
 
383
+ For ActiveRecord, you add the following parameter in your database.yml file:
384
+
385
+ <pre>
386
+ test:
387
+ adapter: postgresql
388
+ # ...
389
+ min_messages: WARNING
390
+ </pre>
391
+
368
392
  ### Nothing happens in JRuby with Sequel using transactions
369
393
 
370
- Due to an inconsistency in JRuby's implementation of Fibers, Sequel gives a different connection to `DatabaseCleaner.start` than is used for tests run between `.start` and `.clean`. This can be worked around by running your tests in a block like `DatabaseCleaner.cleaning { run_my_tests }` instead, which does not use Fibers.
394
+ Due to an inconsistency in JRuby's implementation of Fibers, Sequel gives a different connection to `DatabaseCleaner.start` than is used for tests run between `.start` and `.clean`. This can be worked around by running your tests in a block like `DatabaseCleaner.cleaning { run_my_tests }` instead, which does not use Fibers.
395
+
396
+ ### Model fails to load with Neo4j using transactions
397
+
398
+ When you are using [neo4j](https://github.com/neo4jrb/neo4j) gem it creates schema and reads indexes upon loading models. These operations can't be done during a transaction. You have to preload your models before DatabaseCleaner starts a transaction.
399
+
400
+ Add to your rails_helper or spec_helper after requiring database_cleaner:
401
+
402
+ ```ruby
403
+ require 'database_cleaner'
404
+ Dir["#{Rails.root}/app/models/**/*.rb"].each do |model|
405
+ load model
406
+ end
407
+ ```
371
408
 
372
409
  ## Debugging
373
410
 
@@ -382,4 +419,4 @@ DatabaseCleaner.logger = Rails.logger
382
419
 
383
420
  ## COPYRIGHT
384
421
 
385
- Copyright (c) 2009 Ben Mabey. See LICENSE for details.
422
+ Copyright (c) 2014 Ben Mabey. See LICENSE for details.