Skip to content
Browse files

Add vendored gems

  • Loading branch information...
1 parent 5ec2ecd commit 92c83721a74b513f36cc4e9602b6e1408852e41a @radar radar committed Aug 7, 2012
Showing with 19,330 additions and 0 deletions.
  1. +11 −0 vendor/gems/database_cleaner/.gitignore
  2. +1 −0 vendor/gems/database_cleaner/.rbenv-version
  3. +4 −0 vendor/gems/database_cleaner/.rspec
  4. +1 −0 vendor/gems/database_cleaner/.rvmrc
  5. +13 −0 vendor/gems/database_cleaner/.travis.yml
  6. +43 −0 vendor/gems/database_cleaner/Gemfile
  7. +231 −0 vendor/gems/database_cleaner/Gemfile.lock
  8. +9 −0 vendor/gems/database_cleaner/Guardfile
  9. +221 −0 vendor/gems/database_cleaner/History.txt
  10. +20 −0 vendor/gems/database_cleaner/LICENSE
  11. +245 −0 vendor/gems/database_cleaner/README.textile
  12. +55 −0 vendor/gems/database_cleaner/Rakefile
  13. +3 −0 vendor/gems/database_cleaner/TODO
  14. +5 −0 vendor/gems/database_cleaner/VERSION.yml
  15. +1 −0 vendor/gems/database_cleaner/cucumber.yml
  16. +149 −0 vendor/gems/database_cleaner/database_cleaner.gemspec
  17. +26 −0 vendor/gems/database_cleaner/db/sample.config.yml
  18. +1 −0 vendor/gems/database_cleaner/examples/Gemfile
  19. +1 −0 vendor/gems/database_cleaner/examples/Gemfile.lock
  20. +8 −0 vendor/gems/database_cleaner/examples/config/database.yml.example
  21. 0 vendor/gems/database_cleaner/examples/db/sqlite_databases_go_here
  22. +11 −0 vendor/gems/database_cleaner/examples/features/example.feature
  23. +23 −0 vendor/gems/database_cleaner/examples/features/example_multiple_db.feature
  24. +22 −0 vendor/gems/database_cleaner/examples/features/example_multiple_orm.feature
  25. +31 −0 vendor/gems/database_cleaner/examples/features/step_definitions/activerecord_steps.rb
  26. +31 −0 vendor/gems/database_cleaner/examples/features/step_definitions/couchpotato_steps.rb
  27. +37 −0 vendor/gems/database_cleaner/examples/features/step_definitions/datamapper_steps.rb
  28. +23 −0 vendor/gems/database_cleaner/examples/features/step_definitions/mongoid_steps.rb
  29. +31 −0 vendor/gems/database_cleaner/examples/features/step_definitions/mongomapper_steps.rb
  30. +55 −0 vendor/gems/database_cleaner/examples/features/step_definitions/translation_steps.rb
  31. +62 −0 vendor/gems/database_cleaner/examples/features/support/env.rb
  32. +41 −0 vendor/gems/database_cleaner/examples/lib/activerecord_models.rb
  33. +61 −0 vendor/gems/database_cleaner/examples/lib/couchpotato_models.rb
  34. +50 −0 vendor/gems/database_cleaner/examples/lib/datamapper_models.rb
  35. +49 −0 vendor/gems/database_cleaner/examples/lib/mongoid_models.rb
  36. +51 −0 vendor/gems/database_cleaner/examples/lib/mongomapper_models.rb
  37. +22 −0 vendor/gems/database_cleaner/features/cleaning.feature
  38. +19 −0 vendor/gems/database_cleaner/features/cleaning_default_strategy.feature
  39. +21 −0 vendor/gems/database_cleaner/features/cleaning_multiple_dbs.feature
  40. +29 −0 vendor/gems/database_cleaner/features/cleaning_multiple_orms.feature
  41. +32 −0 vendor/gems/database_cleaner/features/step_definitions/database_cleaner_steps.rb
  42. +7 −0 vendor/gems/database_cleaner/features/support/env.rb
  43. +39 −0 vendor/gems/database_cleaner/features/support/feature_runner.rb
  44. +3 −0 vendor/gems/database_cleaner/lib/database_cleaner.rb
  45. +53 −0 vendor/gems/database_cleaner/lib/database_cleaner/active_record/base.rb
  46. +67 −0 vendor/gems/database_cleaner/lib/database_cleaner/active_record/deletion.rb
  47. +31 −0 vendor/gems/database_cleaner/lib/database_cleaner/active_record/transaction.rb
  48. +256 −0 vendor/gems/database_cleaner/lib/database_cleaner/active_record/truncation.rb
  49. +138 −0 vendor/gems/database_cleaner/lib/database_cleaner/base.rb
  50. +96 −0 vendor/gems/database_cleaner/lib/database_cleaner/configuration.rb
  51. +7 −0 vendor/gems/database_cleaner/lib/database_cleaner/couch_potato/base.rb
  52. +28 −0 vendor/gems/database_cleaner/lib/database_cleaner/couch_potato/truncation.rb
  53. +11 −0 vendor/gems/database_cleaner/lib/database_cleaner/cucumber.rb
  54. +21 −0 vendor/gems/database_cleaner/lib/database_cleaner/data_mapper/base.rb
  55. +28 −0 vendor/gems/database_cleaner/lib/database_cleaner/data_mapper/transaction.rb
  56. +175 −0 vendor/gems/database_cleaner/lib/database_cleaner/data_mapper/truncation.rb
  57. +20 −0 vendor/gems/database_cleaner/lib/database_cleaner/generic/base.rb
  58. +11 −0 vendor/gems/database_cleaner/lib/database_cleaner/generic/transaction.rb
  59. +39 −0 vendor/gems/database_cleaner/lib/database_cleaner/generic/truncation.rb
  60. +22 −0 vendor/gems/database_cleaner/lib/database_cleaner/mongo/truncation.rb
  61. +20 −0 vendor/gems/database_cleaner/lib/database_cleaner/mongo_mapper/base.rb
  62. +19 −0 vendor/gems/database_cleaner/lib/database_cleaner/mongo_mapper/truncation.rb
  63. +20 −0 vendor/gems/database_cleaner/lib/database_cleaner/mongoid/base.rb
  64. +37 −0 vendor/gems/database_cleaner/lib/database_cleaner/mongoid/truncation.rb
  65. +25 −0 vendor/gems/database_cleaner/lib/database_cleaner/moped/truncation.rb
  66. +15 −0 vendor/gems/database_cleaner/lib/database_cleaner/null_strategy.rb
  67. +22 −0 vendor/gems/database_cleaner/lib/database_cleaner/sequel/base.rb
  68. +25 −0 vendor/gems/database_cleaner/lib/database_cleaner/sequel/transaction.rb
  69. +50 −0 vendor/gems/database_cleaner/lib/database_cleaner/sequel/truncation.rb
  70. +144 −0 vendor/gems/database_cleaner/spec/database_cleaner/active_record/base_spec.rb
  71. +77 −0 vendor/gems/database_cleaner/spec/database_cleaner/active_record/transaction_spec.rb
  72. +40 −0 vendor/gems/database_cleaner/spec/database_cleaner/active_record/truncation/mysql2_spec.rb
  73. +40 −0 vendor/gems/database_cleaner/spec/database_cleaner/active_record/truncation/mysql_spec.rb
  74. +48 −0 vendor/gems/database_cleaner/spec/database_cleaner/active_record/truncation/postgresql_spec.rb
  75. +40 −0 ...or/gems/database_cleaner/spec/database_cleaner/active_record/truncation/shared_fast_truncation.rb
  76. +145 −0 vendor/gems/database_cleaner/spec/database_cleaner/active_record/truncation_spec.rb
  77. +493 −0 vendor/gems/database_cleaner/spec/database_cleaner/base_spec.rb
  78. +294 −0 vendor/gems/database_cleaner/spec/database_cleaner/configuration_spec.rb
  79. +41 −0 vendor/gems/database_cleaner/spec/database_cleaner/couch_potato/truncation_spec.rb
  80. +30 −0 vendor/gems/database_cleaner/spec/database_cleaner/data_mapper/base_spec.rb
  81. +23 −0 vendor/gems/database_cleaner/spec/database_cleaner/data_mapper/transaction_spec.rb
  82. +11 −0 vendor/gems/database_cleaner/spec/database_cleaner/data_mapper/truncation_spec.rb
  83. +22 −0 vendor/gems/database_cleaner/spec/database_cleaner/generic/base_spec.rb
  84. +108 −0 vendor/gems/database_cleaner/spec/database_cleaner/generic/truncation_spec.rb
  85. +33 −0 vendor/gems/database_cleaner/spec/database_cleaner/mongo_mapper/base_spec.rb
  86. +8 −0 vendor/gems/database_cleaner/spec/database_cleaner/mongo_mapper/mongo_examples.rb
  87. +74 −0 vendor/gems/database_cleaner/spec/database_cleaner/mongo_mapper/truncation_spec.rb
  88. +32 −0 vendor/gems/database_cleaner/spec/database_cleaner/sequel/base_spec.rb
  89. +21 −0 vendor/gems/database_cleaner/spec/database_cleaner/sequel/transaction_spec.rb
  90. +13 −0 vendor/gems/database_cleaner/spec/database_cleaner/sequel/truncation_spec.rb
  91. +13 −0 vendor/gems/database_cleaner/spec/database_cleaner/shared_strategy.rb
  92. +1 −0 vendor/gems/database_cleaner/spec/rcov.opts
  93. +21 −0 vendor/gems/database_cleaner/spec/spec_helper.rb
  94. +4 −0 vendor/gems/database_cleaner/spec/support/active_record/database_setup.rb
  95. +38 −0 vendor/gems/database_cleaner/spec/support/active_record/mysql2_setup.rb
  96. +38 −0 vendor/gems/database_cleaner/spec/support/active_record/mysql_setup.rb
  97. +41 −0 vendor/gems/database_cleaner/spec/support/active_record/postgresql_setup.rb
  98. +10 −0 vendor/gems/database_cleaner/spec/support/active_record/schema_setup.rb
  99. +15 −0 vendor/gems/orm_adapter/.gitignore
  100. +1 −0 vendor/gems/orm_adapter/.rspec
  101. +4 −0 vendor/gems/orm_adapter/.travis.yml
  102. +3 −0 vendor/gems/orm_adapter/Gemfile
  103. +129 −0 vendor/gems/orm_adapter/Gemfile.lock.development
  104. +58 −0 vendor/gems/orm_adapter/History.txt
  105. +20 −0 vendor/gems/orm_adapter/LICENSE
  106. +71 −0 vendor/gems/orm_adapter/README.rdoc
  107. +37 −0 vendor/gems/orm_adapter/Rakefile
  108. +15 −0 vendor/gems/orm_adapter/lib/orm_adapter.rb
  109. +76 −0 vendor/gems/orm_adapter/lib/orm_adapter/adapters/active_record.rb
  110. +57 −0 vendor/gems/orm_adapter/lib/orm_adapter/adapters/data_mapper.rb
  111. +65 −0 vendor/gems/orm_adapter/lib/orm_adapter/adapters/mongo_mapper.rb
  112. +63 −0 vendor/gems/orm_adapter/lib/orm_adapter/adapters/mongoid.rb
  113. +127 −0 vendor/gems/orm_adapter/lib/orm_adapter/base.rb
  114. +14 −0 vendor/gems/orm_adapter/lib/orm_adapter/to_adapter.rb
  115. +3 −0 vendor/gems/orm_adapter/lib/orm_adapter/version.rb
  116. +35 −0 vendor/gems/orm_adapter/orm_adapter.gemspec
  117. +62 −0 vendor/gems/orm_adapter/spec/orm_adapter/adapters/active_record_spec.rb
  118. +47 −0 vendor/gems/orm_adapter/spec/orm_adapter/adapters/data_mapper_spec.rb
  119. +41 −0 vendor/gems/orm_adapter/spec/orm_adapter/adapters/mongo_mapper_spec.rb
  120. +39 −0 vendor/gems/orm_adapter/spec/orm_adapter/adapters/mongoid_spec.rb
  121. +81 −0 vendor/gems/orm_adapter/spec/orm_adapter/base_spec.rb
  122. +240 −0 vendor/gems/orm_adapter/spec/orm_adapter/example_app_shared.rb
  123. +13 −0 vendor/gems/orm_adapter/spec/orm_adapter_spec.rb
  124. +15 −0 vendor/gems/orm_adapter/spec/spec_helper.rb
  125. +24 −0 vendor/gems/paperclip/.gitignore
  126. +16 −0 vendor/gems/paperclip/.travis.yml
  127. +14 −0 vendor/gems/paperclip/Appraisals
  128. +70 −0 vendor/gems/paperclip/CONTRIBUTING.md
  129. +7 −0 vendor/gems/paperclip/Gemfile
  130. +26 −0 vendor/gems/paperclip/LICENSE
  131. +178 −0 vendor/gems/paperclip/NEWS
  132. +567 −0 vendor/gems/paperclip/README.md
  133. +4 −0 vendor/gems/paperclip/RUNNING_TESTS.md
  134. +46 −0 vendor/gems/paperclip/Rakefile
  135. +14 −0 vendor/gems/paperclip/UPGRADING
  136. +6 −0 vendor/gems/paperclip/cucumber/paperclip_steps.rb
  137. +68 −0 vendor/gems/paperclip/features/basic_integration.feature
  138. +94 −0 vendor/gems/paperclip/features/migration.feature
  139. +63 −0 vendor/gems/paperclip/features/rake_tasks.feature
  140. +102 −0 vendor/gems/paperclip/features/step_definitions/attachment_steps.rb
  141. +15 −0 vendor/gems/paperclip/features/step_definitions/html_steps.rb
  142. +138 −0 vendor/gems/paperclip/features/step_definitions/rails_steps.rb
  143. +14 −0 vendor/gems/paperclip/features/step_definitions/s3_steps.rb
  144. +209 −0 vendor/gems/paperclip/features/step_definitions/web_steps.rb
  145. +11 −0 vendor/gems/paperclip/features/support/env.rb
  146. +10 −0 vendor/gems/paperclip/features/support/fakeweb.rb
  147. +24 −0 vendor/gems/paperclip/features/support/file_helpers.rb
  148. +15 −0 vendor/gems/paperclip/features/support/fixtures/boot_config.txt
  149. +5 −0 vendor/gems/paperclip/features/support/fixtures/gemfile.txt
  150. +20 −0 vendor/gems/paperclip/features/support/fixtures/preinitializer.txt
  151. +28 −0 vendor/gems/paperclip/features/support/paths.rb
  152. +46 −0 vendor/gems/paperclip/features/support/rails.rb
  153. +19 −0 vendor/gems/paperclip/features/support/selectors.rb
  154. +11 −0 vendor/gems/paperclip/gemfiles/3.0.gemfile
  155. +11 −0 vendor/gems/paperclip/gemfiles/3.1.gemfile
  156. +11 −0 vendor/gems/paperclip/gemfiles/3.2.gemfile
  157. +8 −0 vendor/gems/paperclip/lib/generators/paperclip/USAGE
  158. +32 −0 vendor/gems/paperclip/lib/generators/paperclip/paperclip_generator.rb
  159. +15 −0 vendor/gems/paperclip/lib/generators/paperclip/templates/paperclip_migration.rb.erb
  160. +226 −0 vendor/gems/paperclip/lib/paperclip.rb
  161. +478 −0 vendor/gems/paperclip/lib/paperclip/attachment.rb
  162. +9 −0 vendor/gems/paperclip/lib/paperclip/attachment_options.rb
  163. +30 −0 vendor/gems/paperclip/lib/paperclip/callbacks.rb
  164. +67 −0 vendor/gems/paperclip/lib/paperclip/content_type_detector.rb
  165. +27 −0 vendor/gems/paperclip/lib/paperclip/errors.rb
  166. +155 −0 vendor/gems/paperclip/lib/paperclip/geometry.rb
  167. +18 −0 vendor/gems/paperclip/lib/paperclip/glue.rb
  168. +59 −0 vendor/gems/paperclip/lib/paperclip/helpers.rb
  169. +35 −0 vendor/gems/paperclip/lib/paperclip/instance_methods.rb
  170. +180 −0 vendor/gems/paperclip/lib/paperclip/interpolations.rb
  171. +31 −0 vendor/gems/paperclip/lib/paperclip/io_adapters/abstract_adapter.rb
  172. +36 −0 vendor/gems/paperclip/lib/paperclip/io_adapters/attachment_adapter.rb
  173. +22 −0 vendor/gems/paperclip/lib/paperclip/io_adapters/file_adapter.rb
  174. +12 −0 vendor/gems/paperclip/lib/paperclip/io_adapters/identity_adapter.rb
  175. +34 −0 vendor/gems/paperclip/lib/paperclip/io_adapters/nil_adapter.rb
  176. +32 −0 vendor/gems/paperclip/lib/paperclip/io_adapters/registry.rb
  177. +36 −0 vendor/gems/paperclip/lib/paperclip/io_adapters/stringio_adapter.rb
  178. +26 −0 vendor/gems/paperclip/lib/paperclip/io_adapters/uploaded_file_adapter.rb
  179. +42 −0 vendor/gems/paperclip/lib/paperclip/io_adapters/uri_adapter.rb
  180. +17 −0 vendor/gems/paperclip/lib/paperclip/locales/en.yml
  181. +21 −0 vendor/gems/paperclip/lib/paperclip/logger.rb
  182. +64 −0 vendor/gems/paperclip/lib/paperclip/matchers.rb
  183. +57 −0 vendor/gems/paperclip/lib/paperclip/matchers/have_attached_file_matcher.rb
  184. +100 −0 vendor/gems/paperclip/lib/paperclip/matchers/validate_attachment_content_type_matcher.rb
  185. +54 −0 vendor/gems/paperclip/lib/paperclip/matchers/validate_attachment_presence_matcher.rb
  186. +95 −0 vendor/gems/paperclip/lib/paperclip/matchers/validate_attachment_size_matcher.rb
  187. +84 −0 vendor/gems/paperclip/lib/paperclip/missing_attachment_styles.rb
  188. +85 −0 vendor/gems/paperclip/lib/paperclip/processor.rb
  189. +31 −0 vendor/gems/paperclip/lib/paperclip/railtie.rb
  190. +75 −0 vendor/gems/paperclip/lib/paperclip/schema.rb
  191. +3 −0 vendor/gems/paperclip/lib/paperclip/storage.rb
  192. +77 −0 vendor/gems/paperclip/lib/paperclip/storage/filesystem.rb
  193. +200 −0 vendor/gems/paperclip/lib/paperclip/storage/fog.rb
  194. +366 −0 vendor/gems/paperclip/lib/paperclip/storage/s3.rb
  195. +103 −0 vendor/gems/paperclip/lib/paperclip/style.rb
  196. +43 −0 vendor/gems/paperclip/lib/paperclip/tempfile.rb
  197. +21 −0 vendor/gems/paperclip/lib/paperclip/tempfile_factory.rb
  198. +113 −0 vendor/gems/paperclip/lib/paperclip/thumbnail.rb
  199. +64 −0 vendor/gems/paperclip/lib/paperclip/url_generator.rb
  200. +46 −0 vendor/gems/paperclip/lib/paperclip/validators.rb
  201. +54 −0 vendor/gems/paperclip/lib/paperclip/validators/attachment_content_type_validator.rb
  202. +26 −0 vendor/gems/paperclip/lib/paperclip/validators/attachment_presence_validator.rb
  203. +102 −0 vendor/gems/paperclip/lib/paperclip/validators/attachment_size_validator.rb
  204. +3 −0 vendor/gems/paperclip/lib/paperclip/version.rb
  205. +93 −0 vendor/gems/paperclip/lib/tasks/paperclip.rake
  206. +53 −0 vendor/gems/paperclip/paperclip.gemspec
  207. +124 −0 vendor/gems/paperclip/shoulda_macros/paperclip.rb
  208. +27 −0 vendor/gems/paperclip/test/attachment_options_test.rb
  209. +1,277 −0 vendor/gems/paperclip/test/attachment_test.rb
  210. +40 −0 vendor/gems/paperclip/test/content_type_detector_test.rb
  211. +4 −0 vendor/gems/paperclip/test/database.yml
  212. BIN vendor/gems/paperclip/test/fixtures/12k.png
  213. BIN vendor/gems/paperclip/test/fixtures/50x50.png
  214. BIN vendor/gems/paperclip/test/fixtures/5k.png
  215. BIN vendor/gems/paperclip/test/fixtures/animated
  216. BIN vendor/gems/paperclip/test/fixtures/animated.gif
  217. BIN vendor/gems/paperclip/test/fixtures/animated.unknown
  218. +1 −0 vendor/gems/paperclip/test/fixtures/bad.png
  219. +8 −0 vendor/gems/paperclip/test/fixtures/fog.yml
  220. +8 −0 vendor/gems/paperclip/test/fixtures/s3.yml
  221. BIN vendor/gems/paperclip/test/fixtures/spaced file.png
  222. +1 −0 vendor/gems/paperclip/test/fixtures/text.txt
  223. BIN vendor/gems/paperclip/test/fixtures/twopage.pdf
  224. BIN vendor/gems/paperclip/test/fixtures/uppercase.PNG
  225. +80 −0 vendor/gems/paperclip/test/generator_test.rb
  226. +225 −0 vendor/gems/paperclip/test/geometry_test.rb
  227. +187 −0 vendor/gems/paperclip/test/helper.rb
  228. +677 −0 vendor/gems/paperclip/test/integration_test.rb
  229. +238 −0 vendor/gems/paperclip/test/interpolations_test.rb
  230. +43 −0 vendor/gems/paperclip/test/io_adapters/abstract_adapter_test.rb
  231. +113 −0 vendor/gems/paperclip/test/io_adapters/attachment_adapter_test.rb
  232. +100 −0 vendor/gems/paperclip/test/io_adapters/file_adapter_test.rb
  233. +8 −0 vendor/gems/paperclip/test/io_adapters/identity_adapter_test.rb
  234. +25 −0 vendor/gems/paperclip/test/io_adapters/nil_adapter_test.rb
  235. +32 −0 vendor/gems/paperclip/test/io_adapters/registry_test.rb
  236. +51 −0 vendor/gems/paperclip/test/io_adapters/stringio_adapter_test.rb
  237. +99 −0 vendor/gems/paperclip/test/io_adapters/uploaded_file_adapter_test.rb
  238. +82 −0 vendor/gems/paperclip/test/io_adapters/uri_adapter_test.rb
  239. +24 −0 vendor/gems/paperclip/test/matchers/have_attached_file_matcher_test.rb
  240. +110 −0 vendor/gems/paperclip/test/matchers/validate_attachment_content_type_matcher_test.rb
  241. +47 −0 vendor/gems/paperclip/test/matchers/validate_attachment_presence_matcher_test.rb
  242. +86 −0 vendor/gems/paperclip/test/matchers/validate_attachment_size_matcher_test.rb
  243. +94 −0 vendor/gems/paperclip/test/paperclip_missing_attachment_styles_test.rb
  244. +241 −0 vendor/gems/paperclip/test/paperclip_test.rb
  245. +26 −0 vendor/gems/paperclip/test/processor_test.rb
  246. +200 −0 vendor/gems/paperclip/test/schema_test.rb
  247. +71 −0 vendor/gems/paperclip/test/storage/filesystem_test.rb
  248. +353 −0 vendor/gems/paperclip/test/storage/fog_test.rb
  249. +179 −0 vendor/gems/paperclip/test/storage/s3_live_test.rb
  250. +1,196 −0 vendor/gems/paperclip/test/storage/s3_test.rb
  251. +209 −0 vendor/gems/paperclip/test/style_test.rb
  252. +22 −0 vendor/gems/paperclip/test/support/mock_attachment.rb
  253. +24 −0 vendor/gems/paperclip/test/support/mock_interpolator.rb
  254. +2 −0 vendor/gems/paperclip/test/support/mock_model.rb
  255. +27 −0 vendor/gems/paperclip/test/support/mock_url_generator_builder.rb
  256. +13 −0 vendor/gems/paperclip/test/tempfile_factory_test.rb
  257. +446 −0 vendor/gems/paperclip/test/thumbnail_test.rb
  258. +187 −0 vendor/gems/paperclip/test/url_generator_test.rb
  259. +192 −0 vendor/gems/paperclip/test/validators/attachment_content_type_validator_test.rb
  260. +85 −0 vendor/gems/paperclip/test/validators/attachment_presence_validator_test.rb
  261. +207 −0 vendor/gems/paperclip/test/validators/attachment_size_validator_test.rb
  262. +25 −0 vendor/gems/paperclip/test/validators_test.rb
View
11 vendor/gems/database_cleaner/.gitignore
@@ -0,0 +1,11 @@
+*.sw?
+.DS_Store
+coverage
+pkg
+.bundle
+bundled_gems/
+vendor/
+examples/db/*.db
+examples/config/database.yml
+db/config.yml
+.vagrant
View
1 vendor/gems/database_cleaner/.rbenv-version
@@ -0,0 +1 @@
+1.8.7-p249
View
4 vendor/gems/database_cleaner/.rspec
@@ -0,0 +1,4 @@
+--color
+--format documentation
+mtime
+--backtrace
View
1 vendor/gems/database_cleaner/.rvmrc
@@ -0,0 +1 @@
+rvm 1.8.7
View
13 vendor/gems/database_cleaner/.travis.yml
@@ -0,0 +1,13 @@
+language: ruby
+rvm:
+ - 1.8.7
+# TODO: fix ruby 1.9x build issues...
+# - 1.9.3
+# TODO: make this work with the regular rake command
+script: "bundle exec rake spec"
+gemfile:
+ - Gemfile
+before_script:
+ - mysql -e 'create database database_cleaner_test;'
+ - psql -c 'create database database_cleaner_test;' -U postgres
+ - cp db/sample.config.yml db/config.yml
View
43 vendor/gems/database_cleaner/Gemfile
@@ -0,0 +1,43 @@
+source "http://rubygems.org"
+# TODO: move these to the gemspec...
+
+group :development do
+ gem "rake"
+ gem "ruby-debug"
+
+ gem "bundler"
+ gem "jeweler"
+
+ gem "json_pure"
+
+ #ORM's
+ gem "activerecord"
+ gem "datamapper", "1.0.0"
+ gem "dm-migrations", "1.0.0"
+ gem "dm-sqlite-adapter", "1.0.0"
+ gem "mongoid"
+ gem "tzinfo"
+ gem "mongo_ext"
+ gem "bson_ext"
+ gem "mongo_mapper"
+ gem "couch_potato"
+ gem "sequel", "~>3.21.0"
+ #gem "ibm_db" # I don't want to add this dependency, even as a dev one since it requires DB2 to be installed
+ gem 'mysql'
+ gem 'mysql2'
+ gem 'pg'
+
+ gem 'guard-rspec'
+end
+
+group :test do
+ gem "rspec-rails"
+ gem "rspactor"
+ gem "rcov"
+ gem "ZenTest"
+end
+
+group :cucumber do
+ gem "cucumber"
+ gem 'sqlite3-ruby'
+end
View
231 vendor/gems/database_cleaner/Gemfile.lock
@@ -0,0 +1,231 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ ZenTest (4.8.1)
+ actionpack (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.3)
+ activemodel (3.2.6)
+ activesupport (= 3.2.6)
+ builder (~> 3.0.0)
+ activerecord (3.2.6)
+ activemodel (= 3.2.6)
+ activesupport (= 3.2.6)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activesupport (3.2.6)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ addressable (2.2.8)
+ arel (3.0.2)
+ bson (1.6.4)
+ bson_ext (1.6.4)
+ bson (~> 1.6.4)
+ builder (3.0.0)
+ columnize (0.3.6)
+ couch_potato (0.5.7)
+ activemodel
+ couchrest (>= 1.0.1)
+ json
+ couchrest (1.0.1)
+ json (>= 1.4.6)
+ mime-types (>= 1.15)
+ rest-client (>= 1.5.1)
+ cucumber (1.2.1)
+ builder (>= 2.1.2)
+ diff-lcs (>= 1.1.3)
+ gherkin (~> 2.11.0)
+ json (>= 1.4.6)
+ data_objects (0.10.8)
+ addressable (~> 2.1)
+ datamapper (1.0.0)
+ dm-aggregates (= 1.0.0)
+ dm-constraints (= 1.0.0)
+ dm-core (= 1.0.0)
+ dm-core (= 1.0.0)
+ dm-migrations (= 1.0.0)
+ dm-serializer (= 1.0.0)
+ dm-timestamps (= 1.0.0)
+ dm-transactions (= 1.0.0)
+ dm-types (= 1.0.0)
+ dm-validations (= 1.0.0)
+ diff-lcs (1.1.3)
+ dm-aggregates (1.0.0)
+ dm-core (~> 1.0.0)
+ dm-constraints (1.0.0)
+ dm-core (~> 1.0.0)
+ dm-migrations (~> 1.0.0)
+ dm-core (1.0.0)
+ addressable (~> 2.1)
+ extlib (~> 0.9.15)
+ dm-do-adapter (1.0.0)
+ data_objects (~> 0.10.1)
+ dm-core (~> 1.0.0)
+ dm-migrations (1.0.0)
+ dm-core (~> 1.0.0)
+ dm-serializer (1.0.0)
+ dm-core (~> 1.0.0)
+ fastercsv (~> 1.5.3)
+ json_pure (~> 1.4.3)
+ dm-sqlite-adapter (1.0.0)
+ dm-do-adapter (~> 1.0.0)
+ do_sqlite3 (~> 0.10.2)
+ dm-timestamps (1.0.0)
+ dm-core (~> 1.0.0)
+ dm-transactions (1.0.0)
+ dm-core (~> 1.0.0)
+ dm-types (1.0.0)
+ dm-core (~> 1.0.0)
+ fastercsv (~> 1.5.3)
+ json_pure (~> 1.4.3)
+ stringex (~> 1.1.0)
+ uuidtools (~> 2.1.1)
+ dm-validations (1.0.0)
+ dm-core (~> 1.0.0)
+ do_sqlite3 (0.10.8)
+ data_objects (= 0.10.8)
+ erubis (2.7.0)
+ extlib (0.9.15)
+ fastercsv (1.5.5)
+ ffi (1.1.4)
+ gherkin (2.11.1)
+ json (>= 1.4.6)
+ git (1.2.5)
+ guard (1.3.0)
+ listen (>= 0.4.2)
+ thor (>= 0.14.6)
+ guard-rspec (1.2.1)
+ guard (>= 1.1)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jeweler (1.8.4)
+ bundler (~> 1.0)
+ git (>= 1.2.5)
+ rake
+ rdoc
+ journey (1.0.4)
+ json (1.7.3)
+ json_pure (1.4.6)
+ linecache (0.46)
+ rbx-require-relative (> 0.0.4)
+ listen (0.4.7)
+ rb-fchange (~> 0.0.5)
+ rb-fsevent (~> 0.9.1)
+ rb-inotify (~> 0.8.8)
+ mime-types (1.19)
+ mongo (1.6.4)
+ bson (~> 1.6.4)
+ mongo_ext (0.19.3)
+ mongo_mapper (0.11.1)
+ activemodel (~> 3.0)
+ activesupport (~> 3.0)
+ plucky (~> 0.4.0)
+ mongoid (3.0.1)
+ activemodel (~> 3.1)
+ moped (~> 1.1.1)
+ origin (~> 1.0.3)
+ tzinfo (~> 0.3.22)
+ moped (1.1.2)
+ multi_json (1.3.6)
+ mysql (2.8.1)
+ mysql2 (0.3.11)
+ origin (1.0.4)
+ pg (0.14.0)
+ plucky (0.4.4)
+ mongo (~> 1.5)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ railties (3.2.6)
+ actionpack (= 3.2.6)
+ activesupport (= 3.2.6)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (0.9.2.2)
+ rb-fchange (0.0.5)
+ ffi
+ rb-fsevent (0.9.1)
+ rb-inotify (0.8.8)
+ ffi (>= 0.5.0)
+ rbx-require-relative (0.0.9)
+ rcov (1.0.0)
+ rdoc (3.12)
+ json (~> 1.4)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ rspactor (0.6.4)
+ rspec (2.11.0)
+ rspec-core (~> 2.11.0)
+ rspec-expectations (~> 2.11.0)
+ rspec-mocks (~> 2.11.0)
+ rspec-core (2.11.1)
+ rspec-expectations (2.11.1)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.11.1)
+ rspec-rails (2.11.0)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.11.0)
+ ruby-debug (0.10.4)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
+ linecache (>= 0.3)
+ sequel (3.21.0)
+ sprockets (2.1.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
+ sqlite3-ruby (1.3.3)
+ sqlite3 (>= 1.3.3)
+ stringex (1.1.0)
+ thor (0.15.4)
+ tilt (1.3.3)
+ tzinfo (0.3.33)
+ uuidtools (2.1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ ZenTest
+ activerecord
+ bson_ext
+ bundler
+ couch_potato
+ cucumber
+ datamapper (= 1.0.0)
+ dm-migrations (= 1.0.0)
+ dm-sqlite-adapter (= 1.0.0)
+ guard-rspec
+ jeweler
+ json_pure
+ mongo_ext
+ mongo_mapper
+ mongoid
+ mysql
+ mysql2
+ pg
+ rake
+ rcov
+ rspactor
+ rspec-rails
+ ruby-debug
+ sequel (~> 3.21.0)
+ sqlite3-ruby
+ tzinfo
View
9 vendor/gems/database_cleaner/Guardfile
@@ -0,0 +1,9 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+guard 'rspec', :version => 2 do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+end
+
View
221 vendor/gems/database_cleaner/History.txt
@@ -0,0 +1,221 @@
+== 0.8.x (in git)
+
+ * New options for AR :truncation for speed. See README for details. (Stanislaw Pankevich)
+ * view caching works with the schema_plus gem loaded
+ * ActiveRecord::ConnectionAdapters::AbstractAdapter#views was renamed to an internal name
+ * ActiveRecord truncation strategy caches the list of tables #130 (Petteri Räty)
+
+== 0.8.0 2012-06-02
+
+ * Faster truncation strategy for ActiveRecord with MySQL or PostgreSQL
+ * Upgrade to RSpec 2
+ * Support for Mongoid 3/Moped (Andrew Bennett)
+ * Postgres Adapter no longer generates invalid SQL when no tables provided. (Michael-Keith Bernard)
+
+== 0.7.2 2012-03-21
+
+ * Proper Mysql2Adapter superclass fix. (Jonathan Viney)
+ * Sequel::Transaction works with latest Sequel. (David Barri)
+ * Documenation fixes/improvements. (David Barri, Ben Mabey, Kevin Moore)
+
+== 0.7.1 2012-01-15
+
+ === New Features
+
+ * Support for Rails 3.2. (David Demaree)
+
+=== Bugfixes
+
+ * Truncation resets the id count on SQLite. (Jordan Hollinger)
+ * AR delete strategy now disables referential integrity. (Ben Mabey)
+ * Fixes Postgres adapter for JRuby. (Dmytrii Nagirniak, Uģis Ozols)
+ * Documenation fixes. (Josh Rendek, Joshua Flanagan)
+ * Fixes bad error message when no database is specified for AR. (issue #72, Ben Mabey)
+
+
+== 0.7.0 2011-11-12
+
+ === New Features
+
+ * Sequel Support (Corin Langosch)
+ * Updates DataMapper strategies to work with DataMapper 1.1 (Xavier Shay and Anthony Williams)
+ * for AR and PSQL, truncate all tables with one command, improving performance due to avoiding cascades (Leonid Shevtsov)
+
+=== Bugfixes
+
+ * Avoids trying to load the ':default' ActiveRecord config. #72 (Ben Mabey)
+
+
+== 0.6.7 2011-04-21
+
+=== Bugfixes
+ * Explicity require ERB. (Vít Ondruch)
+ * Cache DB connections, fixes referential integrity bug when using multiple DBs. (John Ferlito)
+
+== 0.6.6 2011-03-16
+
+=== Bugfixes
+ * Don't modify the array passed in with the :except key. (Eric Wollesen)
+ * Fixes version checking for postgresql. (Greg Barnett)
+
+== 0.6.5 2011-03-08
+
+=== Bugfixes
+ * When truncating in postgresql (>= 8.4) sequences are now reset. (Greg Barnett)
+ * Fixes the MongoDB truncation so non system collections starting with 'system' are not excluded for truncation. (Dmitry Naumov)
+
+== 0.6.4 2011-02-21
+
+=== Bugfixes
+ * Avoids trying to drop views in Postgres. (Bernerd Schaefer)
+
+== 0.6.3 2011-02-09
+
+ === New Features
+ * Configurable logger to aid in debugging database cleaner. (Marty Haught)
+
+== 0.6.2 2011-02-04
+
+ === New Features
+ * Support IBM_DB Adapter for table truncation. This is for DB2 >= 9.7 (GH-39 Samer Abukhait)
+
+ === Bugfixes
+ * Reversed GH-41 after larger community discussion. Mongo indexes are no longer dropped. (Ben Mabey)
+ * Truncation strategy works on SqlServer tables with FKs. (GH-33, Hugo Freire)
+
+== 0.6.1 2011-01-27
+
+ === New Features
+ * Default strategies for all ORM libs are defined. (GH-36, GH-38 Prem Sichanugrist)
+ * Add a NullStrategy. (GH-6 Ben Mabey)
+
+ === Bugfixes
+ * Mongo colletion indexes are dropped for collections being removed. (GH-41 Ben Mabey)
+ * Exclude database views from tables_to_truncate, if the connection adapter
+ supports reading from the ANSI standard information_schema views. (GH-25 Samer Abukhait)
+ * ORM types can be specified in string format and not mysteriously blowup. (GH-26 Ben Mabey)
+ * Do not remove MongoDB reserved system collections. (GH-24 Ches Martin)
+
+== 0.6.0 2010-10-25 - The Multi-ORM/Connection Release
+
+This release has the often asked for functionality of being able to clean
+multiple databases within the same project. This involves being able to
+clean databases managed by the same ORM (i.e. different connections) and
+also being able to clean databases managed by distinct ORMs. So, for
+example you can now use DatabaseCleaner on a project that has ActiveRecord
+and Mongoid to help ensure all DBs all in a clean state. Please see the
+README for more information. The old API has been preserved so this release
+is backwards compatible.
+
+This release is a result of Jon Rowe's hard work. Many thanks to Jon for all
+of the hours and effort he put into making this feature request a reality.
+
+ === New Features
+ * Ability to clean multiple database connections managed by the same ORM. (Jon Rowe)
+ * Ability to clean multiple DBs managed by different ORMs in same project. (Jon Rowe)
+ * Allows for the ActiveRecord config file (database.yml) to contain ERB and process it. (Fletcher Nichol)
+ * Mysql2Adapter support. (Kamal Fariz Mahyuddin and John Ferlito)
+ * Deletion strategy for ActiveRecord (Mikl Kurkov)
+
+ === Bugfixes
+ * Updates the DataMapper truncation strategy to version 0.10.3. (Robert Rouse)
+ * Addresses Ruby 1.9 and 1.8 differences causing a bug in the AR PostgreSQLAdapter truncation strategy. (GH-14, James B. Byrne)
+ * Fixes syntax error that MySQL was throwing during DataMapper truncation. (Blake Gentry)
+ * Fixes truncation for PostgreSQL (Bodaniel Jeanes and Gabriel Sobrinho)
+ * Workaround for superclass mismatches for the ActiveRecord-jdbc-adapter (Toms Mikoss)
+
+== 0.5.2
+
+ === Bugfixes
+ * Removes extraneous puts call from configuration.rb. (Ben Mabey)
+
+== 0.5.1 - The Mongoid Release
+
+This release also attempts to fix AR for Rails 3 support. I have seen mixed reviews on this. Some people
+claim the fixes allow for use in Rails3 while others have not had good luck with it. I plan on reworking
+the way AR support is added so that it is more friendly with how Rails 3 uses autoload.
+
+ === New features
+ * Clean and clean_with methods are now aliased to clean! and clean_with!. (Ben Mabey)
+ * Mongoid Support! (Sidney Burks)
+
+=== Bugfixes
+ * Check PostgreSQL version >= 8.2 before using TRUNCATE CASCADE (James B. Byrne)
+ * Correct superclass is used in ActiveRecord connection adapters. (johnathan, Aslak Hellesoy, Ben Mabey)
+
+== 0.5.0 2010-02-22 - The CouchPotato Release
+
+ === New features
+ * Basic truncation support for CouchPotato / CouchDB. (Martin Rehfeld)
+ * SQLite3 on JRuby will fall back to delete if truncate doesn't work. (Darrin Holst)
+ * JDBC is used for ActiveRecord automaticaly when JRuby is detected. (Darrin Holst)
+
+ === Bufixes
+ * MongoMapper truncation strategy now works with :only and :except options. (Ben Mabey)
+
+== 0.4.3 2010-01-17
+
+ === New features
+ * Truncation for ActiveRecord oracle_enhanced adapter. (Edgars Beigarts)
+
+== 0.4.2 2010-01-12
+
+ === Bufixes
+ * Datamapper truncation now uses 'select' instead of deprecated the 'query' method. (Steve Tooke)
+
+== 0.4.1 2010-01-07
+
+ === Bufixes
+ * Postgres tables with FKs now truncate (added TRUNCADE CASCADE) using Datamapper. (Ben Mabey)
+
+== 0.4.0 2009-12-23 (The MongoMapper Edition)
+
+ === New features
+ * MongoMapper support for the truncation strategy. (Aubrey Holland)
+
+== 0.3.0 2009-12-20
+
+ === New features
+ * DataMapper 0.10.0 Compatible. (Martin Gamsjaeger)
+ === Bufixes
+ * Postgres tables with FKs now truncate (added TRUNCADE CASCADE). (Vika - yozhyk on github)
+
+== 0.2.3 2009-05-30
+
+ === New features
+ * Support for SQL Server truncation (Adam Meehan)
+
+== 0.2.2 2009-05-08
+ === Bufixes
+ * Added proper gemspec description and summary. (Ben Mabey, thanks to Martin Gamsjaeger)
+
+ === New features
+
+== 0.2.1 2009-05-08
+ === Bufixes
+ * Removed extraneous TruncationBase class definition. (Ben Mabey)
+
+== 0.2.0 2009-05-08 - The Datamapper Release
+
+ === New features
+ * DataMapper strategies (Martin Gamsjaeger)
+ * Transaction
+ * Truncation - working SQLite3, MySQL adapters. Experimental Postgres adapter (not tested).
+
+== 0.1.3 2009-04-30
+
+ === New features
+ * PostgresSQLAdapter for AR to support the truncation strategy. (Alberto Perdomo)
+ === Bufixes
+ * Added missing quotes around table names in truncation calls. (Michael MacDonald)
+
+== 0.1.2 2009-03-05
+ === New features
+ * JDBC Adapter to enable AR truncation strategy to work. (Kamal Fariz Mahyuddin)
+
+== 0.1.1 2009-03-04 - Initial Release (Ben Mabey)
+ * Basic infrastructure
+ * Features, RSpec code examples
+ * ActiveRecord strategies
+ * Truncation - with MySQL, and SQLite3 adapters.
+ * Transaction - wrap your modifications and roll them back.
View
20 vendor/gems/database_cleaner/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2009 Ben Mabey
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
245 vendor/gems/database_cleaner/README.textile
@@ -0,0 +1,245 @@
+h1. Database Cleaner
+
+Database Cleaner is a set of strategies for cleaning your database in Ruby.
+The original use case was to ensure a clean state during tests. Each strategy
+is a small amount of code but is code that is usually needed in any ruby app
+that is testing with a database.
+
+ActiveRecord, DataMapper, Sequel, MongoMapper, Mongoid, and CouchPotato are supported.
+
+!https://secure.travis-ci.org/bmabey/database_cleaner.png(Build Status)!:http://travis-ci.org/bmabey/database_cleaner
+
+Here is an overview of the strategies supported for each library:
+
+|_. ORM |_. Truncation |_. Transaction |_. Deletion |
+| ActiveRecord | Yes | **Yes** | Yes |
+| DataMapper | Yes | **Yes** | No |
+| CouchPotato | **Yes** | No | No |
+| MongoMapper | **Yes** | No | No |
+| Mongoid | **Yes** | No | No |
+| Sequel | **Yes** | Yes | No |
+
+(Default strategy for each library is denoted in bold)
+
+Database Cleaner also includes a @null@ strategy (that does no cleaning at all) which can be used
+with any ORM library. You can also explicitly use it by setting your strategy to @nil@.
+
+For support or to discuss development please use the "Google Group":http://groups.google.com/group/database_cleaner.
+
+h2(fastest). What strategy is fastest?
+
+For the SQL libraries the fastest option will be to use @:transaction@ as transactions are
+simply rolled back. If you can use this strategy you should. However, if you wind up needing
+to use multiple database connections in your tests (i.e. your tests run in a different proceess
+than your application) then using this strategy becomes a bit more difficult. You can get around the
+problem a number of ways. One common approach is to force all processes to use the same database
+connection ("common ActiveRecord hack":http://blog.plataformatec.com.br/2011/12/three-tips-to-improve-the-performance-of-your-test-suite/) however this approach has been reported to result in
+non-deterministic failures. Another approach is to have the transactions rolled back in the
+application's process and relax the isolation level of the database (so the tests can read the
+uncommited transactions). An easier, but slower, solution is to use the @:truncation@ or
+@:deletion@ strategy.
+
+So what is fastest out of @:deletion@ and @:truncation@? Well, it depends on your table structure
+and what percentage of tables you populate in an average test. The reasoning is out the the
+scope of this README but here is a "good SO answer on this topic for Postgres":http://stackoverflow.com/questions/11419536/postgresql-truncation-speed/11423886#11423886. Some people report
+much faster speeds with @:deletion@ while others say @:truncation@ is faster for them. The best approach therefore
+is it try all options on your test suite and see what is faster. If you are using ActiveRecord then take a look
+at the "additional options":#ar_truncation available for @:truncation@.
+
+h2. Dependencies
+
+Because database_cleaner supports multiple ORMs, it doesn't make sense to include all the dependencies
+for each one in the gemspec. However, the DataMapper adapter does depend on dm-transactions. Therefore,
+if you use DataMapper, you must include dm-transactions in your Gemfile/bundle/gemset manually.
+
+h2. How to use
+
+<pre>
+ require 'database_cleaner'
+ DatabaseCleaner.strategy = :truncation
+
+ # then, whenever you need to clean the DB
+ DatabaseCleaner.clean
+</pre>
+
+With the :truncation strategy you can also pass in options, for example:
+<pre>
+ DatabaseCleaner.strategy = :truncation, {:only => %w[widgets dogs some_other_table]}
+</pre>
+
+<pre>
+ DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
+</pre>
+
+(I should point out the truncation strategy will never truncate your schema_migrations table.)
+
+Some strategies require that you call DatabaseCleaner.start before calling clean
+(for example the :transaction one needs to know to open up a transaction). So
+you would have:
+
+<pre>
+ require 'database_cleaner'
+ DatabaseCleaner.strategy = :transaction
+
+ DatabaseCleaner.start # usually this is called in setup of a test
+ dirty_the_db
+ DatabaseCleaner.clean # cleanup of the test
+</pre>
+
+At times you may want to do a single clean with one strategy. For example, you may want
+to start the process by truncating all the tables, but then use the faster transaction
+strategy the remaining time. To accomplish this you can say:
+
+<pre>
+ require 'database_cleaner'
+ DatabaseCleaner.clean_with :truncation
+ DatabaseCleaner.strategy = :transaction
+ # then make the DatabaseCleaner.start and DatabaseCleaner.clean calls appropriately
+</pre>
+
+h3(#ar_truncation). Additional ActiveRecord options for Truncation
+
+The following options are available for ActiveRecord's @:truncation@ strategy _only_ for
+MySQL and Postgres.
+
+* @:pre_count@ - When set to @true@ this will check each table for existing rows before
+truncating it. This can speed up test suites when many of the tables to be truncated
+are never populated. Defaults to @:false@. (Also, see the section on "What strategy is fastest?":#fastest)
+* @:reset_ids@ - This only matters when @:pre_count@ is used, and it will make sure that a
+tables auto-incrementing id is reset even if there are no rows in the table (e.g. records
+were created in the test but also removed before DatabaseCleaner gets to it). Defaults to @true@.
+
+
+h3. RSpec Example
+
+<pre>
+RSpec.configure do |config|
+
+ config.before(:suite) do
+ DatabaseCleaner.strategy = :transaction
+ DatabaseCleaner.clean_with(:truncation)
+ end
+
+ config.before(:each) do
+ DatabaseCleaner.start
+ end
+
+ config.after(:each) do
+ DatabaseCleaner.clean
+ end
+
+end
+</pre>
+
+h3. Minitest Example
+
+<pre>
+DatabaseCleaner.strategy = :transaction
+
+class MiniTest::Spec
+ before :each do
+ DatabaseCleaner.start
+ end
+
+ after :each do
+ DatabaseCleaner.clean
+ end
+end
+</pre>
+
+h3. Cucumber Example
+
+Add this to your features/support/env.rb file:
+
+<pre>
+begin
+ require 'database_cleaner'
+ require 'database_cleaner/cucumber'
+ DatabaseCleaner.strategy = :truncation
+rescue NameError
+ raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
+end
+</pre>
+
+A good idea is to create the before and after hooks to use the DatabaseCleaner.start and DatabaseCleaner.clean methods.
+
+Inside features/support/hooks.rb:
+
+<pre>
+Before do
+ DatabaseCleaner.start
+end
+
+After do |scenario|
+ DatabaseCleaner.clean
+end
+</pre>
+
+This should cover the basics of tear down between scenarios and keeping your database clean.
+For more examples see the section "Why?"
+
+h2. How to use with multiple ORM's
+
+Sometimes you need to use multiple ORMs in your application. You can use DatabaseCleaner to clean multiple ORMs, and multiple connections for those ORMs.
+
+<pre>
+ #How to specify particular orms
+ DatabaseCleaner[:active_record].strategy = :transaction
+ DatabaseCleaner[:mongo_mapper].strategy = :truncation
+
+ #How to specify particular connections
+ DatabaseCleaner[:active_record,{:connection => :two}]
+</pre>
+
+Usage beyond that remains the same with DatabaseCleaner.start calling any setup on the different configured connections, and DatabaseCleaner.clean executing afterwards.
+
+Configuration options
+
+
+|_. ORM |_. How to access |_. Notes |
+| Active Record | DatabaseCleaner[:active_record] | Connection specified as :symbol keys, loaded from config/database.yml |
+| Data Mapper | DatabaseCleaner[:data_mapper] | Connection specified as :symbol keys, loaded via Datamapper repositories |
+| Mongo Mapper | DatabaseCleaner[:mongo_mapper] | Multiple connections not yet supported |
+| Mongoid | DatabaseCleaner[:mongoid] | Multiple connections not yet supported |
+| Couch Potato | DatabaseCleaner[:couch_potato] | Multiple connections not yet supported |
+| Sequel | DatabaseCleaner[:sequel] | ? |
+
+h2. Why?
+
+One of my motivations for writing this library was to have an easy way to turn on what Rails calls "transactional_fixtures"
+in my non-rails ActiveRecord projects. After copying and pasting code to do this several times I decided to package it up
+as a gem and same everyone a bit of time.
+
+h2. Common Errors
+
+h4. DatabaseCleaner is trying to use the wrong ORM
+
+DatabaseCleaner has an autodetect mechanism where if you do not explicitly define your ORM it will use the first ORM it can detect that is loaded. Since ActiveRecord is the most common ORM used that is the first one checked for. Sometimes other libraries (e.g. ActiveAdmin) will load other ORMs (e.g. ActiveRecord) even though you are using a different ORM. This will result in DatabaseCleaner trying to use the wrong ORM (e.g. ActiveRecord) unless you explicitly define your ORM like so:
+
+<pre>
+ # How to setup your ORM explicitly
+ DatabaseCleaner[:mongoid].strategy = :truncation
+</pre>
+
+h4. STDERR is being flooded when using Postgres
+
+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:
+
+<pre>
+ client_min_messages = warning
+</pre>
+
+
+h2. Debugging
+
+In rare cases DatabaseCleaner will encounter errors that it will log. By default it uses STDOUT set to the ERROR level but you can configure this to use whatever Logger you desire. Here's an example of using the Rails.logger in env.rb:
+
+<pre>
+ DatabaseCleaner.logger = Rails.logger
+</pre>
+
+
+h2. COPYRIGHT
+
+Copyright (c) 2009 Ben Mabey. See LICENSE for details.
View
55 vendor/gems/database_cleaner/Rakefile
@@ -0,0 +1,55 @@
+require "rubygems"
+require "bundler"
+Bundler.setup
+
+require 'rake'
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |s|
+ s.name = "database_cleaner"
+ s.summary = %Q{Strategies for cleaning databases. Can be used to ensure a clean state for testing.}
+ s.email = "ben@benmabey.com"
+ s.homepage = "http://github.com/bmabey/database_cleaner"
+ s.description = "Strategies for cleaning databases. Can be used to ensure a clean state for testing."
+ s.files = FileList["[A-Z]*.*", "{examples,lib,features,spec}/**/*", "Rakefile", "cucumber.yml"]
+ s.authors = ["Ben Mabey"]
+ end
+rescue LoadError
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
+end
+
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = FileList['spec/**/*_spec.rb']
+end
+
+RSpec::Core::RakeTask.new(:rcov) do |spec|
+ spec.pattern = 'spec/**/*_spec.rb'
+ spec.rcov = true
+end
+
+begin
+ require 'cucumber/rake/task'
+ Cucumber::Rake::Task.new(:features)
+rescue LoadError
+ puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
+end
+
+task :default => [:spec, :features]
+
+
+desc "Cleans the project of any tmp file that should not be included in the gemspec."
+task :clean do
+ ["examples/config/database.yml", "examples/db/activerecord_one.db", "examples/db/activerecord_two.db", "examples/db/datamapper_default.db",
+ "examples/db/datamapper_one.db", "examples/db/datamapper_two.db"].each do |f|
+ FileUtils.rm_f(f)
+ end
+ %w[*.sqlite3 *.log #* *.swp *.swo].each do |pattern|
+ `find . -name "#{pattern}" -delete`
+ end
+end
+
+desc "Cleans the dir and builds the gem"
+task :prep => [:clean, :gemspec, :build]
View
3 vendor/gems/database_cleaner/TODO
@@ -0,0 +1,3 @@
+Could be more Datamapper
+MongoMapper multiple db support
+CouchDB multiple db support
View
5 vendor/gems/database_cleaner/VERSION.yml
@@ -0,0 +1,5 @@
+---
+:major: 0
+:build:
+:minor: 8
+:patch: 0
View
1 vendor/gems/database_cleaner/cucumber.yml
@@ -0,0 +1 @@
+default: features
View
149 vendor/gems/database_cleaner/database_cleaner.gemspec
@@ -0,0 +1,149 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{database_cleaner}
+ s.version = "0.8.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Ben Mabey"]
+ s.date = %q{2012-06-02}
+ s.description = %q{Strategies for cleaning databases. Can be used to ensure a clean state for testing.}
+ s.email = %q{ben@benmabey.com}
+ s.extra_rdoc_files = [
+ "LICENSE",
+ "README.textile",
+ "TODO"
+ ]
+ s.files = [
+ "Gemfile.lock",
+ "History.txt",
+ "README.textile",
+ "Rakefile",
+ "VERSION.yml",
+ "cucumber.yml",
+ "examples/Gemfile",
+ "examples/Gemfile.lock",
+ "examples/config/database.yml.example",
+ "examples/db/sqlite_databases_go_here",
+ "examples/features/example.feature",
+ "examples/features/example_multiple_db.feature",
+ "examples/features/example_multiple_orm.feature",
+ "examples/features/step_definitions/activerecord_steps.rb",
+ "examples/features/step_definitions/couchpotato_steps.rb",
+ "examples/features/step_definitions/datamapper_steps.rb",
+ "examples/features/step_definitions/mongoid_steps.rb",
+ "examples/features/step_definitions/mongomapper_steps.rb",
+ "examples/features/step_definitions/translation_steps.rb",
+ "examples/features/support/env.rb",
+ "examples/lib/activerecord_models.rb",
+ "examples/lib/couchpotato_models.rb",
+ "examples/lib/datamapper_models.rb",
+ "examples/lib/mongoid_models.rb",
+ "examples/lib/mongomapper_models.rb",
+ "features/cleaning.feature",
+ "features/cleaning_default_strategy.feature",
+ "features/cleaning_multiple_dbs.feature",
+ "features/cleaning_multiple_orms.feature",
+ "features/step_definitions/database_cleaner_steps.rb",
+ "features/support/env.rb",
+ "features/support/feature_runner.rb",
+ "lib/database_cleaner.rb",
+ "lib/database_cleaner/active_record/base.rb",
+ "lib/database_cleaner/active_record/deletion.rb",
+ "lib/database_cleaner/active_record/transaction.rb",
+ "lib/database_cleaner/active_record/truncation.rb",
+ "lib/database_cleaner/base.rb",
+ "lib/database_cleaner/configuration.rb",
+ "lib/database_cleaner/couch_potato/base.rb",
+ "lib/database_cleaner/couch_potato/truncation.rb",
+ "lib/database_cleaner/cucumber.rb",
+ "lib/database_cleaner/data_mapper/base.rb",
+ "lib/database_cleaner/data_mapper/transaction.rb",
+ "lib/database_cleaner/data_mapper/truncation.rb",
+ "lib/database_cleaner/generic/base.rb",
+ "lib/database_cleaner/generic/transaction.rb",
+ "lib/database_cleaner/generic/truncation.rb",
+ "lib/database_cleaner/mongo/truncation.rb",
+ "lib/database_cleaner/mongo_mapper/base.rb",
+ "lib/database_cleaner/mongo_mapper/truncation.rb",
+ "lib/database_cleaner/mongoid/base.rb",
+ "lib/database_cleaner/mongoid/truncation.rb",
+ "lib/database_cleaner/moped/truncation.rb",
+ "lib/database_cleaner/null_strategy.rb",
+ "lib/database_cleaner/sequel/base.rb",
+ "lib/database_cleaner/sequel/transaction.rb",
+ "lib/database_cleaner/sequel/truncation.rb",
+ "spec/database_cleaner/active_record/base_spec.rb",
+ "spec/database_cleaner/active_record/transaction_spec.rb",
+ "spec/database_cleaner/active_record/truncation_spec.rb",
+ "spec/database_cleaner/base_spec.rb",
+ "spec/database_cleaner/configuration_spec.rb",
+ "spec/database_cleaner/couch_potato/truncation_spec.rb",
+ "spec/database_cleaner/data_mapper/base_spec.rb",
+ "spec/database_cleaner/data_mapper/transaction_spec.rb",
+ "spec/database_cleaner/data_mapper/truncation_spec.rb",
+ "spec/database_cleaner/generic/base_spec.rb",
+ "spec/database_cleaner/generic/truncation_spec.rb",
+ "spec/database_cleaner/mongo_mapper/base_spec.rb",
+ "spec/database_cleaner/mongo_mapper/mongo_examples.rb",
+ "spec/database_cleaner/mongo_mapper/truncation_spec.rb",
+ "spec/database_cleaner/sequel/base_spec.rb",
+ "spec/database_cleaner/sequel/transaction_spec.rb",
+ "spec/database_cleaner/sequel/truncation_spec.rb",
+ "spec/database_cleaner/shared_strategy.rb",
+ "spec/rcov.opts",
+ "spec/spec.opts",
+ "spec/spec_helper.rb"
+ ]
+ s.homepage = %q{http://github.com/bmabey/database_cleaner}
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.6.2}
+ s.summary = %q{Strategies for cleaning databases. Can be used to ensure a clean state for testing.}
+ s.test_files = [
+ "spec/database_cleaner/active_record/base_spec.rb",
+ "spec/database_cleaner/active_record/transaction_spec.rb",
+ "spec/database_cleaner/active_record/truncation_spec.rb",
+ "spec/database_cleaner/base_spec.rb",
+ "spec/database_cleaner/configuration_spec.rb",
+ "spec/database_cleaner/couch_potato/truncation_spec.rb",
+ "spec/database_cleaner/data_mapper/base_spec.rb",
+ "spec/database_cleaner/data_mapper/transaction_spec.rb",
+ "spec/database_cleaner/data_mapper/truncation_spec.rb",
+ "spec/database_cleaner/generic/base_spec.rb",
+ "spec/database_cleaner/generic/truncation_spec.rb",
+ "spec/database_cleaner/mongo_mapper/base_spec.rb",
+ "spec/database_cleaner/mongo_mapper/mongo_examples.rb",
+ "spec/database_cleaner/mongo_mapper/truncation_spec.rb",
+ "spec/database_cleaner/sequel/base_spec.rb",
+ "spec/database_cleaner/sequel/transaction_spec.rb",
+ "spec/database_cleaner/sequel/truncation_spec.rb",
+ "spec/database_cleaner/shared_strategy.rb",
+ "spec/spec_helper.rb",
+ "examples/features/step_definitions/activerecord_steps.rb",
+ "examples/features/step_definitions/couchpotato_steps.rb",
+ "examples/features/step_definitions/datamapper_steps.rb",
+ "examples/features/step_definitions/mongoid_steps.rb",
+ "examples/features/step_definitions/mongomapper_steps.rb",
+ "examples/features/step_definitions/translation_steps.rb",
+ "examples/features/support/env.rb",
+ "examples/lib/activerecord_models.rb",
+ "examples/lib/couchpotato_models.rb",
+ "examples/lib/datamapper_models.rb",
+ "examples/lib/mongoid_models.rb",
+ "examples/lib/mongomapper_models.rb"
+ ]
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ else
+ end
+ else
+ end
+end
+
View
26 vendor/gems/database_cleaner/db/sample.config.yml
@@ -0,0 +1,26 @@
+mysql:
+ adapter: mysql
+ database: database_cleaner_test
+ username: root
+ password:
+ host: 127.0.0.1
+ port: 3306
+ encoding: utf8
+
+mysql2:
+ adapter: mysql2
+ database: database_cleaner_test
+ username: root
+ password:
+ host: 127.0.0.1
+ port: 3306
+ encoding: utf8
+
+postgres:
+ adapter: postgresql
+ database: database_cleaner_test
+ username: postgres
+ password:
+ host: 127.0.0.1
+ encoding: unicode
+ template: template0
View
1 vendor/gems/database_cleaner/examples/Gemfile
View
1 vendor/gems/database_cleaner/examples/Gemfile.lock
View
8 vendor/gems/database_cleaner/examples/config/database.yml.example
@@ -0,0 +1,8 @@
+#This is an example of what database.yml *should* look like (when I wrote it)
+#The real database.yml is generated automatically by the active record model lib (so it can be correct)
+two:
+ adapter: sqlite3
+ database: /path/to/examples/features/support/../../db/activerecord_two.db
+one:
+ adapter: sqlite3
+ database: /path/to/examples/features/support/../../db/activerecord_one.db
View
0 vendor/gems/database_cleaner/examples/db/sqlite_databases_go_here
No changes.
View
11 vendor/gems/database_cleaner/examples/features/example.feature
@@ -0,0 +1,11 @@
+Feature: example
+ In order to test DataBase Cleaner
+ Here are some scenarios that rely on the DB being clean!
+
+ Scenario: dirty the db
+ When I create a widget
+ Then I should see 1 widget
+
+ Scenario: assume a clean db
+ When I create a widget
+ Then I should see 1 widget
View
23 vendor/gems/database_cleaner/examples/features/example_multiple_db.feature
@@ -0,0 +1,23 @@
+Feature: example
+ In order to test DataBase Cleaner
+ Here are some scenarios that rely on the DB being clean!
+
+ # Background:
+ # Given I have setup DatabaseCleaner to clean multiple databases
+ #
+ Scenario: dirty the db
+ When I create a widget in one db
+ And I create a widget in another db
+ Then I should see 1 widget in one db
+ And I should see 1 widget in another db
+
+ Scenario: assume a clean db
+ When I create a widget in one db
+ Then I should see 1 widget in one db
+ And I should see 0 widget in another db
+
+ Scenario: assume a clean db
+ When I create a widget in another db
+ Then I should see 0 widget in one db
+ And I should see 1 widget in another db
+
View
22 vendor/gems/database_cleaner/examples/features/example_multiple_orm.feature
@@ -0,0 +1,22 @@
+Feature: example
+ In order to test DataBase Cleaner
+ Here are some scenarios that rely on the DB being clean!
+
+ # Background:
+ # Given I have setup DatabaseCleaner to clean multiple orms
+
+ Scenario: dirty the db
+ When I create a widget in one orm
+ And I create a widget in another orm
+ Then I should see 1 widget in one orm
+ And I should see 1 widget in another orm
+
+ Scenario: assume a clean db
+ When I create a widget in one orm
+ Then I should see 1 widget in one orm
+ And I should see 0 widget in another orm
+
+ Scenario: assume a clean db
+ When I create a widget in another orm
+ Then I should see 0 widget in one orm
+ And I should see 1 widget in another orm
View
31 vendor/gems/database_cleaner/examples/features/step_definitions/activerecord_steps.rb
@@ -0,0 +1,31 @@
+Given /^I have setup database cleaner to clean multiple databases using activerecord$/ do
+ #DatabaseCleaner
+ # require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
+ #
+ # DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
+ # DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
+end
+
+When /^I create a widget using activerecord$/ do
+ ActiveRecordWidget.create!
+end
+
+Then /^I should see ([\d]+) widget using activerecord$/ do |widget_count|
+ ActiveRecordWidget.count.should == widget_count.to_i
+end
+
+When /^I create a widget in one db using activerecord$/ do
+ ActiveRecordWidgetUsingDatabaseOne.create!
+end
+
+When /^I create a widget in another db using activerecord$/ do
+ ActiveRecordWidgetUsingDatabaseTwo.create!
+end
+
+Then /^I should see ([\d]+) widget in one db using activerecord$/ do |widget_count|
+ ActiveRecordWidgetUsingDatabaseOne.count.should == widget_count.to_i
+end
+
+Then /^I should see ([\d]+) widget in another db using activerecord$/ do |widget_count|
+ ActiveRecordWidgetUsingDatabaseTwo.count.should == widget_count.to_i
+end
View
31 vendor/gems/database_cleaner/examples/features/step_definitions/couchpotato_steps.rb
@@ -0,0 +1,31 @@
+Given /^I have setup database cleaner to clean multiple databases using couchpotato$/ do
+ #DatabaseCleaner
+ # require "#{File.dirname(__FILE__)}/../../../lib/couchpotato_models"
+ #
+ # DatabaseCleaner[:couchpotato, {:connection => :one} ].strategy = :truncation
+ # DatabaseCleaner[:couchpotato, {:connection => :two} ].strategy = :truncation
+end
+
+When /^I create a widget using couchpotato$/ do
+ CouchPotatoWidget.create!
+end
+
+Then /^I should see ([\d]+) widget using couchpotato$/ do |widget_count|
+ CouchPotatoWidget.count.should == widget_count.to_i
+end
+
+When /^I create a widget in one db using couchpotato$/ do
+ CouchPotatoWidgetUsingDatabaseOne.create!
+end
+
+When /^I create a widget in another db using couchpotato$/ do
+ CouchPotatoWidgetUsingDatabaseTwo.create!
+end
+
+Then /^I should see ([\d]+) widget in one db using couchpotato$/ do |widget_count|
+ CouchPotatoWidgetUsingDatabaseOne.count.should == widget_count.to_i
+end
+
+Then /^I should see ([\d]+) widget in another db using couchpotato$/ do |widget_count|
+ CouchPotatoWidgetUsingDatabaseTwo.count.should == widget_count.to_i
+end
View
37 vendor/gems/database_cleaner/examples/features/step_definitions/datamapper_steps.rb
@@ -0,0 +1,37 @@
+Given /^I have setup database cleaner to clean multiple databases using datamapper$/ do
+ #DatabaseCleaner
+ # require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
+ #
+ # DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
+ # DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
+end
+
+When /^I create a widget using datamapper$/ do
+ DataMapperWidget.create!
+end
+
+Then /^I should see ([\d]+) widget using datamapper$/ do |widget_count|
+ DataMapperWidget.count.should == widget_count.to_i
+end
+
+When /^I create a widget in one db using datamapper$/ do
+ begin
+ DataMapperWidgetUsingDatabaseOne.create!
+ rescue StandardError => e
+ BREAK = e.backtrace
+ debugger
+ DataMapperWidgetUsingDatabaseOne.create!
+ end
+end
+
+When /^I create a widget in another db using datamapper$/ do
+ DataMapperWidgetUsingDatabaseTwo.create!
+end
+
+Then /^I should see ([\d]+) widget in one db using datamapper$/ do |widget_count|
+ DataMapperWidgetUsingDatabaseOne.count.should == widget_count.to_i
+end
+
+Then /^I should see ([\d]+) widget in another db using datamapper$/ do |widget_count|
+ DataMapperWidgetUsingDatabaseTwo.count.should == widget_count.to_i
+end
View
23 vendor/gems/database_cleaner/examples/features/step_definitions/mongoid_steps.rb
@@ -0,0 +1,23 @@
+When /^I create a widget using mongoid$/ do
+ MongoidWidget.create!( :id => rand(1000)+1000)
+end
+
+Then /^I should see ([\d]+) widget using mongoid$/ do |widget_count|
+ MongoidWidget.count.should == widget_count.to_i
+end
+
+When /^I create a widget in one db using mongoid$/ do
+ MongoidWidgetUsingDatabaseOne.create!
+end
+
+When /^I create a widget in another db using mongoid$/ do
+ MongoidWidgetUsingDatabaseTwo.create!
+end
+
+Then /^I should see ([\d]+) widget in one db using mongoid$/ do |widget_count|
+ MongoidWidgetUsingDatabaseOne.count.should == widget_count.to_i
+end
+
+Then /^I should see ([\d]+) widget in another db using mongoid$/ do |widget_count|
+ MongoidWidgetUsingDatabaseTwo.count.should == widget_count.to_i
+end
View
31 vendor/gems/database_cleaner/examples/features/step_definitions/mongomapper_steps.rb
@@ -0,0 +1,31 @@
+Given /^I have setup database cleaner to clean multiple databases using mongomapper$/ do
+ #DatabaseCleaner
+ # require "#{File.dirname(__FILE__)}/../../../lib/datamapper_models"
+ #
+ # DatabaseCleaner[:datamapper, {:connection => :one} ].strategy = :truncation
+ # DatabaseCleaner[:datamapper, {:connection => :two} ].strategy = :truncation
+end
+
+When /^I create a widget using mongomapper$/ do
+ MongoMapperWidget.create!
+end
+
+Then /^I should see ([\d]+) widget using mongomapper$/ do |widget_count|
+ MongoMapperWidget.count.should == widget_count.to_i
+end
+
+When /^I create a widget in one db using mongomapper$/ do
+ MongoMapperWidgetUsingDatabaseOne.create!
+end
+
+When /^I create a widget in another db using mongomapper$/ do
+ MongoMapperWidgetUsingDatabaseTwo.create!
+end
+
+Then /^I should see ([\d]+) widget in one db using mongomapper$/ do |widget_count|
+ MongoMapperWidgetUsingDatabaseOne.count.should == widget_count.to_i
+end
+
+Then /^I should see ([\d]+) widget in another db using mongomapper$/ do |widget_count|
+ MongoMapperWidgetUsingDatabaseTwo.count.should == widget_count.to_i
+end
View
55 vendor/gems/database_cleaner/examples/features/step_definitions/translation_steps.rb
@@ -0,0 +1,55 @@
+When /^I create a widget$/ do
+ step "I create a widget using #{ENV['ORM'].downcase}"
+end
+
+Then /^I should see 1 widget$/ do
+ step "I should see 1 widget using #{ENV['ORM'].downcase}"
+end
+
+When /^I create a widget in one orm$/ do
+ step "I create a widget using #{ENV['ORM'].downcase}"
+end
+
+When /^I create a widget in another orm$/ do
+ step "I create a widget using #{ENV['ANOTHER_ORM'].downcase}"
+end
+
+Then /^I should see 1 widget in one orm$/ do
+ step "I should see 1 widget using #{ENV['ORM'].downcase}"
+end
+
+Then /^I should see 1 widget in another orm$/ do
+ step "I should see 1 widget using #{ENV['ANOTHER_ORM'].downcase}"
+end
+
+Then /^I should see 0 widget in another orm$/ do
+ step "I should see 0 widget using #{ENV['ANOTHER_ORM'].downcase}"
+end
+
+Then /^I should see 0 widget in one orm$/ do
+ step "I should see 0 widget using #{ENV['ORM'].downcase}"
+end
+
+When /^I create a widget in one db$/ do
+ step "I create a widget in one db using #{ENV['ORM'].downcase}"
+end
+
+When /^I create a widget in another db$/ do
+ step "I create a widget in another db using #{ENV['ORM'].downcase}"
+end
+
+Then /^I should see 1 widget in one db$/ do
+ step "I should see 1 widget in one db using #{ENV['ORM'].downcase}"
+end
+
+Then /^I should see 1 widget in another db$/ do
+ step "I should see 1 widget in another db using #{ENV['ORM'].downcase}"
+end
+
+Then /^I should see 0 widget in another db$/ do
+ step "I should see 0 widget in another db using #{ENV['ORM'].downcase}"
+end
+
+Then /^I should see 0 widget in one db$/ do
+ step "I should see 0 widget in one db using #{ENV['ORM'].downcase}"
+end
View
62 vendor/gems/database_cleaner/examples/features/support/env.rb
@@ -0,0 +1,62 @@
+#Hilarious as it seems, this is necessary so bundle exec cucumber works for mongoid cukeage (I'm assuming mongomapper is automatically present because its a git repo)
+Object.send(:remove_const, 'MongoMapper') if defined?(::MongoMapper)
+
+require 'rubygems'
+require 'bundler'
+
+Bundler.setup
+require 'rspec/expectations'
+require 'ruby-debug'
+
+DB_DIR = "#{File.dirname(__FILE__)}/../../db"
+
+orm = ENV['ORM']
+another_orm = ENV['ANOTHER_ORM']
+strategy = ENV['STRATEGY']
+multiple_db = ENV['MULTIPLE_DBS']
+
+
+if orm && strategy
+ $:.unshift(File.dirname(__FILE__) + '/../../../lib')
+ require 'database_cleaner'
+ require 'database_cleaner/cucumber'
+
+ begin
+ require "#{File.dirname(__FILE__)}/../../lib/#{orm.downcase}_models"
+ rescue LoadError => e
+ raise "You don't have the #{orm} ORM installed"
+ end
+
+ if another_orm
+ begin
+ require "#{File.dirname(__FILE__)}/../../lib/#{another_orm.downcase}_models"
+ rescue LoadError => e
+ raise "You don't have the #{another_orm} ORM installed"
+ end
+ end
+
+
+
+
+ if multiple_db
+ DatabaseCleaner.app_root = "#{File.dirname(__FILE__)}/../.."
+ orm_sym = orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym
+
+ if orm_sym == :mongo_mapper
+ DatabaseCleaner[ orm_sym, {:connection => 'database_cleaner_test_one'} ].strategy = strategy.to_sym
+ DatabaseCleaner[ orm_sym, {:connection => 'database_cleaner_test_two'} ].strategy = strategy.to_sym
+ else
+ DatabaseCleaner[ orm_sym, {:connection => :one} ].strategy = strategy.to_sym
+ DatabaseCleaner[ orm_sym, {:connection => :two} ].strategy = strategy.to_sym
+ end
+
+ elsif another_orm
+ DatabaseCleaner[ orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym ].strategy = strategy.to_sym
+ DatabaseCleaner[ another_orm.gsub(/(.)([A-Z]+)/,'\1_\2').downcase.to_sym ].strategy = strategy.to_sym
+ else
+ DatabaseCleaner.strategy = strategy.to_sym unless strategy == "default"
+ end
+
+else
+ raise "Run 'ORM=ActiveRecord|DataMapper|MongoMapper|CouchPotato [ANOTHER_ORM=...] [MULTIPLE_DBS=true] STRATEGY=transaction|truncation|default cucumber examples/features'"
+end
View
41 vendor/gems/database_cleaner/examples/lib/activerecord_models.rb
@@ -0,0 +1,41 @@
+require 'active_record'
+databases_config = {
+ "one" => {"adapter" => "#{"jdbc" if defined?(JRUBY_VERSION)}sqlite3", "database" => "#{DB_DIR}/activerecord_one.db"},
+ "two" => {"adapter" => "#{"jdbc" if defined?(JRUBY_VERSION)}sqlite3", "database" => "#{DB_DIR}/activerecord_two.db"}
+}
+
+File.open("#{File.dirname(__FILE__)}/../config/database.yml", 'w') do |file|
+ file.write(YAML.dump(databases_config))
+end
+
+["two","one"].each do |db|
+ ActiveRecord::Base.establish_connection(databases_config[db])
+ ActiveRecord::Base.connection.execute('DROP TABLE IF EXISTS "active_record_widgets"')
+ ActiveRecord::Base.connection.execute('DROP TABLE IF EXISTS "active_record_widget_using_database_ones"')
+ ActiveRecord::Base.connection.execute('DROP TABLE IF EXISTS "active_record_widget_using_database_twos"')
+
+ ActiveRecord::Schema.define(:version => 1) do
+ create_table :active_record_widgets do |t|
+ t.string :name
+ end
+
+ create_table :active_record_widget_using_database_ones do |t|
+ t.string :name
+ end
+
+ create_table :active_record_widget_using_database_twos do |t|
+ t.string :name
+ end
+ end
+end
+
+class ActiveRecordWidget < ActiveRecord::Base
+end
+
+class ActiveRecordWidgetUsingDatabaseOne < ActiveRecord::Base
+ establish_connection(:adapter => "#{"jdbc" if defined?(JRUBY_VERSION)}sqlite3", :database => "#{DB_DIR}/activerecord_one.db")
+end
+
+class ActiveRecordWidgetUsingDatabaseTwo < ActiveRecord::Base
+ establish_connection(:adapter => "#{"jdbc" if defined?(JRUBY_VERSION)}sqlite3", :database => "#{DB_DIR}/activerecord_two.db")
+end
View
61 vendor/gems/database_cleaner/examples/lib/couchpotato_models.rb
@@ -0,0 +1,61 @@
+require 'couch_potato'
+require 'json/pure' unless defined? ::JSON
+::CouchPotato::Config.database_name = 'couch_potato_test'
+
+class CouchPotatoWidget
+ include CouchPotato::Persistence
+
+ property :name
+ view :by_name, :key => :name
+
+
+ # mimic the AR interface used in example_steps
+
+ def self.create!(attrs = {})
+ CouchPotato.database.save(self.new)
+ end
+
+ def self.count
+ CouchPotato.database.view(self.by_name).size
+ end
+end
+
+class CouchPotatoWidgetUsingDatabaseOne
+ include CouchPotato::Persistence
+
+ database_name = 'couch_potato_test_one'
+
+ property :name
+ view :by_name, :key => :name
+
+
+ # mimic the AR interface used in example_steps
+
+ def self.create!(attrs = {})
+ CouchPotato.database.save(self.new)
+ end
+
+ def self.count
+ CouchPotato.database.view(self.by_name).size
+ end
+end
+
+class CouchPotatoWidgetUsingDatabaseTwo
+ include CouchPotato::Persistence
+
+ database_name = 'couch_potato_test_two'
+
+ property :name
+ view :by_name, :key => :name
+
+
+ # mimic the AR interface used in example_steps
+
+ def self.create!(attrs = {})
+ CouchPotato.database.save(self.new)
+ end
+
+ def self.count
+ CouchPotato.database.view(self.by_name).size
+ end
+end
View
50 vendor/gems/database_cleaner/examples/lib/datamapper_models.rb
@@ -0,0 +1,50 @@
+require "dm-core"
+require "dm-transactions"
+
+#Datamapper 1.0 requires you to require dm-migrations to automigrate
+require "dm-migrations"
+
+# only to please activerecord API used in database_cleaner/examples/features/step_definitions
+# yes, i know that's lazy ...
+
+require "dm-validations"
+require "dm-aggregates"
+
+DataMapper.setup(:default, "sqlite3:#{DB_DIR}/datamapper_default.db")
+DataMapper.setup(:one, "sqlite3:#{DB_DIR}/datamapper_one.db")
+DataMapper.setup(:two, "sqlite3:#{DB_DIR}/datamapper_two.db")
+
+class DataMapperWidget
+ include DataMapper::Resource
+
+ property :id, Serial
+ property :name, String
+end
+
+class DataMapperWidgetUsingDatabaseOne
+ include DataMapper::Resource
+
+ def self.default_repository_name
+ :one
+ end
+
+ property :id, Serial
+ property :name, String
+
+end
+
+class DataMapperWidgetUsingDatabaseTwo
+ include DataMapper::Resource
+
+ def self.default_repository_name
+ :two
+ end
+
+ property :id, Serial
+ property :name, String
+
+end
+
+DataMapperWidget.auto_migrate!
+DataMapperWidgetUsingDatabaseOne.auto_migrate!
+DataMapperWidgetUsingDatabaseTwo.auto_migrate!
View
49 vendor/gems/database_cleaner/examples/lib/mongoid_models.rb
@@ -0,0 +1,49 @@
+require 'mongoid'
+
+Mongoid.configure do |config|
+ name = 'database_cleaner_test'
+ config.master = Mongo::Connection.new.db(name)
+end
+
+
+#::MongoMapper.connection = Mongo::Connection.new('127.0.0.1')
+#::MongoMapper.database = 'database_cleaner_test'
+
+class MongoidWidget
+ include Mongoid::Document
+ field :id, :type => Integer
+ field :name
+
+ class << self
+ #mongoid doesn't seem to provide this...
+ def create!(*args)
+ new(*args).save!
+ end
+ end
+end
+
+class MongoidWidgetUsingDatabaseOne
+ include Mongoid::Document
+ field :id, :type => Integer
+ field :name
+
+ class << self
+ #mongoid doesn't seem to provide this...
+ def create!(*args)
+ new(*args).save!
+ end
+ end
+end
+
+class MongoidWidgetUsingDatabaseTwo
+ include Mongoid::Document
+ field :id, :type => Integer
+ field :name
+
+ class << self
+ #mongoid doesn't seem to provide this...
+ def create!(*args)
+ new(*args).save!
+ end
+ end
+end
View
51 vendor/gems/database_cleaner/examples/lib/mongomapper_models.rb
@@ -0,0 +1,51 @@
+require 'mongo_mapper'
+
+::MongoMapper.connection = Mongo::Connection.new('127.0.0.1')
+::MongoMapper.database = 'database_cleaner_test'
+
+class MongoMapperWidget
+ include MongoMapper::Document
+ key :id, Integer
+ key :name, String
+
+ class << self
+ #mongomapper doesn't seem to provide this...
+ def create!(*args)
+ new(*args).save!
+ end
+ end
+end
+
+class MongoMapperWidgetUsingDatabaseOne
+ include MongoMapper::Document
+
+ connection = Mongo::Connection.new('127.0.0.1')
+ set_database_name = 'database_cleaner_test_one'
+
+ key :id, Integer
+ key :name, String
+
+ class << self
+ #mongomapper doesn't seem to provide this...
+ def create!(*args)
+ new(*args).save!
+ end
+ end
+end
+
+class MongoMapperWidgetUsingDatabaseTwo
+ include MongoMapper::Document
+
+ connection = Mongo::Connection.new('127.0.0.1')
+ set_database_name = 'database_cleaner_test_two'
+
+ key :id, Integer
+ key :name, String
+
+ class << self
+ #mongomapper doesn't seem to provide this...
+ def create!(*args)
+ new(*args).save!
+ end
+ end
+end
View
22 vendor/gems/database_cleaner/features/cleaning.feature
@@ -0,0 +1,22 @@
+Feature: database cleaning
+ In order to ease example and feature writing
+ As a developer
+ I want to have my database in a clean state
+
+ Scenario Outline: ruby app
+ Given I am using <ORM>
+ And the <Strategy> cleaning strategy
+
+ When I run my scenarios that rely on a clean database
+ Then I should see all green
+
+ Examples:
+ | ORM | Strategy |
+ | ActiveRecord | transaction |
+ | ActiveRecord | truncation |
+ | ActiveRecord | deletion |
+ | DataMapper | transaction |
+ | DataMapper | truncation |
+ | MongoMapper | truncation |
+ | Mongoid | truncation |
+ | CouchPotato | truncation |
View
19 vendor/gems/database_cleaner/features/cleaning_default_strategy.feature
@@ -0,0 +1,19 @@
+Feature: database cleaning
+ In order to ease example and feature writing
+ As a developer
+ I want to have my database in a clean state with default strategy
+
+ Scenario Outline: ruby app
+ Given I am using <ORM>
+ And the default cleaning strategy
+
+ When I run my scenarios that rely on a clean database
+ Then I should see all green
+
+ Examples:
+ | ORM |
+ | ActiveRecord |
+ | DataMapper |
+ | MongoMapper |
+ | Mongoid |
+ | CouchPotato |
View
21 vendor/gems/database_cleaner/features/cleaning_multiple_dbs.feature
@@ -0,0 +1,21 @@
+Feature: multiple database cleaning
+ In order to ease example and feature writing
+ As a developer
+ I want to have my databases in a clean state
+
+ Scenario Outline: ruby app
+ Given I am using <ORM>
+ And the <Strategy> cleaning strategy
+
+ When I run my scenarios that rely on clean databases
+ Then I should see all green
+
+ Examples:
+ | ORM | Strategy |
+ | ActiveRecord | truncation |
+ | ActiveRecord | deletion |
+ | DataMapper | truncation |
+ | MongoMapper | truncation |
+ | DataMapper | transaction |
+# Not working...
+#| ActiveRecord | transaction |