asana2flowdock 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1595) hide show
  1. checksums.yaml +8 -8
  2. data/asana2flowdock.gemspec +3 -1819
  3. data/lib/asana2flowdock.rb +1 -1
  4. metadata +1 -1599
  5. data/a.rb +0 -336
  6. data/a.yml +0 -6
  7. data/bin/amalgalite-pack +0 -16
  8. data/bin/asana2flowdock-daemon +0 -16
  9. data/bin/coderay +0 -16
  10. data/bin/httparty +0 -16
  11. data/bin/pry +0 -16
  12. data/bin/sekrets +0 -16
  13. data/bin/sequel +0 -16
  14. data/config/asana2flowdock.yml.enc +0 -2
  15. data/vendor/bundle/ruby/1.9.1/bin/amalgalite-pack +0 -23
  16. data/vendor/bundle/ruby/1.9.1/bin/asana2flowdock +0 -23
  17. data/vendor/bundle/ruby/1.9.1/bin/asana2flowdock-daemon +0 -23
  18. data/vendor/bundle/ruby/1.9.1/bin/coderay +0 -23
  19. data/vendor/bundle/ruby/1.9.1/bin/httparty +0 -23
  20. data/vendor/bundle/ruby/1.9.1/bin/pry +0 -23
  21. data/vendor/bundle/ruby/1.9.1/bin/sekrets +0 -23
  22. data/vendor/bundle/ruby/1.9.1/bin/sequel +0 -23
  23. data/vendor/bundle/ruby/1.9.1/build_info/amalgalite-1.3.0.info +0 -1
  24. data/vendor/bundle/ruby/1.9.1/build_info/arrayfields-4.7.4.info +0 -1
  25. data/vendor/bundle/ruby/1.9.1/build_info/chronic-0.10.2.info +0 -1
  26. data/vendor/bundle/ruby/1.9.1/build_info/coderay-1.1.0.info +0 -1
  27. data/vendor/bundle/ruby/1.9.1/build_info/coerce-0.0.6.info +0 -1
  28. data/vendor/bundle/ruby/1.9.1/build_info/daemons-1.1.9.info +0 -1
  29. data/vendor/bundle/ruby/1.9.1/build_info/fastercsv-1.5.5.info +0 -1
  30. data/vendor/bundle/ruby/1.9.1/build_info/fattr-2.2.2.info +0 -1
  31. data/vendor/bundle/ruby/1.9.1/build_info/flowdock-0.5.0.info +0 -1
  32. data/vendor/bundle/ruby/1.9.1/build_info/highline-1.6.21.info +0 -1
  33. data/vendor/bundle/ruby/1.9.1/build_info/httparty-0.13.1.info +0 -1
  34. data/vendor/bundle/ruby/1.9.1/build_info/json-1.8.1.info +0 -1
  35. data/vendor/bundle/ruby/1.9.1/build_info/main-6.0.0.info +0 -1
  36. data/vendor/bundle/ruby/1.9.1/build_info/main-6.1.0.info +0 -1
  37. data/vendor/bundle/ruby/1.9.1/build_info/map-6.5.5.info +0 -1
  38. data/vendor/bundle/ruby/1.9.1/build_info/method_source-0.8.2.info +0 -1
  39. data/vendor/bundle/ruby/1.9.1/build_info/multi_json-1.10.1.info +0 -1
  40. data/vendor/bundle/ruby/1.9.1/build_info/multi_xml-0.5.5.info +0 -1
  41. data/vendor/bundle/ruby/1.9.1/build_info/pry-0.9.12.6.info +0 -1
  42. data/vendor/bundle/ruby/1.9.1/build_info/sekrets-1.7.0.info +0 -1
  43. data/vendor/bundle/ruby/1.9.1/build_info/sequel-4.15.0.info +0 -1
  44. data/vendor/bundle/ruby/1.9.1/build_info/slop-3.5.0.info +0 -1
  45. data/vendor/bundle/ruby/1.9.1/build_info/threadify-1.3.0.info +0 -1
  46. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/CONTRIBUTING.md +0 -49
  47. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/HISTORY.md +0 -315
  48. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/LICENSE +0 -29
  49. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/Manifest.txt +0 -104
  50. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/README.md +0 -73
  51. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/Rakefile +0 -25
  52. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/TODO.md +0 -50
  53. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/bin/amalgalite-pack +0 -147
  54. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/a.rb +0 -9
  55. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/blob.rb +0 -88
  56. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/bootstrap.rb +0 -36
  57. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/define_aggregate.rb +0 -75
  58. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/define_function.rb +0 -104
  59. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/fts3.rb +0 -144
  60. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/gem-db.rb +0 -94
  61. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/require_me.rb +0 -11
  62. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/requires.rb +0 -42
  63. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/examples/schema-info.rb +0 -34
  64. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/Makefile +0 -220
  65. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite.bundle +0 -0
  66. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite.c +0 -329
  67. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite.h +0 -151
  68. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite.o +0 -0
  69. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_blob.c +0 -240
  70. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_blob.o +0 -0
  71. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_constants.c +0 -378
  72. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_constants.o +0 -0
  73. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_database.c +0 -1177
  74. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_database.o +0 -0
  75. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_requires_bootstrap.c +0 -282
  76. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_requires_bootstrap.o +0 -0
  77. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_statement.c +0 -649
  78. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/amalgalite_statement.o +0 -0
  79. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/extconf.rb +0 -36
  80. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/gen_constants.rb +0 -193
  81. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/notes.txt +0 -134
  82. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3.c +0 -137414
  83. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3.h +0 -7160
  84. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3.o +0 -0
  85. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3_options.h +0 -4
  86. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/ext/amalgalite/c/sqlite3ext.h +0 -447
  87. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite.rb +0 -51
  88. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/1.9/amalgalite.bundle +0 -0
  89. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/aggregate.rb +0 -67
  90. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/blob.rb +0 -186
  91. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/boolean.rb +0 -42
  92. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/busy_timeout.rb +0 -47
  93. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/column.rb +0 -99
  94. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/core_ext/kernel/require.rb +0 -21
  95. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/csv_table_importer.rb +0 -74
  96. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/database.rb +0 -984
  97. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/function.rb +0 -61
  98. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/index.rb +0 -43
  99. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/memory_database.rb +0 -15
  100. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/packer.rb +0 -231
  101. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/paths.rb +0 -80
  102. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/profile_tap.rb +0 -131
  103. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/progress_handler.rb +0 -21
  104. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/requires.rb +0 -151
  105. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/schema.rb +0 -225
  106. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3.rb +0 -6
  107. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/constants.rb +0 -95
  108. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/database/function.rb +0 -48
  109. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/database/status.rb +0 -68
  110. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/status.rb +0 -60
  111. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/sqlite3/version.rb +0 -55
  112. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/statement.rb +0 -418
  113. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/table.rb +0 -91
  114. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/taps.rb +0 -2
  115. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/taps/console.rb +0 -27
  116. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/taps/io.rb +0 -71
  117. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/trace_tap.rb +0 -35
  118. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/type_map.rb +0 -63
  119. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/type_maps/default_map.rb +0 -166
  120. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/type_maps/storage_map.rb +0 -38
  121. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/type_maps/text_map.rb +0 -21
  122. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/version.rb +0 -8
  123. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/lib/amalgalite/view.rb +0 -26
  124. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/aggregate_spec.rb +0 -150
  125. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/amalgalite_spec.rb +0 -4
  126. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/blob_spec.rb +0 -78
  127. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/boolean_spec.rb +0 -24
  128. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/busy_handler.rb +0 -157
  129. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/data/iso-3166-country.txt +0 -242
  130. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/data/iso-3166-schema.sql +0 -22
  131. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/data/iso-3166-subcountry.txt +0 -3995
  132. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/data/make-iso-db.sh +0 -12
  133. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/database_spec.rb +0 -510
  134. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/default_map_spec.rb +0 -92
  135. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/function_spec.rb +0 -78
  136. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/integeration_spec.rb +0 -97
  137. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/iso_3166_database.rb +0 -58
  138. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/packer_spec.rb +0 -60
  139. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/paths_spec.rb +0 -28
  140. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/progress_handler_spec.rb +0 -91
  141. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/requires_spec.rb +0 -54
  142. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/rtree_spec.rb +0 -66
  143. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/schema_spec.rb +0 -131
  144. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/spec_helper.rb +0 -43
  145. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3/constants_spec.rb +0 -108
  146. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3/database_status_spec.rb +0 -36
  147. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3/status_spec.rb +0 -22
  148. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3/version_spec.rb +0 -22
  149. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/sqlite3_spec.rb +0 -53
  150. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/statement_spec.rb +0 -168
  151. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/storage_map_spec.rb +0 -38
  152. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/tap_spec.rb +0 -57
  153. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/text_map_spec.rb +0 -20
  154. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/type_map_spec.rb +0 -14
  155. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/spec/version_spec.rb +0 -8
  156. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/tasks/custom.rake +0 -99
  157. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/tasks/default.rake +0 -277
  158. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/tasks/extension.rake +0 -38
  159. data/vendor/bundle/ruby/1.9.1/gems/amalgalite-1.3.0/tasks/this.rb +0 -209
  160. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/README +0 -378
  161. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/arrayfields.gemspec +0 -26
  162. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/gemspec.rb +0 -62
  163. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/install.rb +0 -206
  164. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/lib/arrayfields.rb +0 -443
  165. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/readme.rb +0 -248
  166. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/a.rb +0 -40
  167. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/b.rb +0 -16
  168. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/c.rb +0 -9
  169. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/d.rb +0 -25
  170. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/sample/e.rb +0 -15
  171. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/test/arrayfields.rb +0 -324
  172. data/vendor/bundle/ruby/1.9.1/gems/arrayfields-4.7.4/test/memtest.rb +0 -41
  173. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/HISTORY.md +0 -243
  174. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/LICENSE +0 -21
  175. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/README.md +0 -182
  176. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/Rakefile +0 -66
  177. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/chronic.gemspec +0 -23
  178. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic.rb +0 -150
  179. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/date.rb +0 -82
  180. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/grabber.rb +0 -33
  181. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/handler.rb +0 -97
  182. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/handlers.rb +0 -647
  183. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/mini_date.rb +0 -38
  184. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/numerizer.rb +0 -130
  185. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/ordinal.rb +0 -49
  186. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/parser.rb +0 -268
  187. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/pointer.rb +0 -32
  188. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeater.rb +0 -145
  189. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_day.rb +0 -54
  190. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_day_name.rb +0 -53
  191. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_day_portion.rb +0 -109
  192. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_fortnight.rb +0 -72
  193. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_hour.rb +0 -59
  194. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_minute.rb +0 -59
  195. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_month.rb +0 -80
  196. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_month_name.rb +0 -95
  197. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_season.rb +0 -111
  198. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_season_name.rb +0 -43
  199. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_second.rb +0 -43
  200. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_time.rb +0 -138
  201. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_week.rb +0 -75
  202. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_weekday.rb +0 -86
  203. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_weekend.rb +0 -67
  204. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_year.rb +0 -78
  205. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/scalar.rb +0 -81
  206. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/season.rb +0 -26
  207. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/separator.rb +0 -207
  208. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/sign.rb +0 -49
  209. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/span.rb +0 -31
  210. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/tag.rb +0 -37
  211. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/time.rb +0 -40
  212. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/time_zone.rb +0 -32
  213. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/lib/chronic/token.rb +0 -51
  214. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/helper.rb +0 -12
  215. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_chronic.rb +0 -183
  216. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_daylight_savings.rb +0 -118
  217. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_handler.rb +0 -128
  218. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_mini_date.rb +0 -32
  219. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_numerizer.rb +0 -86
  220. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_parsing.rb +0 -1235
  221. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_day_name.rb +0 -51
  222. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_day_portion.rb +0 -254
  223. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_fortnight.rb +0 -62
  224. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_hour.rb +0 -68
  225. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_minute.rb +0 -34
  226. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_month.rb +0 -50
  227. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_month_name.rb +0 -56
  228. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_season.rb +0 -40
  229. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_time.rb +0 -88
  230. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_week.rb +0 -62
  231. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_weekday.rb +0 -55
  232. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_weekend.rb +0 -74
  233. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_repeater_year.rb +0 -69
  234. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_span.rb +0 -23
  235. data/vendor/bundle/ruby/1.9.1/gems/chronic-0.10.2/test/test_token.rb +0 -25
  236. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/README_INDEX.rdoc +0 -123
  237. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/Rakefile +0 -37
  238. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/bin/coderay +0 -215
  239. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay.rb +0 -284
  240. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/duo.rb +0 -81
  241. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoder.rb +0 -201
  242. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/_map.rb +0 -17
  243. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/comment_filter.rb +0 -25
  244. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/count.rb +0 -39
  245. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/debug.rb +0 -49
  246. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/debug_lint.rb +0 -63
  247. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/div.rb +0 -23
  248. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/filter.rb +0 -58
  249. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/html.rb +0 -332
  250. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/html/css.rb +0 -65
  251. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/html/numbering.rb +0 -108
  252. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/html/output.rb +0 -166
  253. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/json.rb +0 -83
  254. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/lines_of_code.rb +0 -45
  255. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/lint.rb +0 -59
  256. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/null.rb +0 -18
  257. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/page.rb +0 -24
  258. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/span.rb +0 -23
  259. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/statistic.rb +0 -95
  260. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/terminal.rb +0 -195
  261. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/text.rb +0 -46
  262. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/token_kind_filter.rb +0 -111
  263. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/xml.rb +0 -72
  264. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/encoders/yaml.rb +0 -50
  265. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/for_redcloth.rb +0 -95
  266. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/helpers/file_type.rb +0 -151
  267. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/helpers/plugin.rb +0 -274
  268. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/helpers/word_list.rb +0 -72
  269. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanner.rb +0 -355
  270. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/_map.rb +0 -24
  271. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/c.rb +0 -189
  272. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/clojure.rb +0 -217
  273. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/cpp.rb +0 -215
  274. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/css.rb +0 -196
  275. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/debug.rb +0 -75
  276. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/delphi.rb +0 -144
  277. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/diff.rb +0 -221
  278. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/erb.rb +0 -81
  279. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/go.rb +0 -208
  280. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/groovy.rb +0 -268
  281. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/haml.rb +0 -168
  282. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/html.rb +0 -275
  283. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/java.rb +0 -174
  284. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/java/builtin_types.rb +0 -421
  285. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/java_script.rb +0 -237
  286. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/json.rb +0 -98
  287. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/lua.rb +0 -280
  288. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/php.rb +0 -527
  289. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/python.rb +0 -287
  290. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/raydebug.rb +0 -75
  291. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/ruby.rb +0 -470
  292. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/ruby/patterns.rb +0 -178
  293. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/ruby/string_state.rb +0 -71
  294. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/sass.rb +0 -232
  295. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/sql.rb +0 -177
  296. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/taskpaper.rb +0 -36
  297. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/text.rb +0 -26
  298. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/xml.rb +0 -17
  299. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/scanners/yaml.rb +0 -140
  300. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/style.rb +0 -23
  301. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/styles/_map.rb +0 -7
  302. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/styles/alpha.rb +0 -152
  303. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/token_kinds.rb +0 -85
  304. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/tokens.rb +0 -161
  305. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/tokens_proxy.rb +0 -55
  306. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/lib/coderay/version.rb +0 -3
  307. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/test/functional/basic.rb +0 -318
  308. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/test/functional/examples.rb +0 -129
  309. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/test/functional/for_redcloth.rb +0 -78
  310. data/vendor/bundle/ruby/1.9.1/gems/coderay-1.1.0/test/functional/suite.rb +0 -15
  311. data/vendor/bundle/ruby/1.9.1/gems/coerce-0.0.6/README +0 -28
  312. data/vendor/bundle/ruby/1.9.1/gems/coerce-0.0.6/Rakefile +0 -392
  313. data/vendor/bundle/ruby/1.9.1/gems/coerce-0.0.6/coerce.gemspec +0 -31
  314. data/vendor/bundle/ruby/1.9.1/gems/coerce-0.0.6/lib/coerce.rb +0 -210
  315. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/LICENSE +0 -22
  316. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/README +0 -214
  317. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/Rakefile +0 -90
  318. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/Releases +0 -195
  319. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/TODO +0 -2
  320. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/call/call.rb +0 -57
  321. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/call/call_monitor.rb +0 -55
  322. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/daemonize/daemonize.rb +0 -27
  323. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_crash.rb +0 -17
  324. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_exec.rb +0 -16
  325. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_exit.rb +0 -15
  326. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_hanging.rb +0 -19
  327. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_keep_pid_files.rb +0 -17
  328. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_monitor.rb +0 -16
  329. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_multiple.rb +0 -16
  330. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_normal.rb +0 -11
  331. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_ontop.rb +0 -16
  332. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_optionparser.rb +0 -43
  333. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_proc.rb +0 -25
  334. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_proc_multiple.rb +0 -22
  335. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_proc_rand.rb +0 -23
  336. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_proc_simple.rb +0 -17
  337. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/ctrl_slowstop.rb +0 -16
  338. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver.rb +0 -12
  339. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver_crashing.rb +0 -14
  340. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver_exiting.rb +0 -8
  341. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver_hanging.rb +0 -21
  342. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/examples/run/myserver_slowstop.rb +0 -21
  343. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons.rb +0 -315
  344. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/application.rb +0 -477
  345. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/application_group.rb +0 -194
  346. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/change_privilege.rb +0 -19
  347. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/cmdline.rb +0 -121
  348. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/controller.rb +0 -140
  349. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/daemonize.rb +0 -169
  350. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/etc_extension.rb +0 -12
  351. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/exceptions.rb +0 -28
  352. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/monitor.rb +0 -138
  353. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/pid.rb +0 -108
  354. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/pidfile.rb +0 -116
  355. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/lib/daemons/pidmem.rb +0 -19
  356. data/vendor/bundle/ruby/1.9.1/gems/daemons-1.1.9/setup.rb +0 -1360
  357. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/AUTHORS +0 -1
  358. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/CHANGELOG +0 -182
  359. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/COPYING +0 -340
  360. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/INSTALL +0 -33
  361. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/LICENSE +0 -9
  362. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/README +0 -71
  363. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/Rakefile +0 -94
  364. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/TODO +0 -6
  365. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_converters.rb +0 -28
  366. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_filter.rb +0 -23
  367. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_reading.rb +0 -57
  368. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_table.rb +0 -56
  369. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/csv_writing.rb +0 -67
  370. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/purchase.csv +0 -3
  371. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/examples/shortcut_interface.rb +0 -36
  372. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/lib/faster_csv.rb +0 -2025
  373. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/lib/fastercsv.rb +0 -10
  374. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/line_endings.gz +0 -0
  375. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_csv_parsing.rb +0 -191
  376. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_csv_writing.rb +0 -96
  377. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_data_converters.rb +0 -260
  378. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_encodings.rb +0 -23
  379. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_features.rb +0 -212
  380. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_headers.rb +0 -277
  381. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_interface.rb +0 -376
  382. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_row.rb +0 -305
  383. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_serialization.rb +0 -154
  384. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_speed.rb +0 -65
  385. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/tc_table.rb +0 -408
  386. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/test_data.csv +0 -1000
  387. data/vendor/bundle/ruby/1.9.1/gems/fastercsv-1.5.5/test/ts_all.rb +0 -20
  388. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/LICENSE +0 -1
  389. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/README +0 -347
  390. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/README.erb +0 -82
  391. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/Rakefile +0 -376
  392. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/lib/fattr.rb +0 -206
  393. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/a.rb +0 -21
  394. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/b.rb +0 -22
  395. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/c.rb +0 -12
  396. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/d.rb +0 -34
  397. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/e.rb +0 -17
  398. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/f.rb +0 -21
  399. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/g.rb +0 -15
  400. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/samples/h.rb +0 -29
  401. data/vendor/bundle/ruby/1.9.1/gems/fattr-2.2.2/test/fattr_test.rb +0 -173
  402. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/Gemfile +0 -16
  403. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/LICENSE +0 -20
  404. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/README.md +0 -145
  405. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/Rakefile +0 -43
  406. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/VERSION +0 -1
  407. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/flowdock.gemspec +0 -73
  408. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/lib/flowdock.rb +0 -181
  409. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/lib/flowdock/capistrano.rb +0 -1
  410. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/spec/flowdock_spec.rb +0 -435
  411. data/vendor/bundle/ruby/1.9.1/gems/flowdock-0.5.0/spec/spec_helper.rb +0 -14
  412. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/AUTHORS +0 -3
  413. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/CHANGELOG +0 -357
  414. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/COPYING +0 -340
  415. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/INSTALL +0 -55
  416. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/LICENSE +0 -7
  417. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/README.rdoc +0 -67
  418. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/Rakefile +0 -50
  419. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/TODO +0 -6
  420. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/ansi_colors.rb +0 -38
  421. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/asking_for_arrays.rb +0 -18
  422. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/basic_usage.rb +0 -75
  423. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/color_scheme.rb +0 -32
  424. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/get_character.rb +0 -12
  425. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/limit.rb +0 -12
  426. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/menus.rb +0 -65
  427. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/overwrite.rb +0 -19
  428. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/page_and_wrap.rb +0 -322
  429. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/password.rb +0 -7
  430. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/repeat_entry.rb +0 -21
  431. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/trapping_eof.rb +0 -22
  432. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/using_readline.rb +0 -17
  433. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/highline.gemspec +0 -37
  434. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline.rb +0 -1034
  435. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/color_scheme.rb +0 -134
  436. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/compatibility.rb +0 -16
  437. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/import.rb +0 -41
  438. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/menu.rb +0 -381
  439. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/question.rb +0 -481
  440. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/simulate.rb +0 -48
  441. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/string_extensions.rb +0 -111
  442. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/style.rb +0 -181
  443. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/lib/highline/system_extensions.rb +0 -242
  444. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/setup.rb +0 -1360
  445. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/site/highline.css +0 -65
  446. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/site/images/logo.png +0 -0
  447. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/site/index.html +0 -58
  448. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/string_methods.rb +0 -32
  449. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_color_scheme.rb +0 -96
  450. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_highline.rb +0 -1134
  451. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_import.rb +0 -52
  452. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_menu.rb +0 -439
  453. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_string_extension.rb +0 -20
  454. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_string_highline.rb +0 -38
  455. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/tc_style.rb +0 -567
  456. data/vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/test/ts_all.rb +0 -16
  457. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/Gemfile +0 -14
  458. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/Guardfile +0 -16
  459. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/History +0 -303
  460. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/MIT-LICENSE +0 -20
  461. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/README.md +0 -74
  462. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/Rakefile +0 -12
  463. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/bin/httparty +0 -117
  464. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/cucumber.yml +0 -1
  465. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/aaws.rb +0 -32
  466. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/basic.rb +0 -28
  467. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/crack.rb +0 -19
  468. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/custom_parsers.rb +0 -67
  469. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/delicious.rb +0 -37
  470. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/google.rb +0 -16
  471. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/headers_and_user_agents.rb +0 -6
  472. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/nokogiri_html_parser.rb +0 -22
  473. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/rubyurl.rb +0 -14
  474. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/stackexchange.rb +0 -24
  475. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/tripit_sign_in.rb +0 -33
  476. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/twitter.rb +0 -31
  477. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/examples/whoismyrep.rb +0 -10
  478. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/basic_authentication.feature +0 -20
  479. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/command_line.feature +0 -7
  480. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/deals_with_http_error_codes.feature +0 -26
  481. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/digest_authentication.feature +0 -20
  482. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/handles_compressed_responses.feature +0 -27
  483. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/handles_multiple_formats.feature +0 -57
  484. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/env.rb +0 -22
  485. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/httparty_response_steps.rb +0 -52
  486. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/httparty_steps.rb +0 -43
  487. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/mongrel_helper.rb +0 -94
  488. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/steps/remote_service_steps.rb +0 -74
  489. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/supports_read_timeout_option.feature +0 -13
  490. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/supports_redirection.feature +0 -22
  491. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/features/supports_timeout_option.feature +0 -13
  492. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/httparty.gemspec +0 -26
  493. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty.rb +0 -600
  494. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/connection_adapter.rb +0 -187
  495. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb +0 -22
  496. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/core_extensions.rb +0 -32
  497. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/exceptions.rb +0 -29
  498. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/hash_conversions.rb +0 -51
  499. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/logger/apache_logger.rb +0 -22
  500. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/logger/curl_logger.rb +0 -48
  501. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/logger/logger.rb +0 -18
  502. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/module_inheritable_attributes.rb +0 -56
  503. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/net_digest_auth.rb +0 -84
  504. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/parser.rb +0 -141
  505. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/request.rb +0 -331
  506. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/response.rb +0 -72
  507. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/response/headers.rb +0 -31
  508. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/lib/httparty/version.rb +0 -3
  509. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/script/release +0 -42
  510. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/delicious.xml +0 -23
  511. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/empty.xml +0 -0
  512. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/google.html +0 -3
  513. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generate.sh +0 -29
  514. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/1fe462c2.0 +0 -16
  515. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/bogushost.crt +0 -13
  516. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/ca.crt +0 -16
  517. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/ca.key +0 -15
  518. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/selfsigned.crt +0 -14
  519. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/server.crt +0 -13
  520. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/generated/server.key +0 -15
  521. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/ssl/openssl-exts.cnf +0 -9
  522. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/twitter.csv +0 -2
  523. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/twitter.json +0 -1
  524. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/twitter.xml +0 -403
  525. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/fixtures/undefined_method_add_node_for_nil.xml +0 -2
  526. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/connection_adapter_spec.rb +0 -354
  527. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/cookie_hash_spec.rb +0 -83
  528. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/exception_spec.rb +0 -23
  529. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/logger/apache_logger_spec.rb +0 -26
  530. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/logger/curl_logger_spec.rb +0 -18
  531. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/logger/logger_spec.rb +0 -22
  532. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/net_digest_auth_spec.rb +0 -152
  533. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/parser_spec.rb +0 -165
  534. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/request_spec.rb +0 -638
  535. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/response_spec.rb +0 -221
  536. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty/ssl_spec.rb +0 -74
  537. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/httparty_spec.rb +0 -764
  538. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/spec.opts +0 -2
  539. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/spec_helper.rb +0 -37
  540. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/support/ssl_test_helper.rb +0 -47
  541. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/support/ssl_test_server.rb +0 -80
  542. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/spec/support/stub_response.rb +0 -43
  543. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/website/css/common.css +0 -47
  544. data/vendor/bundle/ruby/1.9.1/gems/httparty-0.13.1/website/index.html +0 -73
  545. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/CHANGES +0 -284
  546. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/COPYING +0 -58
  547. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/COPYING-json-jruby +0 -57
  548. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/GPL +0 -340
  549. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/Gemfile +0 -11
  550. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/README-json-jruby.markdown +0 -33
  551. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/README.rdoc +0 -358
  552. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/Rakefile +0 -412
  553. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/TODO +0 -1
  554. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/VERSION +0 -1
  555. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/data/example.json +0 -1
  556. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/data/index.html +0 -38
  557. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/data/prototype.js +0 -4184
  558. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/fbuffer/fbuffer.h +0 -181
  559. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/Makefile +0 -221
  560. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/depend +0 -1
  561. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/extconf.rb +0 -14
  562. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/generator.bundle +0 -0
  563. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/generator.c +0 -1435
  564. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/generator.h +0 -148
  565. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/generator/generator.o +0 -0
  566. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/Makefile +0 -221
  567. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/depend +0 -1
  568. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/extconf.rb +0 -13
  569. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.bundle +0 -0
  570. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.c +0 -2204
  571. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.h +0 -77
  572. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.o +0 -0
  573. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/ext/json/ext/parser/parser.rl +0 -927
  574. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/install.rb +0 -23
  575. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/ByteListTranscoder.java +0 -167
  576. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/Generator.java +0 -444
  577. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/GeneratorMethods.java +0 -232
  578. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/GeneratorService.java +0 -43
  579. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/GeneratorState.java +0 -543
  580. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/OptionsReader.java +0 -114
  581. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/Parser.java +0 -2644
  582. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/Parser.rl +0 -968
  583. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/ParserService.java +0 -35
  584. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/RuntimeInfo.java +0 -121
  585. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/StringDecoder.java +0 -167
  586. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/StringEncoder.java +0 -106
  587. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/java/src/json/ext/Utils.java +0 -89
  588. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/json-java.gemspec +0 -23
  589. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/json.gemspec +0 -38
  590. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/json_pure.gemspec +0 -40
  591. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json.rb +0 -62
  592. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/bigdecimal.rb +0 -28
  593. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/complex.rb +0 -22
  594. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/core.rb +0 -11
  595. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/date.rb +0 -34
  596. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/date_time.rb +0 -50
  597. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/exception.rb +0 -31
  598. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/ostruct.rb +0 -31
  599. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/range.rb +0 -29
  600. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/rational.rb +0 -22
  601. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/regexp.rb +0 -30
  602. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/struct.rb +0 -30
  603. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/symbol.rb +0 -25
  604. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/add/time.rb +0 -38
  605. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/common.rb +0 -484
  606. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/ext.rb +0 -21
  607. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/ext/generator.bundle +0 -0
  608. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/ext/parser.bundle +0 -0
  609. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/generic_object.rb +0 -70
  610. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/pure.rb +0 -21
  611. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/pure/generator.rb +0 -522
  612. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/pure/parser.rb +0 -359
  613. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/lib/json/version.rb +0 -8
  614. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail1.json +0 -1
  615. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail10.json +0 -1
  616. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail11.json +0 -1
  617. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail12.json +0 -1
  618. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail13.json +0 -1
  619. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail14.json +0 -1
  620. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail18.json +0 -1
  621. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail19.json +0 -1
  622. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail2.json +0 -1
  623. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail20.json +0 -1
  624. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail21.json +0 -1
  625. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail22.json +0 -1
  626. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail23.json +0 -1
  627. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail24.json +0 -1
  628. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail25.json +0 -1
  629. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail27.json +0 -2
  630. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail28.json +0 -2
  631. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail3.json +0 -1
  632. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail4.json +0 -1
  633. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail5.json +0 -1
  634. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail6.json +0 -1
  635. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail7.json +0 -1
  636. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail8.json +0 -1
  637. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/fail9.json +0 -1
  638. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass1.json +0 -56
  639. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass15.json +0 -1
  640. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass16.json +0 -1
  641. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass17.json +0 -1
  642. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass2.json +0 -1
  643. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass26.json +0 -1
  644. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/fixtures/pass3.json +0 -6
  645. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/setup_variant.rb +0 -11
  646. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json.rb +0 -545
  647. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_addition.rb +0 -196
  648. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_encoding.rb +0 -65
  649. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_fixtures.rb +0 -35
  650. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_generate.rb +0 -322
  651. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_generic_object.rb +0 -75
  652. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_string_matching.rb +0 -39
  653. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tests/test_json_unicode.rb +0 -72
  654. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tools/fuzz.rb +0 -139
  655. data/vendor/bundle/ruby/1.9.1/gems/json-1.8.1/tools/server.rb +0 -62
  656. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/LICENSE +0 -1
  657. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/README +0 -1177
  658. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/README.erb +0 -881
  659. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/Rakefile +0 -394
  660. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/TODO +0 -23
  661. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/a.rb +0 -3
  662. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main.rb +0 -93
  663. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/cast.rb +0 -163
  664. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/dsl.rb +0 -77
  665. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/factories.rb +0 -28
  666. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/getoptlong.rb +0 -470
  667. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/logger.rb +0 -51
  668. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/mode.rb +0 -46
  669. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/parameter.rb +0 -735
  670. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/program.rb +0 -6
  671. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/program/class_methods.rb +0 -381
  672. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/program/instance_methods.rb +0 -303
  673. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/softspoken.rb +0 -12
  674. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/stdext.rb +0 -36
  675. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/test.rb +0 -89
  676. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/usage.rb +0 -212
  677. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/lib/main/util.rb +0 -109
  678. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/main.gemspec +0 -74
  679. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/a.rb +0 -17
  680. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/b.rb +0 -17
  681. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/c.rb +0 -21
  682. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/d.rb +0 -26
  683. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/e.rb +0 -27
  684. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/f.rb +0 -29
  685. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/g.rb +0 -10
  686. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/h.rb +0 -36
  687. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/samples/j.rb +0 -31
  688. data/vendor/bundle/ruby/1.9.1/gems/main-6.0.0/test/main_test.rb +0 -954
  689. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/LICENSE +0 -1
  690. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/README +0 -1177
  691. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/README.erb +0 -881
  692. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/Rakefile +0 -394
  693. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/TODO +0 -23
  694. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/a.rb +0 -28
  695. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main.rb +0 -94
  696. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/cast.rb +0 -163
  697. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/daemon.rb +0 -525
  698. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/dsl.rb +0 -77
  699. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/factories.rb +0 -28
  700. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/getoptlong.rb +0 -470
  701. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/logger.rb +0 -51
  702. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/mode.rb +0 -46
  703. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/parameter.rb +0 -735
  704. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/program.rb +0 -6
  705. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/program/class_methods.rb +0 -392
  706. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/program/instance_methods.rb +0 -308
  707. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/softspoken.rb +0 -12
  708. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/stdext.rb +0 -36
  709. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/test.rb +0 -89
  710. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/usage.rb +0 -212
  711. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/lib/main/util.rb +0 -109
  712. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/main.gemspec +0 -75
  713. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/a.rb +0 -17
  714. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/b.rb +0 -17
  715. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/c.rb +0 -21
  716. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/d.rb +0 -26
  717. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/e.rb +0 -27
  718. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/f.rb +0 -29
  719. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/g.rb +0 -10
  720. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/h.rb +0 -36
  721. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/samples/j.rb +0 -31
  722. data/vendor/bundle/ruby/1.9.1/gems/main-6.1.0/test/main_test.rb +0 -954
  723. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/LICENSE +0 -1
  724. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/README +0 -145
  725. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/Rakefile +0 -394
  726. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/a.rb +0 -22
  727. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map.rb +0 -1190
  728. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map/integrations/active_record.rb +0 -140
  729. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map/options.rb +0 -188
  730. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map/params.rb +0 -79
  731. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/lib/map/struct.rb +0 -52
  732. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/map.gemspec +0 -46
  733. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/test/leak.rb +0 -61
  734. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/test/lib/testing.rb +0 -74
  735. data/vendor/bundle/ruby/1.9.1/gems/map-6.5.5/test/map_test.rb +0 -802
  736. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/Gemfile +0 -2
  737. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/LICENSE +0 -25
  738. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/README.markdown +0 -91
  739. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/Rakefile +0 -79
  740. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/lib/method_source.rb +0 -141
  741. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/lib/method_source/code_helpers.rb +0 -154
  742. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/lib/method_source/source_location.rb +0 -138
  743. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/lib/method_source/version.rb +0 -3
  744. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/method_source.gemspec +0 -33
  745. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/test/test.rb +0 -138
  746. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/test/test_code_helpers.rb +0 -41
  747. data/vendor/bundle/ruby/1.9.1/gems/method_source-0.8.2/test/test_helper.rb +0 -98
  748. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/CHANGELOG.md +0 -220
  749. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/CONTRIBUTING.md +0 -46
  750. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/Gemfile +0 -29
  751. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/LICENSE.md +0 -20
  752. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/README.md +0 -119
  753. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/Rakefile +0 -25
  754. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json.rb +0 -158
  755. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapter.rb +0 -37
  756. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapter_error.rb +0 -15
  757. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/gson.rb +0 -21
  758. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/jr_jackson.rb +0 -19
  759. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/json_common.rb +0 -25
  760. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/json_gem.rb +0 -11
  761. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/json_pure.rb +0 -11
  762. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/nsjsonserialization.rb +0 -34
  763. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/oj.rb +0 -25
  764. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/ok_json.rb +0 -24
  765. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/adapters/yajl.rb +0 -19
  766. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/convertible_hash_keys.rb +0 -43
  767. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/options.rb +0 -38
  768. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/parse_error.rb +0 -17
  769. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/vendor/okjson.rb +0 -606
  770. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/lib/multi_json/version.rb +0 -20
  771. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/multi_json.gemspec +0 -22
  772. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/gson_adapter_spec.rb +0 -10
  773. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/jr_jackson_adapter_spec.rb +0 -10
  774. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/json_gem_adapter_spec.rb +0 -9
  775. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/json_pure_adapter_spec.rb +0 -9
  776. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/multi_json_spec.rb +0 -200
  777. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/nsjsonserialization_adapter_spec.rb +0 -10
  778. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/oj_adapter_spec.rb +0 -20
  779. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/ok_json_adapter_spec.rb +0 -7
  780. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/shared/adapter.rb +0 -236
  781. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/shared/json_common_adapter.rb +0 -30
  782. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/shared/options.rb +0 -119
  783. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/spec_helper.rb +0 -77
  784. data/vendor/bundle/ruby/1.9.1/gems/multi_json-1.10.1/spec/yajl_adapter_spec.rb +0 -10
  785. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/CHANGELOG.md +0 -93
  786. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/CONTRIBUTING.md +0 -49
  787. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/LICENSE.md +0 -20
  788. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/README.md +0 -97
  789. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/Rakefile +0 -21
  790. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml.rb +0 -296
  791. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/libxml.rb +0 -30
  792. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/libxml2_parser.rb +0 -74
  793. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/nokogiri.rb +0 -32
  794. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/ox.rb +0 -97
  795. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/parsers/rexml.rb +0 -113
  796. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/lib/multi_xml/version.rb +0 -3
  797. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/multi_xml.gemspec +0 -24
  798. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/spec/helper.rb +0 -17
  799. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/spec/multi_xml_spec.rb +0 -43
  800. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/spec/parser_shared_example.rb +0 -694
  801. data/vendor/bundle/ruby/1.9.1/gems/multi_xml-0.5.5/spec/speed.rb +0 -63
  802. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/CHANGELOG +0 -534
  803. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/CONTRIBUTORS +0 -55
  804. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/Gemfile +0 -12
  805. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/LICENSE +0 -25
  806. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/README.markdown +0 -400
  807. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/Rakefile +0 -140
  808. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/TODO +0 -117
  809. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/bin/pry +0 -16
  810. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry.rb +0 -274
  811. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/cli.rb +0 -202
  812. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/code.rb +0 -385
  813. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/code/code_range.rb +0 -70
  814. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/code/loc.rb +0 -92
  815. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/code_object.rb +0 -153
  816. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/command.rb +0 -689
  817. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/command_set.rb +0 -400
  818. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands.rb +0 -6
  819. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/amend_line.rb +0 -99
  820. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/bang.rb +0 -20
  821. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/bang_pry.rb +0 -17
  822. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat.rb +0 -53
  823. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat/abstract_formatter.rb +0 -27
  824. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat/exception_formatter.rb +0 -78
  825. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat/file_formatter.rb +0 -84
  826. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cat/input_expression_formatter.rb +0 -43
  827. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/cd.rb +0 -30
  828. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/code_collector.rb +0 -165
  829. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/disable_pry.rb +0 -27
  830. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/disabled_commands.rb +0 -2
  831. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/easter_eggs.rb +0 -112
  832. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/edit.rb +0 -207
  833. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/edit/exception_patcher.rb +0 -25
  834. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/edit/file_and_line_locator.rb +0 -38
  835. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/edit/method_patcher.rb +0 -122
  836. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/exit.rb +0 -42
  837. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/exit_all.rb +0 -29
  838. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/exit_program.rb +0 -24
  839. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/find_method.rb +0 -199
  840. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/fix_indent.rb +0 -19
  841. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gem_cd.rb +0 -26
  842. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gem_install.rb +0 -29
  843. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gem_list.rb +0 -33
  844. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gem_open.rb +0 -29
  845. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/gist.rb +0 -102
  846. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/help.rb +0 -164
  847. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/hist.rb +0 -161
  848. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/import_set.rb +0 -22
  849. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/install_command.rb +0 -51
  850. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/jump_to.rb +0 -29
  851. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/ls.rb +0 -338
  852. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/nesting.rb +0 -25
  853. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/play.rb +0 -69
  854. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/pry_backtrace.rb +0 -26
  855. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/pry_version.rb +0 -17
  856. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/raise_up.rb +0 -32
  857. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/reload_code.rb +0 -65
  858. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/reset.rb +0 -18
  859. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/ri.rb +0 -56
  860. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/save_file.rb +0 -61
  861. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/shell_command.rb +0 -43
  862. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/shell_mode.rb +0 -27
  863. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/show_doc.rb +0 -78
  864. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/show_info.rb +0 -200
  865. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/show_input.rb +0 -17
  866. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/show_source.rb +0 -38
  867. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/simple_prompt.rb +0 -22
  868. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/stat.rb +0 -40
  869. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/switch_to.rb +0 -23
  870. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/toggle_color.rb +0 -20
  871. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/whereami.rb +0 -182
  872. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/commands/wtf.rb +0 -57
  873. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/completion.rb +0 -321
  874. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/config.rb +0 -258
  875. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/core_extensions.rb +0 -121
  876. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/custom_completions.rb +0 -6
  877. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/editor.rb +0 -129
  878. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers.rb +0 -5
  879. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/base_helpers.rb +0 -200
  880. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/command_helpers.rb +0 -154
  881. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/documentation_helpers.rb +0 -76
  882. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/options_helpers.rb +0 -27
  883. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/table.rb +0 -109
  884. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/helpers/text.rb +0 -108
  885. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/history.rb +0 -124
  886. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/history_array.rb +0 -116
  887. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/hooks.rb +0 -250
  888. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/indent.rb +0 -406
  889. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/method.rb +0 -551
  890. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/method/disowned.rb +0 -53
  891. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/method/weird_method_locator.rb +0 -186
  892. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/module_candidate.rb +0 -146
  893. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/pager.rb +0 -90
  894. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/plugins.rb +0 -103
  895. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/pry_class.rb +0 -456
  896. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/pry_instance.rb +0 -765
  897. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/rbx_method.rb +0 -13
  898. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/rbx_path.rb +0 -22
  899. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/repl_file_loader.rb +0 -80
  900. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/rubygem.rb +0 -74
  901. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/terminal.rb +0 -78
  902. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/test/helper.rb +0 -185
  903. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/version.rb +0 -3
  904. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/lib/pry/wrapped_module.rb +0 -387
  905. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/man/pry.1 +0 -195
  906. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/man/pry.1.html +0 -204
  907. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/man/pry.1.ronn +0 -141
  908. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/pry.gemspec +0 -29
  909. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/Procfile +0 -3
  910. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/cli_spec.rb +0 -78
  911. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/code_object_spec.rb +0 -277
  912. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/code_spec.rb +0 -219
  913. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/command_helpers_spec.rb +0 -29
  914. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/command_integration_spec.rb +0 -644
  915. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/command_set_spec.rb +0 -627
  916. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/command_spec.rb +0 -821
  917. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/amend_line_spec.rb +0 -247
  918. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/bang_spec.rb +0 -19
  919. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/cat_spec.rb +0 -164
  920. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/cd_spec.rb +0 -250
  921. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/disable_pry_spec.rb +0 -25
  922. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/edit_spec.rb +0 -727
  923. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/exit_all_spec.rb +0 -34
  924. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/exit_program_spec.rb +0 -19
  925. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/exit_spec.rb +0 -34
  926. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/find_method_spec.rb +0 -70
  927. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/gem_list_spec.rb +0 -26
  928. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/gist_spec.rb +0 -79
  929. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/help_spec.rb +0 -56
  930. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/hist_spec.rb +0 -181
  931. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/jump_to_spec.rb +0 -15
  932. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/ls_spec.rb +0 -181
  933. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/play_spec.rb +0 -140
  934. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/raise_up_spec.rb +0 -56
  935. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/save_file_spec.rb +0 -177
  936. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/show_doc_spec.rb +0 -510
  937. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/show_input_spec.rb +0 -17
  938. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/show_source_spec.rb +0 -782
  939. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/commands/whereami_spec.rb +0 -203
  940. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/completion_spec.rb +0 -241
  941. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/control_d_handler_spec.rb +0 -58
  942. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/documentation_helper_spec.rb +0 -73
  943. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/editor_spec.rb +0 -79
  944. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/exception_whitelist_spec.rb +0 -21
  945. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/candidate_helper1.rb +0 -11
  946. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/candidate_helper2.rb +0 -8
  947. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/example.erb +0 -5
  948. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/example_nesting.rb +0 -33
  949. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/show_source_doc_examples.rb +0 -15
  950. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/testrc +0 -2
  951. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/testrcbad +0 -2
  952. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/fixtures/whereami_helper.rb +0 -6
  953. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/helper.rb +0 -34
  954. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/helpers/bacon.rb +0 -86
  955. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/helpers/mock_pry.rb +0 -43
  956. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/helpers/table_spec.rb +0 -105
  957. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/history_array_spec.rb +0 -67
  958. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/hooks_spec.rb +0 -522
  959. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/indent_spec.rb +0 -301
  960. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/input_stack_spec.rb +0 -90
  961. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/method_spec.rb +0 -482
  962. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/prompt_spec.rb +0 -60
  963. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/pry_defaults_spec.rb +0 -419
  964. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/pry_history_spec.rb +0 -99
  965. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/pry_output_spec.rb +0 -95
  966. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/pry_spec.rb +0 -515
  967. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/run_command_spec.rb +0 -25
  968. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/sticky_locals_spec.rb +0 -157
  969. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/syntax_checking_spec.rb +0 -81
  970. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/spec/wrapped_module_spec.rb +0 -261
  971. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/wiki/Customizing-pry.md +0 -397
  972. data/vendor/bundle/ruby/1.9.1/gems/pry-0.9.12.6/wiki/Home.md +0 -4
  973. data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/README +0 -144
  974. data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/Rakefile +0 -390
  975. data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/bin/sekrets +0 -372
  976. data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/lib/sekrets.rb +0 -511
  977. data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/lib/sekrets/capistrano.rb +0 -37
  978. data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/sekrets.gemspec +0 -50
  979. data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/test/lib/testing.rb +0 -75
  980. data/vendor/bundle/ruby/1.9.1/gems/sekrets-1.7.0/test/sekrets_test.rb +0 -167
  981. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/CHANGELOG +0 -5790
  982. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/MIT-LICENSE +0 -19
  983. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/README.rdoc +0 -815
  984. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/Rakefile +0 -186
  985. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/bin/sequel +0 -244
  986. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/active_record.rdoc +0 -912
  987. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/advanced_associations.rdoc +0 -818
  988. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/association_basics.rdoc +0 -1763
  989. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/bin_sequel.rdoc +0 -144
  990. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/cheat_sheet.rdoc +0 -220
  991. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/code_order.rdoc +0 -96
  992. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/core_extensions.rdoc +0 -364
  993. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/dataset_basics.rdoc +0 -105
  994. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/dataset_filtering.rdoc +0 -191
  995. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/extensions.rdoc +0 -84
  996. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/mass_assignment.rdoc +0 -55
  997. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/migration.rdoc +0 -611
  998. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/model_hooks.rdoc +0 -262
  999. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/model_plugins.rdoc +0 -270
  1000. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/mssql_stored_procedures.rdoc +0 -43
  1001. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/object_model.rdoc +0 -573
  1002. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/opening_databases.rdoc +0 -489
  1003. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/postgresql.rdoc +0 -326
  1004. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/prepared_statements.rdoc +0 -139
  1005. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/querying.rdoc +0 -1017
  1006. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/reflection.rdoc +0 -121
  1007. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.0.txt +0 -38
  1008. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.1.txt +0 -143
  1009. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.3.txt +0 -101
  1010. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.4.0.txt +0 -53
  1011. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/1.5.0.txt +0 -155
  1012. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.0.0.txt +0 -298
  1013. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.1.0.txt +0 -271
  1014. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.10.0.txt +0 -328
  1015. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.11.0.txt +0 -215
  1016. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.12.0.txt +0 -534
  1017. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.2.0.txt +0 -253
  1018. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.3.0.txt +0 -88
  1019. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.4.0.txt +0 -106
  1020. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.5.0.txt +0 -137
  1021. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.6.0.txt +0 -157
  1022. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.7.0.txt +0 -166
  1023. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.8.0.txt +0 -171
  1024. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/2.9.0.txt +0 -97
  1025. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.0.0.txt +0 -221
  1026. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.1.0.txt +0 -406
  1027. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.10.0.txt +0 -286
  1028. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.11.0.txt +0 -254
  1029. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.12.0.txt +0 -304
  1030. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.13.0.txt +0 -210
  1031. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.14.0.txt +0 -118
  1032. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.15.0.txt +0 -78
  1033. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.16.0.txt +0 -45
  1034. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.17.0.txt +0 -58
  1035. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.18.0.txt +0 -120
  1036. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.19.0.txt +0 -67
  1037. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.2.0.txt +0 -268
  1038. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.20.0.txt +0 -41
  1039. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.21.0.txt +0 -87
  1040. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.22.0.txt +0 -39
  1041. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.23.0.txt +0 -172
  1042. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.24.0.txt +0 -420
  1043. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.25.0.txt +0 -88
  1044. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.26.0.txt +0 -88
  1045. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.27.0.txt +0 -82
  1046. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.28.0.txt +0 -304
  1047. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.29.0.txt +0 -459
  1048. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.3.0.txt +0 -192
  1049. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.30.0.txt +0 -135
  1050. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.31.0.txt +0 -146
  1051. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.32.0.txt +0 -202
  1052. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.33.0.txt +0 -157
  1053. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.34.0.txt +0 -671
  1054. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.35.0.txt +0 -144
  1055. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.36.0.txt +0 -245
  1056. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.37.0.txt +0 -338
  1057. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.38.0.txt +0 -234
  1058. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.39.0.txt +0 -237
  1059. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.4.0.txt +0 -325
  1060. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.40.0.txt +0 -73
  1061. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.41.0.txt +0 -155
  1062. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.42.0.txt +0 -74
  1063. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.43.0.txt +0 -105
  1064. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.44.0.txt +0 -152
  1065. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.45.0.txt +0 -179
  1066. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.46.0.txt +0 -122
  1067. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.47.0.txt +0 -270
  1068. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.48.0.txt +0 -477
  1069. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.5.0.txt +0 -510
  1070. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.6.0.txt +0 -366
  1071. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.7.0.txt +0 -179
  1072. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.8.0.txt +0 -151
  1073. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/3.9.0.txt +0 -233
  1074. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.0.0.txt +0 -262
  1075. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.1.0.txt +0 -85
  1076. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.10.0.txt +0 -226
  1077. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.11.0.txt +0 -147
  1078. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.12.0.txt +0 -105
  1079. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.13.0.txt +0 -169
  1080. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.14.0.txt +0 -68
  1081. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.15.0.txt +0 -56
  1082. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.2.0.txt +0 -129
  1083. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.3.0.txt +0 -40
  1084. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.4.0.txt +0 -92
  1085. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.5.0.txt +0 -34
  1086. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.6.0.txt +0 -30
  1087. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.7.0.txt +0 -103
  1088. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.8.0.txt +0 -175
  1089. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/release_notes/4.9.0.txt +0 -190
  1090. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/schema_modification.rdoc +0 -654
  1091. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/security.rdoc +0 -370
  1092. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/sharding.rdoc +0 -245
  1093. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/sql.rdoc +0 -589
  1094. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/testing.rdoc +0 -176
  1095. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/thread_safety.rdoc +0 -17
  1096. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/transactions.rdoc +0 -168
  1097. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/validations.rdoc +0 -540
  1098. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/doc/virtual_rows.rdoc +0 -272
  1099. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel.rb +0 -1
  1100. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/ado.rb +0 -151
  1101. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/ado/access.rb +0 -335
  1102. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/ado/mssql.rb +0 -69
  1103. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/amalgalite.rb +0 -179
  1104. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/cubrid.rb +0 -143
  1105. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/db2.rb +0 -229
  1106. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/dbi.rb +0 -101
  1107. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/do.rb +0 -156
  1108. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/do/mysql.rb +0 -64
  1109. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/do/postgres.rb +0 -42
  1110. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/do/sqlite3.rb +0 -40
  1111. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/fdbsql.rb +0 -285
  1112. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/firebird.rb +0 -104
  1113. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/ibmdb.rb +0 -476
  1114. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/informix.rb +0 -67
  1115. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc.rb +0 -794
  1116. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/as400.rb +0 -82
  1117. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/cubrid.rb +0 -62
  1118. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/db2.rb +0 -91
  1119. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/derby.rb +0 -312
  1120. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/fdbsql.rb +0 -65
  1121. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/firebirdsql.rb +0 -34
  1122. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/h2.rb +0 -227
  1123. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/hsqldb.rb +0 -231
  1124. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/informix-sqli.rb +0 -31
  1125. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/jdbcprogress.rb +0 -31
  1126. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/jtds.rb +0 -45
  1127. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/mssql.rb +0 -47
  1128. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/mysql.rb +0 -90
  1129. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/oracle.rb +0 -140
  1130. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/postgresql.rb +0 -215
  1131. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/sqlanywhere.rb +0 -82
  1132. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/sqlite.rb +0 -82
  1133. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/sqlserver.rb +0 -61
  1134. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/jdbc/transactions.rb +0 -109
  1135. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/mock.rb +0 -391
  1136. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/mysql.rb +0 -372
  1137. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/mysql2.rb +0 -200
  1138. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/odbc.rb +0 -149
  1139. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/odbc/db2.rb +0 -9
  1140. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/odbc/mssql.rb +0 -61
  1141. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/odbc/progress.rb +0 -8
  1142. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/openbase.rb +0 -53
  1143. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/oracle.rb +0 -459
  1144. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/postgres.rb +0 -877
  1145. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/access.rb +0 -299
  1146. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/cubrid.rb +0 -243
  1147. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/db2.rb +0 -403
  1148. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/fdbsql.rb +0 -550
  1149. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/firebird.rb +0 -245
  1150. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/informix.rb +0 -52
  1151. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/mssql.rb +0 -1037
  1152. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/mysql.rb +0 -984
  1153. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/mysql_prepared_statements.rb +0 -182
  1154. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/oracle.rb +0 -522
  1155. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/postgres.rb +0 -1617
  1156. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/progress.rb +0 -38
  1157. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/sqlanywhere.rb +0 -470
  1158. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/shared/sqlite.rb +0 -729
  1159. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/sqlanywhere.rb +0 -177
  1160. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/sqlite.rb +0 -413
  1161. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/swift.rb +0 -150
  1162. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/swift/mysql.rb +0 -47
  1163. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/swift/postgres.rb +0 -45
  1164. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/swift/sqlite.rb +0 -35
  1165. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/tinytds.rb +0 -282
  1166. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb +0 -75
  1167. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/emulate_offset_with_row_number.rb +0 -62
  1168. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/pg_types.rb +0 -68
  1169. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/replace.rb +0 -36
  1170. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/split_alter_table.rb +0 -44
  1171. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/adapters/utils/stored_procedures.rb +0 -74
  1172. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/ast_transformer.rb +0 -200
  1173. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool.rb +0 -110
  1174. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool/sharded_single.rb +0 -98
  1175. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool/sharded_threaded.rb +0 -265
  1176. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool/single.rb +0 -38
  1177. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/connection_pool/threaded.rb +0 -198
  1178. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/core.rb +0 -394
  1179. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database.rb +0 -20
  1180. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/connecting.rb +0 -318
  1181. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/dataset.rb +0 -69
  1182. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/dataset_defaults.rb +0 -175
  1183. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/features.rb +0 -134
  1184. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/logging.rb +0 -73
  1185. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/misc.rb +0 -534
  1186. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/query.rb +0 -329
  1187. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/schema_generator.rb +0 -525
  1188. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/schema_methods.rb +0 -964
  1189. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/database/transactions.rb +0 -353
  1190. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset.rb +0 -40
  1191. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/actions.rb +0 -1045
  1192. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/features.rb +0 -203
  1193. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/graph.rb +0 -272
  1194. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/misc.rb +0 -279
  1195. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/mutation.rb +0 -109
  1196. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/placeholder_literalizer.rb +0 -179
  1197. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/prepared_statements.rb +0 -283
  1198. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/query.rb +0 -1136
  1199. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/dataset/sql.rb +0 -1555
  1200. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/deprecated.rb +0 -58
  1201. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/exceptions.rb +0 -77
  1202. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/_pretty_table.rb +0 -84
  1203. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/arbitrary_servers.rb +0 -110
  1204. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/blank.rb +0 -47
  1205. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/columns_introspection.rb +0 -83
  1206. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/connection_validator.rb +0 -110
  1207. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/constraint_validations.rb +0 -455
  1208. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/core_extensions.rb +0 -230
  1209. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/core_refinements.rb +0 -221
  1210. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/current_datetime_timestamp.rb +0 -58
  1211. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/dataset_source_alias.rb +0 -91
  1212. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/date_arithmetic.rb +0 -192
  1213. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/empty_array_ignore_nulls.rb +0 -34
  1214. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/error_sql.rb +0 -72
  1215. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/eval_inspect.rb +0 -182
  1216. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/filter_having.rb +0 -59
  1217. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/from_block.rb +0 -32
  1218. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/graph_each.rb +0 -75
  1219. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/hash_aliases.rb +0 -45
  1220. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/inflector.rb +0 -246
  1221. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/looser_typecasting.rb +0 -44
  1222. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/meta_def.rb +0 -31
  1223. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/migration.rb +0 -736
  1224. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/mssql_emulate_lateral_with_apply.rb +0 -80
  1225. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/named_timezones.rb +0 -99
  1226. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/null_dataset.rb +0 -105
  1227. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pagination.rb +0 -121
  1228. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_array.rb +0 -606
  1229. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_array_ops.rb +0 -324
  1230. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_enum.rb +0 -136
  1231. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_hstore.rb +0 -357
  1232. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_hstore_ops.rb +0 -349
  1233. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_inet.rb +0 -118
  1234. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_interval.rb +0 -198
  1235. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_json.rb +0 -365
  1236. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_json_ops.rb +0 -434
  1237. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_loose_count.rb +0 -33
  1238. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_range.rb +0 -546
  1239. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_range_ops.rb +0 -162
  1240. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_row.rb +0 -615
  1241. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_row_ops.rb +0 -194
  1242. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pg_static_cache_updater.rb +0 -140
  1243. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/pretty_table.rb +0 -36
  1244. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/query.rb +0 -78
  1245. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/query_literals.rb +0 -80
  1246. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/round_timestamps.rb +0 -52
  1247. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/ruby18_symbol_extensions.rb +0 -22
  1248. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/schema_caching.rb +0 -75
  1249. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/schema_dumper.rb +0 -476
  1250. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/select_remove.rb +0 -48
  1251. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/sequel_3_dataset_methods.rb +0 -118
  1252. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/server_block.rb +0 -149
  1253. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/set_overrides.rb +0 -72
  1254. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/split_array_nil.rb +0 -66
  1255. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/sql_expr.rb +0 -20
  1256. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/string_date_time.rb +0 -50
  1257. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/thread_local_timezones.rb +0 -55
  1258. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/extensions/to_dot.rb +0 -154
  1259. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model.rb +0 -175
  1260. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/associations.rb +0 -3171
  1261. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/base.rb +0 -2306
  1262. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/dataset_module.rb +0 -30
  1263. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/default_inflections.rb +0 -45
  1264. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/errors.rb +0 -58
  1265. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/exceptions.rb +0 -46
  1266. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/inflections.rb +0 -162
  1267. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/model/plugins.rb +0 -49
  1268. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/no_core_ext.rb +0 -1
  1269. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/active_model.rb +0 -99
  1270. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/after_initialize.rb +0 -37
  1271. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/association_autoreloading.rb +0 -7
  1272. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/association_dependencies.rb +0 -97
  1273. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/association_pks.rb +0 -167
  1274. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/association_proxies.rb +0 -105
  1275. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/auto_validations.rb +0 -161
  1276. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/blacklist_security.rb +0 -93
  1277. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/boolean_readers.rb +0 -56
  1278. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/caching.rb +0 -153
  1279. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/class_table_inheritance.rb +0 -292
  1280. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/column_select.rb +0 -57
  1281. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/composition.rb +0 -187
  1282. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/constraint_validations.rb +0 -229
  1283. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/dataset_associations.rb +0 -107
  1284. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/defaults_setter.rb +0 -69
  1285. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/dirty.rb +0 -231
  1286. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/eager_each.rb +0 -64
  1287. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/error_splitter.rb +0 -54
  1288. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/force_encoding.rb +0 -81
  1289. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/hook_class_methods.rb +0 -125
  1290. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/input_transformer.rb +0 -79
  1291. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/insert_returning_select.rb +0 -70
  1292. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/instance_filters.rb +0 -131
  1293. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/instance_hooks.rb +0 -96
  1294. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/json_serializer.rb +0 -352
  1295. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/lazy_attributes.rb +0 -117
  1296. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/list.rb +0 -189
  1297. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/many_through_many.rb +0 -317
  1298. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/many_to_one_pk_lookup.rb +0 -7
  1299. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/modification_detection.rb +0 -90
  1300. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/mssql_optimistic_locking.rb +0 -92
  1301. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/nested_attributes.rb +0 -323
  1302. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/optimistic_locking.rb +0 -83
  1303. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/pg_array_associations.rb +0 -528
  1304. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/pg_row.rb +0 -123
  1305. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/pg_typecast_on_load.rb +0 -78
  1306. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/prepared_statements.rb +0 -205
  1307. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/prepared_statements_associations.rb +0 -116
  1308. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/prepared_statements_safe.rb +0 -73
  1309. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/prepared_statements_with_pk.rb +0 -59
  1310. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/rcte_tree.rb +0 -343
  1311. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/schema.rb +0 -80
  1312. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/scissors.rb +0 -33
  1313. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/serialization.rb +0 -235
  1314. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/serialization_modification_detection.rb +0 -84
  1315. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/sharding.rb +0 -117
  1316. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/single_table_inheritance.rb +0 -230
  1317. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/skip_create_refresh.rb +0 -35
  1318. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/split_values.rb +0 -64
  1319. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/static_cache.rb +0 -215
  1320. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/string_stripper.rb +0 -57
  1321. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/subclasses.rb +0 -61
  1322. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/table_select.rb +0 -41
  1323. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/tactical_eager_loading.rb +0 -85
  1324. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/timestamps.rb +0 -95
  1325. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/touch.rb +0 -140
  1326. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/tree.rb +0 -156
  1327. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/typecast_on_load.rb +0 -80
  1328. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/unlimited_update.rb +0 -31
  1329. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/update_or_create.rb +0 -60
  1330. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/update_primary_key.rb +0 -70
  1331. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/validation_class_methods.rb +0 -439
  1332. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/validation_helpers.rb +0 -291
  1333. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/plugins/xml_serializer.rb +0 -410
  1334. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/sql.rb +0 -1865
  1335. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/timezones.rb +0 -221
  1336. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/lib/sequel/version.rb +0 -18
  1337. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/db2_spec.rb +0 -148
  1338. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/fdbsql_spec.rb +0 -429
  1339. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/firebird_spec.rb +0 -417
  1340. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/informix_spec.rb +0 -100
  1341. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/mssql_spec.rb +0 -722
  1342. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/mysql_spec.rb +0 -1304
  1343. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/oracle_spec.rb +0 -315
  1344. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/postgres_spec.rb +0 -3537
  1345. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/spec_helper.rb +0 -76
  1346. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/sqlanywhere_spec.rb +0 -170
  1347. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/adapters/sqlite_spec.rb +0 -650
  1348. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/bin_spec.rb +0 -256
  1349. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/connection_pool_spec.rb +0 -982
  1350. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/database_spec.rb +0 -2487
  1351. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/dataset_spec.rb +0 -4970
  1352. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/deprecated_spec.rb +0 -70
  1353. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/expression_filters_spec.rb +0 -1197
  1354. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/mock_adapter_spec.rb +0 -462
  1355. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/object_graph_spec.rb +0 -303
  1356. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/placeholder_literalizer_spec.rb +0 -163
  1357. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/schema_generator_spec.rb +0 -179
  1358. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/schema_spec.rb +0 -1610
  1359. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/spec_helper.rb +0 -49
  1360. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core/version_spec.rb +0 -7
  1361. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/core_extensions_spec.rb +0 -695
  1362. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/active_model_spec.rb +0 -123
  1363. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/after_initialize_spec.rb +0 -24
  1364. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/arbitrary_servers_spec.rb +0 -109
  1365. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/association_dependencies_spec.rb +0 -117
  1366. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/association_pks_spec.rb +0 -281
  1367. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/association_proxies_spec.rb +0 -86
  1368. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/auto_validations_spec.rb +0 -158
  1369. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/blacklist_security_spec.rb +0 -87
  1370. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/blank_spec.rb +0 -69
  1371. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/boolean_readers_spec.rb +0 -93
  1372. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/caching_spec.rb +0 -270
  1373. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/class_table_inheritance_spec.rb +0 -274
  1374. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/column_select_spec.rb +0 -108
  1375. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/columns_introspection_spec.rb +0 -91
  1376. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/composition_spec.rb +0 -242
  1377. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/connection_validator_spec.rb +0 -118
  1378. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/constraint_validations_plugin_spec.rb +0 -274
  1379. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/constraint_validations_spec.rb +0 -325
  1380. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/core_refinements_spec.rb +0 -519
  1381. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/current_datetime_timestamp_spec.rb +0 -27
  1382. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/dataset_associations_spec.rb +0 -311
  1383. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/dataset_source_alias_spec.rb +0 -51
  1384. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/date_arithmetic_spec.rb +0 -157
  1385. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/defaults_setter_spec.rb +0 -101
  1386. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/dirty_spec.rb +0 -180
  1387. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/eager_each_spec.rb +0 -42
  1388. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/empty_array_ignore_nulls_spec.rb +0 -24
  1389. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/error_splitter_spec.rb +0 -18
  1390. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/error_sql_spec.rb +0 -20
  1391. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/eval_inspect_spec.rb +0 -73
  1392. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/filter_having_spec.rb +0 -40
  1393. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/force_encoding_spec.rb +0 -114
  1394. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/from_block_spec.rb +0 -21
  1395. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/graph_each_spec.rb +0 -109
  1396. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/hash_aliases_spec.rb +0 -24
  1397. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/hook_class_methods_spec.rb +0 -416
  1398. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/inflector_spec.rb +0 -183
  1399. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/input_transformer_spec.rb +0 -54
  1400. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/insert_returning_select_spec.rb +0 -46
  1401. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/instance_filters_spec.rb +0 -79
  1402. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/instance_hooks_spec.rb +0 -276
  1403. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/json_serializer_spec.rb +0 -267
  1404. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/lazy_attributes_spec.rb +0 -170
  1405. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/list_spec.rb +0 -265
  1406. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/looser_typecasting_spec.rb +0 -43
  1407. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/many_through_many_spec.rb +0 -2159
  1408. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/meta_def_spec.rb +0 -21
  1409. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/migration_spec.rb +0 -709
  1410. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/modification_detection_spec.rb +0 -80
  1411. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/mssql_optimistic_locking_spec.rb +0 -91
  1412. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/named_timezones_spec.rb +0 -108
  1413. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/nested_attributes_spec.rb +0 -697
  1414. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/null_dataset_spec.rb +0 -85
  1415. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/optimistic_locking_spec.rb +0 -128
  1416. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pagination_spec.rb +0 -118
  1417. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_array_associations_spec.rb +0 -736
  1418. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_array_ops_spec.rb +0 -143
  1419. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_array_spec.rb +0 -390
  1420. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_enum_spec.rb +0 -64
  1421. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_hstore_ops_spec.rb +0 -236
  1422. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_hstore_spec.rb +0 -206
  1423. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_inet_spec.rb +0 -52
  1424. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_interval_spec.rb +0 -76
  1425. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_json_ops_spec.rb +0 -226
  1426. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_json_spec.rb +0 -218
  1427. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_loose_count_spec.rb +0 -17
  1428. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_range_ops_spec.rb +0 -58
  1429. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_range_spec.rb +0 -404
  1430. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_row_ops_spec.rb +0 -60
  1431. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_row_plugin_spec.rb +0 -62
  1432. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_row_spec.rb +0 -360
  1433. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_static_cache_updater_spec.rb +0 -92
  1434. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pg_typecast_on_load_spec.rb +0 -63
  1435. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/prepared_statements_associations_spec.rb +0 -151
  1436. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/prepared_statements_safe_spec.rb +0 -61
  1437. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/prepared_statements_spec.rb +0 -103
  1438. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/prepared_statements_with_pk_spec.rb +0 -31
  1439. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/pretty_table_spec.rb +0 -92
  1440. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/query_literals_spec.rb +0 -167
  1441. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/query_spec.rb +0 -102
  1442. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/rcte_tree_spec.rb +0 -387
  1443. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/round_timestamps_spec.rb +0 -43
  1444. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/schema_caching_spec.rb +0 -41
  1445. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/schema_dumper_spec.rb +0 -788
  1446. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/schema_spec.rb +0 -113
  1447. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/scissors_spec.rb +0 -26
  1448. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/select_remove_spec.rb +0 -38
  1449. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/sequel_3_dataset_methods_spec.rb +0 -101
  1450. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/serialization_modification_detection_spec.rb +0 -98
  1451. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/serialization_spec.rb +0 -340
  1452. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/server_block_spec.rb +0 -90
  1453. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/set_overrides_spec.rb +0 -61
  1454. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/sharding_spec.rb +0 -198
  1455. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/shared_caching_spec.rb +0 -175
  1456. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/single_table_inheritance_spec.rb +0 -276
  1457. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/skip_create_refresh_spec.rb +0 -17
  1458. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/spec_helper.rb +0 -96
  1459. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/split_array_nil_spec.rb +0 -24
  1460. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/split_values_spec.rb +0 -22
  1461. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/sql_expr_spec.rb +0 -60
  1462. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/static_cache_spec.rb +0 -355
  1463. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/string_date_time_spec.rb +0 -95
  1464. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/string_stripper_spec.rb +0 -68
  1465. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/subclasses_spec.rb +0 -66
  1466. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/table_select_spec.rb +0 -71
  1467. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/tactical_eager_loading_spec.rb +0 -82
  1468. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/thread_local_timezones_spec.rb +0 -67
  1469. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/timestamps_spec.rb +0 -175
  1470. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/to_dot_spec.rb +0 -154
  1471. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/touch_spec.rb +0 -203
  1472. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/tree_spec.rb +0 -270
  1473. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/typecast_on_load_spec.rb +0 -80
  1474. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/unlimited_update_spec.rb +0 -20
  1475. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/update_or_create_spec.rb +0 -81
  1476. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/update_primary_key_spec.rb +0 -100
  1477. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/validation_class_methods_spec.rb +0 -1030
  1478. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/validation_helpers_spec.rb +0 -520
  1479. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/xml_serializer_spec.rb +0 -207
  1480. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_down_migration/001_create_alt_basic.rb +0 -4
  1481. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_down_migration/002_create_alt_advanced.rb +0 -4
  1482. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  1483. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_timestamped_migrations/1273253851_create_nodes.rb +0 -9
  1484. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_timestamped_migrations/1273253853_3_create_users.rb +0 -3
  1485. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_up_migration/001_create_alt_basic.rb +0 -4
  1486. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/bad_up_migration/002_create_alt_advanced.rb +0 -3
  1487. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/001_create_sessions.rb +0 -9
  1488. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/002_create_nodes.rb +0 -9
  1489. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/003_3_create_users.rb +0 -4
  1490. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/1273253850_create_artists.rb +0 -9
  1491. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/convert_to_timestamp_migrations/1273253852_create_albums.rb +0 -9
  1492. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_integer_migrations/001_create_alt_advanced.rb +0 -4
  1493. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_integer_migrations/001_create_alt_basic.rb +0 -4
  1494. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  1495. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_timestamped_migrations/1273253853_create_nodes.rb +0 -9
  1496. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/duplicate_timestamped_migrations/1273253853_create_users.rb +0 -4
  1497. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/integer_migrations/001_create_sessions.rb +0 -9
  1498. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/integer_migrations/002_create_nodes.rb +0 -9
  1499. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/integer_migrations/003_3_create_users.rb +0 -4
  1500. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  1501. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253850_create_artists.rb +0 -9
  1502. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253851_create_nodes.rb +0 -9
  1503. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253852_create_albums.rb +0 -9
  1504. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/interleaved_timestamped_migrations/1273253853_3_create_users.rb +0 -4
  1505. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/missing_integer_migrations/001_create_alt_basic.rb +0 -4
  1506. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/missing_integer_migrations/003_create_alt_advanced.rb +0 -4
  1507. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/missing_timestamped_migrations/1273253849_create_sessions.rb +0 -9
  1508. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/missing_timestamped_migrations/1273253853_3_create_users.rb +0 -4
  1509. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/001_reversible.rb +0 -5
  1510. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/002_reversible.rb +0 -5
  1511. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/003_reversible.rb +0 -5
  1512. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/004_reversible.rb +0 -5
  1513. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/reversible_migrations/005_reversible.rb +0 -10
  1514. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/timestamped_migrations/1273253849_create_sessions.rb +0 -9
  1515. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/timestamped_migrations/1273253851_create_nodes.rb +0 -9
  1516. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/timestamped_migrations/1273253853_3_create_users.rb +0 -4
  1517. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/transaction_specified_migrations/001_create_alt_basic.rb +0 -4
  1518. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/transaction_specified_migrations/002_create_basic.rb +0 -4
  1519. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/transaction_unspecified_migrations/001_create_alt_basic.rb +0 -3
  1520. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/transaction_unspecified_migrations/002_create_basic.rb +0 -3
  1521. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/uppercase_timestamped_migrations/1273253849_CREATE_SESSIONS.RB +0 -9
  1522. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/uppercase_timestamped_migrations/1273253851_CREATE_NODES.RB +0 -9
  1523. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/files/uppercase_timestamped_migrations/1273253853_3_CREATE_USERS.RB +0 -4
  1524. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/associations_test.rb +0 -2453
  1525. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/database_test.rb +0 -113
  1526. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/dataset_test.rb +0 -1798
  1527. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/eager_loader_test.rb +0 -687
  1528. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/migrator_test.rb +0 -240
  1529. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/model_test.rb +0 -226
  1530. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/plugin_test.rb +0 -2162
  1531. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/prepared_statement_test.rb +0 -426
  1532. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/schema_test.rb +0 -801
  1533. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/spec_helper.rb +0 -111
  1534. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/timezone_test.rb +0 -86
  1535. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/transaction_test.rb +0 -374
  1536. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/integration/type_test.rb +0 -133
  1537. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/association_reflection_spec.rb +0 -500
  1538. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/associations_spec.rb +0 -4316
  1539. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/base_spec.rb +0 -746
  1540. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/class_dataset_methods_spec.rb +0 -145
  1541. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/dataset_methods_spec.rb +0 -149
  1542. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/eager_loading_spec.rb +0 -2080
  1543. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/hooks_spec.rb +0 -536
  1544. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/inflector_spec.rb +0 -26
  1545. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/model_spec.rb +0 -992
  1546. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/plugins_spec.rb +0 -299
  1547. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/record_spec.rb +0 -2053
  1548. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/spec_helper.rb +0 -64
  1549. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/model/validations_spec.rb +0 -191
  1550. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/rspec_helper.rb +0 -22
  1551. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/sequel_coverage.rb +0 -15
  1552. data/vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/spec_config.rb +0 -2
  1553. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/CHANGES.md +0 -303
  1554. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/Gemfile +0 -3
  1555. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/LICENSE +0 -20
  1556. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/README.md +0 -182
  1557. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/Rakefile +0 -29
  1558. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/lib/slop.rb +0 -687
  1559. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/lib/slop/commands.rb +0 -196
  1560. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/lib/slop/option.rb +0 -209
  1561. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/slop.gemspec +0 -17
  1562. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/test/commands_test.rb +0 -26
  1563. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/test/helper.rb +0 -12
  1564. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/test/option_test.rb +0 -138
  1565. data/vendor/bundle/ruby/1.9.1/gems/slop-3.5.0/test/slop_test.rb +0 -518
  1566. data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/README +0 -151
  1567. data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/README.erb +0 -43
  1568. data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/lib/threadify.rb +0 -176
  1569. data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/rakefile +0 -222
  1570. data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/sample/a.rb +0 -37
  1571. data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/sample/b.rb +0 -41
  1572. data/vendor/bundle/ruby/1.9.1/gems/threadify-1.3.0/threadify.gemspec +0 -26
  1573. data/vendor/bundle/ruby/1.9.1/specifications/amalgalite-1.3.0.gemspec +0 -52
  1574. data/vendor/bundle/ruby/1.9.1/specifications/arrayfields-4.7.4.gemspec +0 -16
  1575. data/vendor/bundle/ruby/1.9.1/specifications/chronic-0.10.2.gemspec +0 -42
  1576. data/vendor/bundle/ruby/1.9.1/specifications/coderay-1.1.0.gemspec +0 -23
  1577. data/vendor/bundle/ruby/1.9.1/specifications/coerce-0.0.6.gemspec +0 -30
  1578. data/vendor/bundle/ruby/1.9.1/specifications/daemons-1.1.9.gemspec +0 -19
  1579. data/vendor/bundle/ruby/1.9.1/specifications/fastercsv-1.5.5.gemspec +0 -20
  1580. data/vendor/bundle/ruby/1.9.1/specifications/fattr-2.2.2.gemspec +0 -18
  1581. data/vendor/bundle/ruby/1.9.1/specifications/flowdock-0.5.0.gemspec +0 -51
  1582. data/vendor/bundle/ruby/1.9.1/specifications/highline-1.6.21.gemspec +0 -21
  1583. data/vendor/bundle/ruby/1.9.1/specifications/httparty-0.13.1.gemspec +0 -35
  1584. data/vendor/bundle/ruby/1.9.1/specifications/json-1.8.1.gemspec +0 -36
  1585. data/vendor/bundle/ruby/1.9.1/specifications/main-6.0.0.gemspec +0 -39
  1586. data/vendor/bundle/ruby/1.9.1/specifications/main-6.1.0.gemspec +0 -39
  1587. data/vendor/bundle/ruby/1.9.1/specifications/map-6.5.5.gemspec +0 -18
  1588. data/vendor/bundle/ruby/1.9.1/specifications/method_source-0.8.2.gemspec +0 -31
  1589. data/vendor/bundle/ruby/1.9.1/specifications/multi_json-1.10.1.gemspec +0 -30
  1590. data/vendor/bundle/ruby/1.9.1/specifications/multi_xml-0.5.5.gemspec +0 -30
  1591. data/vendor/bundle/ruby/1.9.1/specifications/pry-0.9.12.6.gemspec +0 -51
  1592. data/vendor/bundle/ruby/1.9.1/specifications/sekrets-1.7.0.gemspec +0 -43
  1593. data/vendor/bundle/ruby/1.9.1/specifications/sequel-4.15.0.gemspec +0 -22
  1594. data/vendor/bundle/ruby/1.9.1/specifications/slop-3.5.0.gemspec +0 -33
  1595. data/vendor/bundle/ruby/1.9.1/specifications/threadify-1.3.0.gemspec +0 -16
@@ -1,4316 +0,0 @@
1
- require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
2
-
3
- describe Sequel::Model, "associate" do
4
- it "should use explicit class if given a class, symbol, or string" do
5
- begin
6
- klass = Class.new(Sequel::Model(:nodes))
7
- class ::ParParent < Sequel::Model; end
8
-
9
- klass.associate :many_to_one, :par_parent0, :class=>ParParent
10
- klass.associate :one_to_many, :par_parent1s, :class=>'ParParent'
11
- klass.associate :many_to_many, :par_parent2s, :class=>:ParParent
12
-
13
- klass.association_reflection(:"par_parent0").associated_class.should == ParParent
14
- klass.association_reflection(:"par_parent1s").associated_class.should == ParParent
15
- klass.association_reflection(:"par_parent2s").associated_class.should == ParParent
16
- ensure
17
- Object.send(:remove_const, :ParParent)
18
- end
19
- end
20
-
21
- it "should default to associating to other models in the same scope" do
22
- begin
23
- class ::AssociationModuleTest
24
- class Album < Sequel::Model
25
- many_to_one :artist
26
- many_to_many :tags
27
- end
28
- class Artist< Sequel::Model
29
- one_to_many :albums
30
- end
31
- class Tag < Sequel::Model
32
- many_to_many :albums
33
- end
34
- end
35
-
36
- ::AssociationModuleTest::Album.association_reflection(:artist).associated_class.should == ::AssociationModuleTest::Artist
37
- ::AssociationModuleTest::Album.association_reflection(:tags).associated_class.should == ::AssociationModuleTest::Tag
38
- ::AssociationModuleTest::Artist.association_reflection(:albums).associated_class.should == ::AssociationModuleTest::Album
39
- ::AssociationModuleTest::Tag.association_reflection(:albums).associated_class.should == ::AssociationModuleTest::Album
40
- ensure
41
- Object.send(:remove_const, :AssociationModuleTest)
42
- end
43
- end
44
-
45
- it "should add a model_object and association_reflection accessors to the dataset, and return it with the current model object" do
46
- klass = Class.new(Sequel::Model(:nodes)) do
47
- columns :id, :a_id
48
- end
49
- mod = Module.new do
50
- def blah
51
- filter{|o| o.__send__(association_reflection[:key]) > model_object.id*2}
52
- end
53
- end
54
-
55
- klass.associate :many_to_one, :a, :class=>klass
56
- klass.associate :one_to_many, :bs, :key=>:b_id, :class=>klass, :extend=>mod
57
- klass.associate :many_to_many, :cs, :class=>klass
58
-
59
- node = klass.load(:id=>1)
60
- node.a_dataset.model_object.should == node
61
- node.bs_dataset.model_object.should == node
62
- node.cs_dataset.model_object.should == node
63
-
64
- node.a_dataset.association_reflection.should == klass.association_reflection(:a)
65
- node.bs_dataset.association_reflection.should == klass.association_reflection(:bs)
66
- node.cs_dataset.association_reflection.should == klass.association_reflection(:cs)
67
-
68
- node.bs_dataset.blah.sql.should == 'SELECT * FROM nodes WHERE ((nodes.b_id = 1) AND (b_id > 2))'
69
- end
70
-
71
- it "should allow extending the dataset with :extend option" do
72
- klass = Class.new(Sequel::Model(:nodes)) do
73
- columns :id, :a_id
74
- end
75
- mod = Module.new do
76
- def blah
77
- 1
78
- end
79
- end
80
- mod2 = Module.new do
81
- def blar
82
- 2
83
- end
84
- end
85
-
86
- klass.associate :many_to_one, :a, :class=>klass, :extend=>mod
87
- klass.associate :one_to_many, :bs, :class=>klass, :extend=>[mod]
88
- klass.associate :many_to_many, :cs, :class=>klass, :extend=>[mod, mod2]
89
-
90
- node = klass.load(:id=>1)
91
- node.a_dataset.blah.should == 1
92
- node.bs_dataset.blah.should == 1
93
- node.cs_dataset.blah.should == 1
94
- node.cs_dataset.blar.should == 2
95
- end
96
-
97
- it "should clone an existing association with the :clone option" do
98
- begin
99
- class ::ParParent < Sequel::Model; end
100
- klass = Class.new(Sequel::Model(:nodes))
101
-
102
- klass.many_to_one(:par_parent, :order=>:a){1}
103
- klass.one_to_many(:par_parent1s, :class=>'ParParent', :limit=>12){4}
104
- klass.many_to_many(:par_parent2s, :class=>:ParParent, :uniq=>true){2}
105
-
106
- klass.many_to_one :par, :clone=>:par_parent, :select=>:b
107
- klass.one_to_many :par1s, :clone=>:par_parent1s, :order=>:b, :limit=>10, :block=>nil
108
- klass.many_to_many(:par2s, :clone=>:par_parent2s, :order=>:c){3}
109
- klass.many_to_one :par3, :clone=>:par
110
-
111
- klass.association_reflection(:par).associated_class.should == ParParent
112
- klass.association_reflection(:par1s).associated_class.should == ParParent
113
- klass.association_reflection(:par2s).associated_class.should == ParParent
114
-
115
- klass.association_reflection(:par)[:order].should == :a
116
- klass.association_reflection(:par).select.should == :b
117
- klass.association_reflection(:par)[:block].call.should == 1
118
- klass.association_reflection(:par)[:eager_block].call.should == 1
119
- klass.association_reflection(:par1s)[:limit].should == 10
120
- klass.association_reflection(:par1s)[:order].should == :b
121
- klass.association_reflection(:par1s)[:block].should == nil
122
- klass.association_reflection(:par2s)[:after_load].length.should == 1
123
- klass.association_reflection(:par2s)[:order].should == :c
124
- klass.association_reflection(:par2s)[:block].call.should == 3
125
-
126
- klass.association_reflection(:par3)[:block].call.should == 1
127
- klass.association_reflection(:par3)[:eager_block].call.should == 1
128
- ensure
129
- Object.send(:remove_const, :ParParent)
130
- end
131
- end
132
-
133
- it "should raise an error if attempting to clone an association of differing type" do
134
- c = Class.new(Sequel::Model(:c))
135
- c.many_to_one :c
136
- proc{c.one_to_many :cs, :clone=>:c}.should raise_error(Sequel::Error)
137
- end
138
-
139
- it "should allow cloning of one_to_many to one_to_one associations and vice-versa" do
140
- c = Class.new(Sequel::Model(:c))
141
- c.one_to_one :c
142
- proc{c.one_to_many :cs, :clone=>:c}.should_not raise_error
143
- proc{c.one_to_one :c2, :clone=>:cs}.should_not raise_error
144
- end
145
-
146
- it "should allow cloning of many_to_many to one_through_one associations and vice-versa" do
147
- c = Class.new(Sequel::Model(:c))
148
- c.many_to_many :c
149
- proc{c.one_through_one :cs, :clone=>:c}.should_not raise_error
150
- proc{c.many_to_many :c2, :clone=>:cs}.should_not raise_error
151
- end
152
-
153
- it "should clear associations cache when refreshing object manually" do
154
- c = Class.new(Sequel::Model(:c))
155
- c.many_to_one :c
156
- o = c.new
157
- o.associations[:c] = 1
158
- o.refresh
159
- o.associations.should == {}
160
- end
161
-
162
- it "should not clear associations cache when refreshing object after save" do
163
- c = Class.new(Sequel::Model(:c))
164
- c.many_to_one :c
165
- o = c.new
166
- o.associations[:c] = 1
167
- o.save
168
- o.associations.should == {:c=>1}
169
- end
170
-
171
- it "should not clear associations cache when saving with insert_select" do
172
- ds = Sequel::Model.db[:c]
173
- def ds.supports_insert_select?() true end
174
- def ds.insert_select(*) {:id=>1} end
175
- c = Class.new(Sequel::Model(ds))
176
- c.many_to_one :c
177
- o = c.new
178
- o.associations[:c] = 1
179
- o.save
180
- o.associations.should == {:c=>1}
181
- end
182
-
183
- end
184
-
185
- describe Sequel::Model, "many_to_one" do
186
- before do
187
- @c2 = Class.new(Sequel::Model(:nodes)) do
188
- unrestrict_primary_key
189
- columns :id, :parent_id, :par_parent_id, :blah
190
- end
191
- @dataset = @c2.dataset
192
- DB.reset
193
- end
194
-
195
- it "should raise an error if associated class does not have a primary key, and :primary_key is not specified" do
196
- @c2.no_primary_key
197
- @c2.many_to_one :parent, :class => @c2
198
- d = @c2.new(:id => 1, :parent_id => 234)
199
- proc{d.parent}.should raise_error(Sequel::Error)
200
- DB.sqls.should == []
201
- end
202
-
203
- it "should raise an error if associated class does not have a primary key, and :primary_key is not specified, with an association block" do
204
- @c2.no_primary_key
205
- @c2.many_to_one :parent, :class => @c2 do |ds| ds end
206
- d = @c2.new(:id => 1, :parent_id => 234)
207
- proc{d.parent}.should raise_error(Sequel::Error)
208
- DB.sqls.should == []
209
- end
210
-
211
- it "should use implicit key if omitted" do
212
- @c2.many_to_one :parent, :class => @c2
213
-
214
- d = @c2.new(:id => 1, :parent_id => 234)
215
- p = d.parent
216
- p.class.should == @c2
217
- p.values.should == {:x => 1, :id => 1}
218
-
219
- DB.sqls.should == ["SELECT * FROM nodes WHERE id = 234"]
220
- end
221
-
222
- it "should allow association with the same name as the key if :key_column is given" do
223
- @c2.def_column_alias(:parent_id_id, :parent_id)
224
- @c2.many_to_one :parent_id, :key_column=>:parent_id, :class => @c2
225
- d = @c2.load(:id => 1, :parent_id => 234)
226
- d.parent_id_dataset.sql.should == "SELECT * FROM nodes WHERE (nodes.id = 234) LIMIT 1"
227
- d.parent_id.should == @c2.load(:x => 1, :id => 1)
228
- d.parent_id_id.should == 234
229
- d[:parent_id].should == 234
230
- DB.sqls.should == ["SELECT * FROM nodes WHERE id = 234"]
231
-
232
- d.parent_id_id = 3
233
- d.parent_id_id.should == 3
234
- d[:parent_id].should == 3
235
- end
236
-
237
- it "should use implicit class if omitted" do
238
- begin
239
- class ::ParParent < Sequel::Model; end
240
- @c2.many_to_one :par_parent
241
- @c2.new(:id => 1, :par_parent_id => 234).par_parent.class.should == ParParent
242
- DB.sqls.should == ["SELECT * FROM par_parents WHERE id = 234"]
243
- ensure
244
- Object.send(:remove_const, :ParParent)
245
- end
246
- end
247
-
248
- it "should use class inside module if given as a string" do
249
- begin
250
- module ::Par
251
- class Parent < Sequel::Model; end
252
- end
253
- @c2.many_to_one :par_parent, :class=>"Par::Parent"
254
- @c2.new(:id => 1, :par_parent_id => 234).par_parent.class.should == Par::Parent
255
- DB.sqls.should == ["SELECT * FROM parents WHERE id = 234"]
256
- ensure
257
- Object.send(:remove_const, :Par)
258
- end
259
- end
260
-
261
- it "should use explicit key if given" do
262
- @c2.many_to_one :parent, :class => @c2, :key => :blah
263
-
264
- d = @c2.new(:id => 1, :blah => 567)
265
- p = d.parent
266
- p.class.should == @c2
267
- p.values.should == {:x => 1, :id => 1}
268
-
269
- DB.sqls.should == ["SELECT * FROM nodes WHERE id = 567"]
270
- end
271
-
272
- it "should respect :qualify => false option" do
273
- @c2.many_to_one :parent, :class => @c2, :key => :blah, :qualify=>false
274
- @c2.new(:id => 1, :blah => 567).parent
275
- DB.sqls.should == ["SELECT * FROM nodes WHERE id = 567"]
276
- end
277
-
278
- it "should use :primary_key option if given" do
279
- @c2.many_to_one :parent, :class => @c2, :key => :blah, :primary_key => :pk
280
- @c2.new(:id => 1, :blah => 567).parent
281
- DB.sqls.should == ["SELECT * FROM nodes WHERE (nodes.pk = 567) LIMIT 1"]
282
- end
283
-
284
- it "should support composite keys" do
285
- @c2.many_to_one :parent, :class => @c2, :key=>[:id, :parent_id], :primary_key=>[:parent_id, :id]
286
- @c2.new(:id => 1, :parent_id => 234).parent
287
- DB.sqls.should == ["SELECT * FROM nodes WHERE ((nodes.parent_id = 1) AND (nodes.id = 234)) LIMIT 1"]
288
- end
289
-
290
- it "should not issue query if not all keys have values" do
291
- @c2.many_to_one :parent, :class => @c2, :key=>[:id, :parent_id], :primary_key=>[:parent_id, :id]
292
- @c2.new(:id => 1, :parent_id => nil).parent.should == nil
293
- DB.sqls.should == []
294
- end
295
-
296
- it "should raise an Error unless same number of composite keys used" do
297
- proc{@c2.many_to_one :parent, :class => @c2, :primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
298
- proc{@c2.many_to_one :parent, :class => @c2, :key=>[:id, :parent_id], :primary_key=>:id}.should raise_error(Sequel::Error)
299
- proc{@c2.many_to_one :parent, :class => @c2, :key=>:id, :primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
300
- proc{@c2.many_to_one :parent, :class => @c2, :key=>[:id, :parent_id, :blah], :primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
301
- end
302
-
303
- it "should use :select option if given" do
304
- @c2.many_to_one :parent, :class => @c2, :key => :blah, :select=>[:id, :name]
305
- @c2.new(:id => 1, :blah => 567).parent
306
- DB.sqls.should == ["SELECT id, name FROM nodes WHERE (nodes.id = 567) LIMIT 1"]
307
- end
308
-
309
- it "should use :conditions option if given" do
310
- @c2.many_to_one :parent, :class => @c2, :key => :blah, :conditions=>{:a=>32}
311
- @c2.new(:id => 1, :blah => 567).parent
312
- DB.sqls.should == ["SELECT * FROM nodes WHERE ((a = 32) AND (nodes.id = 567)) LIMIT 1"]
313
-
314
- @c2.many_to_one :parent, :class => @c2, :key => :blah, :conditions=>:a
315
- @c2.new(:id => 1, :blah => 567).parent
316
- DB.sqls.should == ["SELECT * FROM nodes WHERE (a AND (nodes.id = 567)) LIMIT 1"]
317
- end
318
-
319
- it "should support :order, :limit (only for offset), and :dataset options, as well as a block" do
320
- @c2.many_to_one :child_20, :class => @c2, :key=>:id, :dataset=>proc{model.filter(:parent_id=>pk)}, :limit=>[10,20], :order=>:name do |ds|
321
- ds.filter{x > 1}
322
- end
323
- @c2.load(:id => 100).child_20
324
- DB.sqls.should == ["SELECT * FROM nodes WHERE ((parent_id = 100) AND (x > 1)) ORDER BY name LIMIT 1 OFFSET 20"]
325
- end
326
-
327
- it "should return nil if key value is nil" do
328
- @c2.many_to_one :parent, :class => @c2
329
- @c2.new(:id => 1).parent.should == nil
330
- DB.sqls.should == []
331
- end
332
-
333
- it "should cache negative lookup" do
334
- @c2.many_to_one :parent, :class => @c2
335
- @c2.dataset._fetch = []
336
- d = @c2.new(:id => 1, :parent_id=>555)
337
- DB.sqls.should == []
338
- d.parent.should == nil
339
- DB.sqls.should == ['SELECT * FROM nodes WHERE id = 555']
340
- d.parent.should == nil
341
- DB.sqls.should == []
342
- end
343
-
344
- it "should define a setter method" do
345
- @c2.many_to_one :parent, :class => @c2
346
-
347
- d = @c2.new(:id => 1)
348
- d.parent = @c2.new(:id => 4321)
349
- d.values.should == {:id => 1, :parent_id => 4321}
350
-
351
- d.parent = nil
352
- d.values.should == {:id => 1, :parent_id => nil}
353
-
354
- e = @c2.new(:id => 6677)
355
- d.parent = e
356
- d.values.should == {:id => 1, :parent_id => 6677}
357
- end
358
-
359
- it "should have the setter method respect the :primary_key option" do
360
- @c2.many_to_one :parent, :class => @c2, :primary_key=>:blah
361
-
362
- d = @c2.new(:id => 1)
363
- d.parent = @c2.new(:id => 4321, :blah=>444)
364
- d.values.should == {:id => 1, :parent_id => 444}
365
-
366
- d.parent = nil
367
- d.values.should == {:id => 1, :parent_id => nil}
368
-
369
- e = @c2.new(:id => 6677, :blah=>8)
370
- d.parent = e
371
- d.values.should == {:id => 1, :parent_id => 8}
372
- end
373
-
374
- it "should have the setter method respect composite keys" do
375
- @c2.many_to_one :parent, :class => @c2, :key=>[:id, :parent_id], :primary_key=>[:parent_id, :id]
376
-
377
- d = @c2.new(:id => 1, :parent_id=> 234)
378
- d.parent = @c2.new(:id => 4, :parent_id=>52)
379
- d.values.should == {:id => 52, :parent_id => 4}
380
-
381
- d.parent = nil
382
- d.values.should == {:id => nil, :parent_id => nil}
383
-
384
- e = @c2.new(:id => 6677, :parent_id=>8)
385
- d.parent = e
386
- d.values.should == {:id => 8, :parent_id => 6677}
387
- end
388
-
389
- it "should not persist changes until saved" do
390
- @c2.many_to_one :parent, :class => @c2
391
-
392
- d = @c2.load(:id => 1)
393
- DB.reset
394
- d.parent = @c2.new(:id => 345)
395
- DB.sqls.should == []
396
- d.save_changes
397
- DB.sqls.should == ['UPDATE nodes SET parent_id = 345 WHERE (id = 1)']
398
- end
399
-
400
- it "should populate cache when accessed" do
401
- @c2.many_to_one :parent, :class => @c2
402
-
403
- d = @c2.load(:id => 1)
404
- d.parent_id = 234
405
- d.associations[:parent].should == nil
406
- @c2.dataset._fetch = {:id=>234}
407
- e = d.parent
408
- DB.sqls.should == ["SELECT * FROM nodes WHERE id = 234"]
409
- d.associations[:parent].should == e
410
- end
411
-
412
- it "should populate cache when assigned" do
413
- @c2.many_to_one :parent, :class => @c2
414
-
415
- d = @c2.create(:id => 1)
416
- DB.reset
417
- d.associations[:parent].should == nil
418
- d.parent = @c2.new(:id => 234)
419
- e = d.parent
420
- d.associations[:parent].should == e
421
- DB.sqls.should == []
422
- end
423
-
424
- it "should use cache if available" do
425
- @c2.many_to_one :parent, :class => @c2
426
-
427
- d = @c2.create(:id => 1, :parent_id => 234)
428
- DB.reset
429
- d.associations[:parent] = 42
430
- d.parent.should == 42
431
- DB.sqls.should == []
432
- end
433
-
434
- it "should not use cache if asked to reload" do
435
- @c2.many_to_one :parent, :class => @c2
436
-
437
- d = @c2.create(:id => 1)
438
- DB.reset
439
- d.parent_id = 234
440
- d.associations[:parent] = 42
441
- d.parent(true).should_not == 42
442
- DB.sqls.should == ["SELECT * FROM nodes WHERE id = 234"]
443
- end
444
-
445
- it "should use a callback if given one as the argument" do
446
- @c2.many_to_one :parent, :class => @c2
447
-
448
- d = @c2.create(:id => 1)
449
- DB.reset
450
- d.parent_id = 234
451
- d.associations[:parent] = 42
452
- d.parent(proc{|ds| ds.filter{name > 'M'}}).should_not == 42
453
- DB.sqls.should == ["SELECT * FROM nodes WHERE ((nodes.id = 234) AND (name > 'M')) LIMIT 1"]
454
- end
455
-
456
- it "should use a block given to the association method as a callback" do
457
- @c2.many_to_one :parent, :class => @c2
458
-
459
- d = @c2.create(:id => 1)
460
- DB.reset
461
- d.parent_id = 234
462
- d.associations[:parent] = 42
463
- d.parent{|ds| ds.filter{name > 'M'}}.should_not == 42
464
- DB.sqls.should == ["SELECT * FROM nodes WHERE ((nodes.id = 234) AND (name > 'M')) LIMIT 1"]
465
- end
466
-
467
- it "should have the setter add to the reciprocal one_to_many cached association array if it exists" do
468
- @c2.many_to_one :parent, :class => @c2
469
- @c2.one_to_many :children, :class => @c2, :key=>:parent_id
470
- @c2.dataset._fetch = []
471
-
472
- d = @c2.new(:id => 1)
473
- e = @c2.new(:id => 2)
474
- DB.sqls.should == []
475
- d.parent = e
476
- e.children.should_not(include(d))
477
- DB.sqls.should == ['SELECT * FROM nodes WHERE (nodes.parent_id = 2)']
478
-
479
- d = @c2.new(:id => 1)
480
- e = @c2.new(:id => 2)
481
- e.children.should_not(include(d))
482
- DB.sqls.should == ['SELECT * FROM nodes WHERE (nodes.parent_id = 2)']
483
- d.parent = e
484
- e.children.should(include(d))
485
- DB.sqls.should == []
486
- end
487
-
488
- it "should have setter deal with a one_to_one reciprocal" do
489
- @c2.many_to_one :parent, :class => @c2, :key=>:parent_id
490
- @c2.one_to_one :child, :class => @c2, :key=>:parent_id
491
-
492
- d = @c2.new(:id => 1)
493
- e = @c2.new(:id => 2)
494
- e.associations[:child] = nil
495
- d.parent = e
496
- e.child.should == d
497
- d.parent = nil
498
- e.child.should == nil
499
- d.parent = e
500
- e.child.should == d
501
-
502
- f = @c2.new(:id => 3)
503
- d.parent = nil
504
- e.child.should == nil
505
- e.associations[:child] = f
506
- d.parent = e
507
- e.child.should == d
508
- end
509
-
510
- it "should have the setter remove the object from the previous associated object's reciprocal one_to_many cached association array if it exists" do
511
- @c2.many_to_one :parent, :class => @c2
512
- @c2.one_to_many :children, :class => @c2, :key=>:parent_id
513
- @c2.dataset._fetch = []
514
-
515
- d = @c2.new(:id => 1)
516
- e = @c2.new(:id => 2)
517
- f = @c2.new(:id => 3)
518
- e.children.should_not(include(d))
519
- f.children.should_not(include(d))
520
- DB.reset
521
- d.parent = e
522
- e.children.should(include(d))
523
- d.parent = f
524
- f.children.should(include(d))
525
- e.children.should_not(include(d))
526
- d.parent = nil
527
- f.children.should_not(include(d))
528
- DB.sqls.should == []
529
- end
530
-
531
- it "should have the setter not modify the reciprocal if set to same value as current" do
532
- @c2.many_to_one :parent, :class => @c2
533
- @c2.one_to_many :children, :class => @c2, :key=>:parent_id
534
-
535
- c1 = @c2.load(:id => 1, :parent_id=>nil)
536
- c2 = @c2.load(:id => 2, :parent_id=>1)
537
- c3 = @c2.load(:id => 3, :parent_id=>1)
538
- c1.associations[:children] = [c2, c3]
539
- c2.associations[:parent] = c1
540
- c2.parent = c1
541
- c1.children.should == [c2, c3]
542
- DB.sqls.should == []
543
- end
544
-
545
- it "should get all matching records and only return the first if :key option is set to nil" do
546
- @c2.one_to_many :children, :class => @c2, :key=>:parent_id
547
- @c2.many_to_one :first_grand_parent, :class => @c2, :key=>nil, :eager_graph=>:children, :dataset=>proc{model.filter(:children_id=>parent_id)}
548
- @c2.dataset.columns(:id, :parent_id, :par_parent_id, :blah)._fetch = [{:id=>1, :parent_id=>0, :par_parent_id=>3, :blah=>4, :children_id=>2, :children_parent_id=>1, :children_par_parent_id=>5, :children_blah=>6}, {}]
549
- p = @c2.new(:parent_id=>2)
550
- fgp = p.first_grand_parent
551
- DB.sqls.should == ["SELECT nodes.id, nodes.parent_id, nodes.par_parent_id, nodes.blah, children.id AS children_id, children.parent_id AS children_parent_id, children.par_parent_id AS children_par_parent_id, children.blah AS children_blah FROM nodes LEFT OUTER JOIN nodes AS children ON (children.parent_id = nodes.id) WHERE (children_id = 2)"]
552
- fgp.values.should == {:id=>1, :parent_id=>0, :par_parent_id=>3, :blah=>4}
553
- fgp.children.first.values.should == {:id=>2, :parent_id=>1, :par_parent_id=>5, :blah=>6}
554
- end
555
-
556
- it "should not create the setter method if :read_only option is used" do
557
- @c2.many_to_one :parent, :class => @c2, :read_only=>true
558
- @c2.instance_methods.collect{|x| x.to_s}.should(include('parent'))
559
- @c2.instance_methods.collect{|x| x.to_s}.should_not(include('parent='))
560
- end
561
-
562
- it "should not add associations methods directly to class" do
563
- @c2.many_to_one :parent, :class => @c2
564
- @c2.instance_methods.collect{|x| x.to_s}.should(include('parent'))
565
- @c2.instance_methods.collect{|x| x.to_s}.should(include('parent='))
566
- @c2.instance_methods(false).collect{|x| x.to_s}.should_not(include('parent'))
567
- @c2.instance_methods(false).collect{|x| x.to_s}.should_not(include('parent='))
568
- end
569
-
570
- it "should add associations methods to the :methods_module option" do
571
- m = Module.new
572
- @c2.many_to_one :parent, :class => @c2, :methods_module=>m
573
- m.instance_methods.collect{|x| x.to_s}.should(include('parent'))
574
- m.instance_methods.collect{|x| x.to_s}.should(include('parent='))
575
- @c2.instance_methods.collect{|x| x.to_s}.should_not(include('parent'))
576
- @c2.instance_methods.collect{|x| x.to_s}.should_not(include('parent='))
577
- end
578
-
579
- it "should add associations methods directly to class if :methods_module is the class itself" do
580
- @c2.many_to_one :parent, :class => @c2, :methods_module=>@c2
581
- @c2.instance_methods(false).collect{|x| x.to_s}.should(include('parent'))
582
- @c2.instance_methods(false).collect{|x| x.to_s}.should(include('parent='))
583
- end
584
-
585
- it "should raise an error if trying to set a model object that doesn't have a valid primary key" do
586
- @c2.many_to_one :parent, :class => @c2
587
- p = @c2.new
588
- c = @c2.load(:id=>123)
589
- proc{c.parent = p}.should raise_error(Sequel::Error)
590
- end
591
-
592
- it "should make the change to the foreign_key value inside a _association= method" do
593
- @c2.many_to_one :parent, :class => @c2
594
- @c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_parent="))
595
- p = @c2.new
596
- c = @c2.load(:id=>123)
597
- def p._parent=(x)
598
- @x = x
599
- end
600
- p.should_not_receive(:parent_id=)
601
- p.parent = c
602
- p.instance_variable_get(:@x).should == c
603
- end
604
-
605
- it "should have the :setter option define the _association= method" do
606
- @c2.many_to_one :parent, :class => @c2, :setter=>proc{|x| @x = x}
607
- p = @c2.new
608
- c = @c2.load(:id=>123)
609
- p.should_not_receive(:parent_id=)
610
- p.parent = c
611
- p.instance_variable_get(:@x).should == c
612
- end
613
-
614
- it "should support (before|after)_set callbacks" do
615
- h = []
616
- @c2.many_to_one :parent, :class => @c2, :before_set=>[proc{|x,y| h << x.pk; h << (y ? -y.pk : :y)}, :blah], :after_set=>proc{h << 3}
617
- @c2.class_eval do
618
- self::Foo = h
619
- def []=(a, v)
620
- a == :parent_id ? (model::Foo << (v ? 4 : 5)) : super
621
- end
622
- def blah(x)
623
- model::Foo << (x ? x.pk : :x)
624
- end
625
- def blahr(x)
626
- model::Foo << 6
627
- end
628
- end
629
- p = @c2.load(:id=>10)
630
- c = @c2.load(:id=>123)
631
- h.should == []
632
- p.parent = c
633
- h.should == [10, -123, 123, 4, 3]
634
- p.parent = nil
635
- h.should == [10, -123, 123, 4, 3, 10, :y, :x, 5, 3]
636
- end
637
-
638
- it "should support after_load association callback" do
639
- h = []
640
- @c2.many_to_one :parent, :class => @c2, :after_load=>[proc{|x,y| h << [x.pk, y.pk]}, :al]
641
- @c2.class_eval do
642
- self::Foo = h
643
- def al(v)
644
- model::Foo << v.pk
645
- end
646
- dataset._fetch = {:id=>20}
647
- end
648
- p = @c2.load(:id=>10, :parent_id=>20)
649
- parent = p.parent
650
- h.should == [[10, 20], 20]
651
- parent.pk.should == 20
652
- end
653
-
654
- it "should support after_load association callback that changes the cached object" do
655
- @c2.many_to_one :parent, :class => @c2, :after_load=>:al
656
- @c2.class_eval do
657
- def al(v)
658
- associations[:parent] = :foo
659
- end
660
- end
661
- p = @c2.load(:id=>10, :parent_id=>20)
662
- p.parent.should == :foo
663
- p.associations[:parent].should == :foo
664
- end
665
-
666
- it "should raise error and not call internal add or remove method if before callback returns false, even if raise_on_save_failure is false" do
667
- # The reason for this is that assignment in ruby always returns the argument instead of the result
668
- # of the method, so we can't return nil to signal that the association callback prevented the modification
669
- p = @c2.new
670
- c = @c2.load(:id=>123)
671
- p.raise_on_save_failure = false
672
- @c2.many_to_one :parent, :class => @c2, :before_set=>:bs
673
- def p.bs(x) false end
674
- p.should_not_receive(:_parent=)
675
- proc{p.parent = c}.should raise_error(Sequel::Error)
676
-
677
- p.parent.should == nil
678
- p.associations[:parent] = c
679
- p.parent.should == c
680
- proc{p.parent = nil}.should raise_error(Sequel::Error)
681
- end
682
-
683
- it "should raise an error if a callback is not a proc or symbol" do
684
- @c2.many_to_one :parent, :class => @c2, :before_set=>Object.new
685
- proc{@c2.new.parent = @c2.load(:id=>1)}.should raise_error(Sequel::Error)
686
- end
687
- end
688
-
689
- describe Sequel::Model, "one_to_one" do
690
- before do
691
- @c1 = Class.new(Sequel::Model(:attributes)) do
692
- unrestrict_primary_key
693
- columns :id, :node_id, :y
694
- end
695
-
696
- @c2 = Class.new(Sequel::Model(:nodes)) do
697
- unrestrict_primary_key
698
- attr_accessor :xxx
699
-
700
- def self.name; 'Node'; end
701
- def self.to_s; 'Node'; end
702
- columns :id, :x, :parent_id, :par_parent_id, :blah, :node_id
703
- end
704
- @dataset = @c2.dataset
705
- @dataset._fetch = {}
706
- @c1.dataset._fetch = {}
707
- DB.reset
708
- end
709
-
710
- it "should have the getter method return a single object if the :one_to_one option is true" do
711
- @c2.one_to_one :attribute, :class => @c1
712
- att = @c2.new(:id => 1234).attribute
713
- DB.sqls.should == ['SELECT * FROM attributes WHERE (attributes.node_id = 1234) LIMIT 1']
714
- att.should be_a_kind_of(@c1)
715
- att.values.should == {}
716
- end
717
-
718
- it "should not add a setter method if the :read_only option is true" do
719
- @c2.one_to_one :attribute, :class => @c1, :read_only=>true
720
- im = @c2.instance_methods.collect{|x| x.to_s}
721
- im.should(include('attribute'))
722
- im.should_not(include('attribute='))
723
- end
724
-
725
- it "should add a setter method" do
726
- @c2.one_to_one :attribute, :class => @c1
727
- attrib = @c1.new(:id=>3)
728
- @c1.dataset._fetch = @c1.instance_dataset._fetch = {:id=>3}
729
- @c2.new(:id => 1234).attribute = attrib
730
- sqls = DB.sqls
731
- ['INSERT INTO attributes (node_id, id) VALUES (1234, 3)',
732
- 'INSERT INTO attributes (id, node_id) VALUES (3, 1234)'].should(include(sqls.slice! 1))
733
- sqls.should == ['UPDATE attributes SET node_id = NULL WHERE (node_id = 1234)', "SELECT * FROM attributes WHERE (id = 3) LIMIT 1"]
734
-
735
- @c2.new(:id => 1234).attribute.should == attrib
736
- attrib = @c1.load(:id=>3)
737
- @c2.new(:id => 1234).attribute = attrib
738
- DB.sqls.should == ["SELECT * FROM attributes WHERE (attributes.node_id = 1234) LIMIT 1",
739
- 'UPDATE attributes SET node_id = NULL WHERE ((node_id = 1234) AND (id != 3))',
740
- "UPDATE attributes SET node_id = 1234 WHERE (id = 3)"]
741
- end
742
-
743
- it "should use a transaction in the setter method" do
744
- @c2.one_to_one :attribute, :class => @c1
745
- @c2.use_transactions = true
746
- attrib = @c1.load(:id=>3)
747
- @c2.new(:id => 1234).attribute = attrib
748
- DB.sqls.should == ['BEGIN',
749
- 'UPDATE attributes SET node_id = NULL WHERE ((node_id = 1234) AND (id != 3))',
750
- "UPDATE attributes SET node_id = 1234 WHERE (id = 3)",
751
- 'COMMIT']
752
- end
753
-
754
- it "should have setter method respect association filters" do
755
- @c2.one_to_one :attribute, :class => @c1, :conditions=>{:a=>1} do |ds|
756
- ds.filter(:b=>2)
757
- end
758
- attrib = @c1.load(:id=>3)
759
- @c2.new(:id => 1234).attribute = attrib
760
- DB.sqls.should == ['UPDATE attributes SET node_id = NULL WHERE ((a = 1) AND (node_id = 1234) AND (b = 2) AND (id != 3))',
761
- "UPDATE attributes SET node_id = 1234 WHERE (id = 3)"]
762
- end
763
-
764
- it "should have the setter method respect the :primary_key option" do
765
- @c2.one_to_one :attribute, :class => @c1, :primary_key=>:xxx
766
- attrib = @c1.new(:id=>3)
767
- @c1.dataset._fetch = @c1.instance_dataset._fetch = {:id=>3}
768
- @c2.new(:id => 1234, :xxx=>5).attribute = attrib
769
- sqls = DB.sqls
770
- ['INSERT INTO attributes (node_id, id) VALUES (5, 3)',
771
- 'INSERT INTO attributes (id, node_id) VALUES (3, 5)'].should(include(sqls.slice! 1))
772
- sqls.should == ['UPDATE attributes SET node_id = NULL WHERE (node_id = 5)', "SELECT * FROM attributes WHERE (id = 3) LIMIT 1"]
773
-
774
- @c2.new(:id => 321, :xxx=>5).attribute.should == attrib
775
- attrib = @c1.load(:id=>3)
776
- @c2.new(:id => 621, :xxx=>5).attribute = attrib
777
- DB.sqls.should == ["SELECT * FROM attributes WHERE (attributes.node_id = 5) LIMIT 1",
778
- 'UPDATE attributes SET node_id = NULL WHERE ((node_id = 5) AND (id != 3))',
779
- 'UPDATE attributes SET node_id = 5 WHERE (id = 3)']
780
- end
781
-
782
- it "should have the setter method respect composite keys" do
783
- @c2.one_to_one :attribute, :class => @c1, :key=>[:node_id, :y], :primary_key=>[:id, :x]
784
- attrib = @c1.load(:id=>3, :y=>6)
785
- @c1.dataset._fetch = {:id=>3, :y=>6}
786
- @c2.load(:id => 1234, :x=>5).attribute = attrib
787
- sqls = DB.sqls
788
- sqls.last.should =~ /UPDATE attributes SET (node_id = 1234|y = 5), (node_id = 1234|y = 5) WHERE \(id = 3\)/
789
- sqls.first.should =~ /UPDATE attributes SET (node_id|y) = NULL, (node_id|y) = NULL WHERE \(\(node_id = 1234\) AND \(y = 5\) AND \(id != 3\)\)/
790
- sqls.length.should == 2
791
- end
792
-
793
- it "should use implicit key if omitted" do
794
- @c2.one_to_one :parent, :class => @c2
795
-
796
- d = @c2.new(:id => 234)
797
- p = d.parent
798
- p.class.should == @c2
799
- p.values.should == {}
800
-
801
- DB.sqls.should == ["SELECT * FROM nodes WHERE (nodes.node_id = 234) LIMIT 1"]
802
- end
803
-
804
- it "should use implicit class if omitted" do
805
- begin
806
- class ::ParParent < Sequel::Model; end
807
- @c2.one_to_one :par_parent
808
- @c2.new(:id => 234).par_parent.class.should == ParParent
809
- DB.sqls.should == ["SELECT * FROM par_parents WHERE (par_parents.node_id = 234) LIMIT 1"]
810
- ensure
811
- Object.send(:remove_const, :ParParent)
812
- end
813
- end
814
-
815
- it "should use class inside module if given as a string" do
816
- begin
817
- module ::Par
818
- class Parent < Sequel::Model; end
819
- end
820
- @c2.one_to_one :par_parent, :class=>"Par::Parent"
821
- @c2.new(:id => 234).par_parent.class.should == Par::Parent
822
- DB.sqls.should == ["SELECT * FROM parents WHERE (parents.node_id = 234) LIMIT 1"]
823
- ensure
824
- Object.send(:remove_const, :Par)
825
- end
826
- end
827
-
828
- it "should use explicit key if given" do
829
- @c2.one_to_one :parent, :class => @c2, :key => :blah
830
-
831
- d = @c2.new(:id => 234)
832
- p = d.parent
833
- p.class.should == @c2
834
- p.values.should == {}
835
-
836
- DB.sqls.should == ["SELECT * FROM nodes WHERE (nodes.blah = 234) LIMIT 1"]
837
- end
838
-
839
- it "should use :primary_key option if given" do
840
- @c2.one_to_one :parent, :class => @c2, :key => :pk, :primary_key => :blah
841
- @c2.new(:id => 1, :blah => 567).parent
842
- DB.sqls.should == ["SELECT * FROM nodes WHERE (nodes.pk = 567) LIMIT 1"]
843
- end
844
-
845
- it "should support composite keys" do
846
- @c2.one_to_one :parent, :class => @c2, :primary_key=>[:id, :parent_id], :key=>[:parent_id, :id]
847
- @c2.new(:id => 1, :parent_id => 234).parent
848
- DB.sqls.should == ["SELECT * FROM nodes WHERE ((nodes.parent_id = 1) AND (nodes.id = 234)) LIMIT 1"]
849
- end
850
-
851
- it "should not issue query if not all keys have values" do
852
- @c2.one_to_one :parent, :class => @c2, :key=>[:id, :parent_id], :primary_key=>[:parent_id, :id]
853
- @c2.new(:id => 1, :parent_id => nil).parent.should == nil
854
- DB.sqls.should == []
855
- end
856
-
857
- it "should raise an Error unless same number of composite keys used" do
858
- proc{@c2.one_to_one :parent, :class => @c2, :primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
859
- proc{@c2.one_to_one :parent, :class => @c2, :key=>[:id, :parent_id], :primary_key=>:id}.should raise_error(Sequel::Error)
860
- proc{@c2.one_to_one :parent, :class => @c2, :key=>:id, :primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
861
- proc{@c2.one_to_one :parent, :class => @c2, :key=>[:id, :parent_id, :blah], :primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
862
- end
863
-
864
- it "should use :select option if given" do
865
- @c2.one_to_one :parent, :class => @c2, :select=>[:id, :name]
866
- @c2.new(:id => 567).parent
867
- DB.sqls.should == ["SELECT id, name FROM nodes WHERE (nodes.node_id = 567) LIMIT 1"]
868
- end
869
-
870
- it "should use :conditions option if given" do
871
- @c2.one_to_one :parent, :class => @c2, :conditions=>{:a=>32}
872
- @c2.new(:id => 567).parent
873
- DB.sqls.should == ["SELECT * FROM nodes WHERE ((a = 32) AND (nodes.node_id = 567)) LIMIT 1"]
874
-
875
- @c2.one_to_one :parent, :class => @c2, :conditions=>:a
876
- @c2.new(:id => 567).parent
877
- DB.sqls.should == ["SELECT * FROM nodes WHERE (a AND (nodes.node_id = 567)) LIMIT 1"]
878
- end
879
-
880
- it "should support :order, :limit (only for offset), and :dataset options, as well as a block" do
881
- @c2.one_to_one :child_20, :class => @c2, :key=>:id, :dataset=>proc{model.filter(:parent_id=>pk)}, :limit=>[10,20], :order=>:name do |ds|
882
- ds.filter{x > 1}
883
- end
884
- @c2.load(:id => 100).child_20
885
- DB.sqls.should == ["SELECT * FROM nodes WHERE ((parent_id = 100) AND (x > 1)) ORDER BY name LIMIT 1 OFFSET 20"]
886
- end
887
-
888
- it "should return nil if primary_key value is nil" do
889
- @c2.one_to_one :parent, :class => @c2, :primary_key=>:node_id
890
-
891
- @c2.new(:id => 1).parent.should be_nil
892
- DB.sqls.should == []
893
- end
894
-
895
- it "should cache negative lookup" do
896
- @c2.one_to_one :parent, :class => @c2
897
- @c2.dataset._fetch = []
898
- d = @c2.new(:id => 555)
899
- DB.sqls.should == []
900
- d.parent.should == nil
901
- DB.sqls.should == ['SELECT * FROM nodes WHERE (nodes.node_id = 555) LIMIT 1']
902
- d.parent.should == nil
903
- DB.sqls.should == []
904
- end
905
-
906
- it "should have the setter method respect the :key option" do
907
- @c2.one_to_one :parent, :class => @c2, :key=>:blah
908
- d = @c2.new(:id => 3)
909
- e = @c2.new(:id => 4321, :blah=>444)
910
- @c2.dataset._fetch = @c2.instance_dataset._fetch = {:id => 4321, :blah => 3}
911
- d.parent = e
912
- e.values.should == {:id => 4321, :blah => 3}
913
- sqls = DB.sqls
914
- ["INSERT INTO nodes (blah, id) VALUES (3, 4321)",
915
- "INSERT INTO nodes (id, blah) VALUES (4321, 3)"].should include(sqls.slice! 1)
916
- sqls.should == ["UPDATE nodes SET blah = NULL WHERE (blah = 3)", "SELECT * FROM nodes WHERE (id = 4321) LIMIT 1"]
917
- end
918
-
919
- it "should persist changes to associated object when the setter is called" do
920
- @c2.one_to_one :parent, :class => @c2
921
- d = @c2.load(:id => 1)
922
- d.parent = @c2.load(:id => 3, :node_id=>345)
923
- DB.sqls.should == ["UPDATE nodes SET node_id = NULL WHERE ((node_id = 1) AND (id != 3))",
924
- "UPDATE nodes SET node_id = 1 WHERE (id = 3)"]
925
- end
926
-
927
- it "should populate cache when accessed" do
928
- @c2.one_to_one :parent, :class => @c2
929
-
930
- d = @c2.load(:id => 1)
931
- d.associations[:parent].should == nil
932
- @c2.dataset._fetch = {:id=>234}
933
- e = d.parent
934
- DB.sqls.should == ["SELECT * FROM nodes WHERE (nodes.node_id = 1) LIMIT 1"]
935
- d.parent
936
- DB.sqls.should == []
937
- d.associations[:parent].should == e
938
- end
939
-
940
- it "should populate cache when assigned" do
941
- @c2.one_to_one :parent, :class => @c2
942
-
943
- d = @c2.load(:id => 1)
944
- d.associations[:parent].should == nil
945
- e = @c2.load(:id => 234)
946
- d.parent = e
947
- f = d.parent
948
- d.associations[:parent].should == e
949
- e.should == f
950
- end
951
-
952
- it "should use cache if available" do
953
- @c2.one_to_one :parent, :class => @c2
954
- d = @c2.load(:id => 1, :parent_id => 234)
955
- d.associations[:parent] = 42
956
- d.parent.should == 42
957
- DB.sqls.should == []
958
- end
959
-
960
- it "should not use cache if asked to reload" do
961
- @c2.one_to_one :parent, :class => @c2
962
- d = @c2.load(:id => 1)
963
- d.associations[:parent] = [42]
964
- d.parent(true).should_not == 42
965
- DB.sqls.should == ["SELECT * FROM nodes WHERE (nodes.node_id = 1) LIMIT 1"]
966
- end
967
-
968
- it "should have the setter set the reciprocal many_to_one cached association" do
969
- @c2.one_to_one :parent, :class => @c2, :key=>:parent_id
970
- @c2.many_to_one :child, :class => @c2, :key=>:parent_id
971
-
972
- d = @c2.load(:id => 1)
973
- e = @c2.load(:id => 2)
974
- d.parent = e
975
- e.child.should == d
976
- DB.sqls.should == ["UPDATE nodes SET parent_id = NULL WHERE ((parent_id = 1) AND (id != 2))",
977
- "UPDATE nodes SET parent_id = 1 WHERE (id = 2)"]
978
- d.parent = nil
979
- e.child.should == nil
980
- DB.sqls.should == ["UPDATE nodes SET parent_id = NULL WHERE (parent_id = 1)"]
981
- end
982
-
983
- it "should have the setter remove the object from the previous associated object's reciprocal many_to_one cached association array if it exists" do
984
- @c2.one_to_one :parent, :class => @c2, :key=>:parent_id
985
- @c2.many_to_one :child, :class => @c2, :key=>:parent_id
986
- @c2.dataset._fetch = []
987
-
988
- d = @c2.load(:id => 1)
989
- e = @c2.load(:id => 2)
990
- f = @c2.load(:id => 3)
991
- e.child.should == nil
992
- f.child.should == nil
993
- d.parent = e
994
- e.child.should == d
995
- d.parent = f
996
- f.child.should == d
997
- e.child.should == nil
998
- d.parent = nil
999
- f.child.should == nil
1000
- end
1001
-
1002
- it "should have the setter not modify the reciprocal if set to same value as current" do
1003
- @c2.one_to_one :parent, :class => @c2, :key=>:parent_id
1004
- @c2.many_to_one :child, :class => @c2, :key=>:parent_id
1005
-
1006
- c1 = @c2.load(:id => 1, :parent_id=>nil)
1007
- c2 = @c2.load(:id => 2, :parent_id=>1)
1008
- c1.associations[:child] = c2
1009
- c2.associations[:parent] = c1
1010
- c2.parent = c1
1011
- c1.child.should == c2
1012
- DB.sqls.should == []
1013
- end
1014
-
1015
- it "should not add associations methods directly to class" do
1016
- @c2.one_to_one :parent, :class => @c2
1017
- @c2.instance_methods.collect{|x| x.to_s}.should(include('parent'))
1018
- @c2.instance_methods.collect{|x| x.to_s}.should(include('parent='))
1019
- @c2.instance_methods(false).collect{|x| x.to_s}.should_not(include('parent'))
1020
- @c2.instance_methods(false).collect{|x| x.to_s}.should_not(include('parent='))
1021
- end
1022
-
1023
- it "should raise an error if the current model object that doesn't have a valid primary key" do
1024
- @c2.one_to_one :parent, :class => @c2
1025
- p = @c2.new
1026
- c = @c2.load(:id=>123)
1027
- proc{p.parent = c}.should raise_error(Sequel::Error)
1028
- end
1029
-
1030
- it "should make the change to the foreign_key value inside a _association= method" do
1031
- @c2.one_to_one :parent, :class => @c2
1032
- @c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_parent="))
1033
- c = @c2.new
1034
- p = @c2.load(:id=>123)
1035
- def p._parent=(x)
1036
- @x = x
1037
- end
1038
- p.should_not_receive(:parent_id=)
1039
- p.parent = c
1040
- p.instance_variable_get(:@x).should == c
1041
- end
1042
-
1043
- it "should have a :setter option define the _association= method" do
1044
- @c2.one_to_one :parent, :class => @c2, :setter=>proc{|x| @x = x}
1045
- c = @c2.new
1046
- p = @c2.load(:id=>123)
1047
- p.should_not_receive(:parent_id=)
1048
- p.parent = c
1049
- p.instance_variable_get(:@x).should == c
1050
- end
1051
-
1052
- it "should support (before|after)_set callbacks" do
1053
- h = []
1054
- @c2.one_to_one :parent, :class => @c2, :before_set=>[proc{|x,y| h << x.pk; h << (y ? -y.pk : :y)}, :blah], :after_set=>proc{h << 3}
1055
- @c2.class_eval do
1056
- self::Foo = h
1057
- def blah(x)
1058
- model::Foo << (x ? x.pk : :x)
1059
- end
1060
- def blahr(x)
1061
- model::Foo << 6
1062
- end
1063
- end
1064
- p = @c2.load(:id=>10)
1065
- c = @c2.load(:id=>123)
1066
- h.should == []
1067
- p.parent = c
1068
- h.should == [10, -123, 123, 3]
1069
- p.parent = nil
1070
- h.should == [10, -123, 123, 3, 10, :y, :x, 3]
1071
- end
1072
-
1073
- it "should support after_load association callback" do
1074
- h = []
1075
- @c2.one_to_one :parent, :class => @c2, :after_load=>[proc{|x,y| h << [x.pk, y.pk]}, :al]
1076
- @c2.class_eval do
1077
- self::Foo = h
1078
- def al(v)
1079
- model::Foo << v.pk
1080
- end
1081
- @dataset._fetch = {:id=>20}
1082
- end
1083
- p = @c2.load(:id=>10)
1084
- parent = p.parent
1085
- h.should == [[10, 20], 20]
1086
- parent.pk.should == 20
1087
- end
1088
-
1089
- it "should raise error and not call internal add or remove method if before callback returns false, even if raise_on_save_failure is false" do
1090
- # The reason for this is that assignment in ruby always returns the argument instead of the result
1091
- # of the method, so we can't return nil to signal that the association callback prevented the modification
1092
- p = @c2.new
1093
- c = @c2.load(:id=>123)
1094
- p.raise_on_save_failure = false
1095
- @c2.one_to_one :parent, :class => @c2, :before_set=>:bs
1096
- def p.bs(x) false end
1097
- p.should_not_receive(:_parent=)
1098
- proc{p.parent = c}.should raise_error(Sequel::Error)
1099
-
1100
- p.parent.should == nil
1101
- p.associations[:parent] = c
1102
- p.parent.should == c
1103
- proc{p.parent = nil}.should raise_error(Sequel::Error)
1104
- end
1105
-
1106
- it "should not validate the associated object in setter if the :validate=>false option is used" do
1107
- @c2.one_to_one :parent, :class => @c2, :validate=>false
1108
- n = @c2.new(:id => 1234)
1109
- a = @c2.new(:id => 2345)
1110
- def a.validate() errors.add(:id, 'foo') end
1111
- (n.parent = a).should == a
1112
- end
1113
-
1114
- it "should raise an error if a callback is not a proc or symbol" do
1115
- @c2.one_to_one :parent, :class => @c2, :before_set=>Object.new
1116
- proc{@c2.new.parent = @c2.load(:id=>1)}.should raise_error(Sequel::Error)
1117
- end
1118
-
1119
- it "should work_correctly when used with associate" do
1120
- @c2.associate :one_to_one, :parent, :class => @c2
1121
- @c2.load(:id => 567).parent.should == @c2.load({})
1122
- DB.sqls.should == ["SELECT * FROM nodes WHERE (nodes.node_id = 567) LIMIT 1"]
1123
- end
1124
- end
1125
-
1126
- describe Sequel::Model, "one_to_many" do
1127
- before do
1128
- @c1 = Class.new(Sequel::Model(:attributes)) do
1129
- unrestrict_primary_key
1130
- columns :id, :node_id, :y, :z
1131
- end
1132
-
1133
- @c2 = Class.new(Sequel::Model(:nodes)) do
1134
- def _refresh(ds); end
1135
- unrestrict_primary_key
1136
- attr_accessor :xxx
1137
-
1138
- def self.name; 'Node'; end
1139
- def self.to_s; 'Node'; end
1140
- columns :id, :x
1141
- end
1142
- @dataset = @c2.dataset
1143
- @dataset._fetch = {}
1144
- @c1.dataset._fetch = proc{|sql| sql =~ /SELECT 1/ ? {:a=>1} : {}}
1145
- DB.reset
1146
- end
1147
-
1148
- it "should raise an error if current class does not have a primary key, and :primary_key is not specified" do
1149
- @c2.no_primary_key
1150
- proc{@c2.one_to_many :attributes, :class => @c1}.should raise_error(Sequel::Error)
1151
- DB.sqls.should == []
1152
- end
1153
-
1154
- it "should use implicit key if omitted" do
1155
- @c2.one_to_many :attributes, :class => @c1
1156
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE (attributes.node_id = 1234)'
1157
- end
1158
-
1159
- it "should use implicit class if omitted" do
1160
- begin
1161
- class ::HistoricalValue < Sequel::Model; end
1162
- @c2.one_to_many :historical_values
1163
-
1164
- v = @c2.new(:id => 1234).historical_values_dataset
1165
- v.should be_a_kind_of(Sequel::Dataset)
1166
- v.sql.should == 'SELECT * FROM historical_values WHERE (historical_values.node_id = 1234)'
1167
- v.model.should == HistoricalValue
1168
- ensure
1169
- Object.send(:remove_const, :HistoricalValue)
1170
- end
1171
- end
1172
-
1173
- it "should use class inside a module if given as a string" do
1174
- begin
1175
- module ::Historical
1176
- class Value < Sequel::Model; end
1177
- end
1178
- @c2.one_to_many :historical_values, :class=>'Historical::Value'
1179
-
1180
- v = @c2.new(:id => 1234).historical_values_dataset
1181
- v.should be_a_kind_of(Sequel::Dataset)
1182
- v.sql.should == 'SELECT * FROM values WHERE (values.node_id = 1234)'
1183
- v.model.should == Historical::Value
1184
- ensure
1185
- Object.send(:remove_const, :Historical)
1186
- end
1187
- end
1188
-
1189
- it "should use a callback if given one as the argument" do
1190
- @c2.one_to_many :attributes, :class => @c1, :key => :nodeid
1191
-
1192
- d = @c2.load(:id => 1234)
1193
- d.associations[:attributes] = []
1194
- d.attributes(proc{|ds| ds.filter{name > 'M'}}).should_not == []
1195
- DB.sqls.should == ["SELECT * FROM attributes WHERE ((attributes.nodeid = 1234) AND (name > 'M'))"]
1196
- end
1197
-
1198
- it "should use explicit key if given" do
1199
- @c2.one_to_many :attributes, :class => @c1, :key => :nodeid
1200
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE (attributes.nodeid = 1234)'
1201
- end
1202
-
1203
- it "should support_composite keys" do
1204
- @c2.one_to_many :attributes, :class => @c1, :key =>[:node_id, :id], :primary_key=>[:id, :x]
1205
- @c2.load(:id => 1234, :x=>234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE ((attributes.node_id = 1234) AND (attributes.id = 234))'
1206
- end
1207
-
1208
- it "should not issue query if not all keys have values" do
1209
- @c2.one_to_many :attributes, :class => @c1, :key =>[:node_id, :id], :primary_key=>[:id, :x]
1210
- @c2.load(:id => 1234, :x=>nil).attributes.should == []
1211
- DB.sqls.should == []
1212
- end
1213
-
1214
- it "should raise an Error unless same number of composite keys used" do
1215
- proc{@c2.one_to_many :attributes, :class => @c1, :key=>[:node_id, :id]}.should raise_error(Sequel::Error)
1216
- proc{@c2.one_to_many :attributes, :class => @c1, :primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
1217
- proc{@c2.one_to_many :attributes, :class => @c1, :key=>[:node_id, :id], :primary_key=>:id}.should raise_error(Sequel::Error)
1218
- proc{@c2.one_to_many :attributes, :class => @c1, :key=>:id, :primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
1219
- proc{@c2.one_to_many :attributes, :class => @c1, :key=>[:node_id, :id, :x], :primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
1220
- end
1221
-
1222
- it "should define an add_ method that works on existing records" do
1223
- @c2.one_to_many :attributes, :class => @c1
1224
-
1225
- n = @c2.load(:id => 1234)
1226
- a = @c1.load(:id => 2345)
1227
- a.should == n.add_attribute(a)
1228
- a.values.should == {:node_id => 1234, :id => 2345}
1229
- DB.sqls.should == ['UPDATE attributes SET node_id = 1234 WHERE (id = 2345)']
1230
- end
1231
-
1232
- it "should define an add_ method that works on new records" do
1233
- @c2.one_to_many :attributes, :class => @c1
1234
-
1235
- n = @c2.load(:id => 1234)
1236
- a = @c1.new(:id => 234)
1237
- @c1.dataset._fetch = @c1.instance_dataset._fetch = {:node_id => 1234, :id => 234}
1238
- a.should == n.add_attribute(a)
1239
- sqls = DB.sqls
1240
- sqls.shift.should =~ /INSERT INTO attributes \((node_)?id, (node_)?id\) VALUES \(1?234, 1?234\)/
1241
- sqls.should == ["SELECT * FROM attributes WHERE (id = 234) LIMIT 1"]
1242
- a.values.should == {:node_id => 1234, :id => 234}
1243
- end
1244
-
1245
- it "should define a remove_ method that works on existing records" do
1246
- @c2.one_to_many :attributes, :class => @c1
1247
-
1248
- n = @c2.load(:id => 1234)
1249
- a = @c1.load(:id => 2345, :node_id => 1234)
1250
- a.should == n.remove_attribute(a)
1251
- a.values.should == {:node_id => nil, :id => 2345}
1252
- DB.sqls.should == ["SELECT 1 AS one FROM attributes WHERE ((attributes.node_id = 1234) AND (id = 2345)) LIMIT 1", 'UPDATE attributes SET node_id = NULL WHERE (id = 2345)']
1253
- end
1254
-
1255
- it "should have the remove_ method raise an error if the passed object is not already associated" do
1256
- @c2.one_to_many :attributes, :class => @c1
1257
-
1258
- n = @c2.new(:id => 1234)
1259
- a = @c1.load(:id => 2345, :node_id => 1234)
1260
- @c1.dataset._fetch = []
1261
- proc{n.remove_attribute(a)}.should raise_error(Sequel::Error)
1262
- DB.sqls.should == ["SELECT 1 AS one FROM attributes WHERE ((attributes.node_id = 1234) AND (id = 2345)) LIMIT 1"]
1263
- end
1264
-
1265
- it "should accept a hash for the add_ method and create a new record" do
1266
- @c2.one_to_many :attributes, :class => @c1
1267
- n = @c2.new(:id => 1234)
1268
- DB.reset
1269
- @c1.dataset._fetch = @c1.instance_dataset._fetch = {:node_id => 1234, :id => 234}
1270
- n.add_attribute(:id => 234).should == @c1.load(:node_id => 1234, :id => 234)
1271
- sqls = DB.sqls
1272
- sqls.shift.should =~ /INSERT INTO attributes \((node_)?id, (node_)?id\) VALUES \(1?234, 1?234\)/
1273
- sqls.should == ["SELECT * FROM attributes WHERE (id = 234) LIMIT 1"]
1274
- end
1275
-
1276
- it "should accept a primary key for the add_ method" do
1277
- @c2.one_to_many :attributes, :class => @c1
1278
- n = @c2.new(:id => 1234)
1279
- @c1.dataset._fetch = {:id=>234, :node_id=>nil}
1280
- n.add_attribute(234).should == @c1.load(:node_id => 1234, :id => 234)
1281
- DB.sqls.should == ["SELECT * FROM attributes WHERE id = 234", "UPDATE attributes SET node_id = 1234 WHERE (id = 234)"]
1282
- end
1283
-
1284
- it "should raise an error if the primary key passed to the add_ method does not match an existing record" do
1285
- @c2.one_to_many :attributes, :class => @c1
1286
- n = @c2.new(:id => 1234)
1287
- @c1.dataset._fetch = []
1288
- proc{n.add_attribute(234)}.should raise_error(Sequel::NoMatchingRow)
1289
- DB.sqls.should == ["SELECT * FROM attributes WHERE id = 234"]
1290
- end
1291
-
1292
- it "should raise an error in the add_ method if the passed associated object is not of the correct type" do
1293
- @c2.one_to_many :attributes, :class => @c1
1294
- proc{@c2.new(:id => 1234).add_attribute(@c2.new)}.should raise_error(Sequel::Error)
1295
- end
1296
-
1297
- it "should accept a primary key for the remove_ method and remove an existing record" do
1298
- @c2.one_to_many :attributes, :class => @c1
1299
- n = @c2.new(:id => 1234)
1300
- @c1.dataset._fetch = {:id=>234, :node_id=>1234}
1301
- n.remove_attribute(234).should == @c1.load(:node_id => nil, :id => 234)
1302
- DB.sqls.should == ['SELECT * FROM attributes WHERE ((attributes.node_id = 1234) AND (attributes.id = 234)) LIMIT 1',
1303
- 'UPDATE attributes SET node_id = NULL WHERE (id = 234)']
1304
- end
1305
-
1306
- it "should raise an error in the remove_ method if the passed associated object is not of the correct type" do
1307
- @c2.one_to_many :attributes, :class => @c1
1308
- proc{@c2.new(:id => 1234).remove_attribute(@c2.new)}.should raise_error(Sequel::Error)
1309
- end
1310
-
1311
- it "should have add_ method respect the :primary_key option" do
1312
- @c2.one_to_many :attributes, :class => @c1, :primary_key=>:xxx
1313
-
1314
- n = @c2.new(:id => 1234, :xxx=>5)
1315
- a = @c1.load(:id => 2345)
1316
- n.add_attribute(a).should == a
1317
- DB.sqls.should == ['UPDATE attributes SET node_id = 5 WHERE (id = 2345)']
1318
- end
1319
-
1320
- it "should have add_ method not add the same object to the cached association array if the object is already in the array" do
1321
- @c2.one_to_many :attributes, :class => @c1
1322
-
1323
- n = @c2.new(:id => 1234)
1324
- a = @c1.load(:id => 2345)
1325
- n.associations[:attributes] = []
1326
- a.should == n.add_attribute(a)
1327
- a.should == n.add_attribute(a)
1328
- a.values.should == {:node_id => 1234, :id => 2345}
1329
- n.attributes.should == [a]
1330
- DB.sqls.should == ['UPDATE attributes SET node_id = 1234 WHERE (id = 2345)'] * 2
1331
- end
1332
-
1333
- it "should have add_ method respect composite keys" do
1334
- @c2.one_to_many :attributes, :class => @c1, :key =>[:node_id, :y], :primary_key=>[:id, :x]
1335
-
1336
- n = @c2.load(:id => 1234, :x=>5)
1337
- a = @c1.load(:id => 2345)
1338
- n.add_attribute(a).should == a
1339
- sqls = DB.sqls
1340
- sqls.shift.should =~ /UPDATE attributes SET (node_id = 1234|y = 5), (node_id = 1234|y = 5) WHERE \(id = 2345\)/
1341
- sqls.should == []
1342
- end
1343
-
1344
- it "should have add_ method accept a composite key" do
1345
- @c1.set_primary_key [:id, :z]
1346
- @c2.one_to_many :attributes, :class => @c1, :key =>[:node_id, :y], :primary_key=>[:id, :x]
1347
- @c1.dataset._fetch = {:id => 2345, :z => 8, :node_id => 1234, :y=>5}
1348
-
1349
- n = @c2.load(:id => 1234, :x=>5)
1350
- a = @c1.load(:id => 2345, :z => 8, :node_id => 1234, :y=>5)
1351
- n.add_attribute([2345, 8]).should == a
1352
- sqls = DB.sqls
1353
- sqls.shift.should =~ /SELECT \* FROM attributes WHERE \(\((id|z) = (2345|8)\) AND \((id|z) = (2345|8)\)\) LIMIT 1/
1354
- sqls.shift.should =~ /UPDATE attributes SET (node_id|y) = (1234|5), (node_id|y) = (1234|5) WHERE \(\((id|z) = (2345|8)\) AND \((id|z) = (2345|8)\)\)/
1355
- sqls.should == []
1356
- end
1357
-
1358
- it "should have remove_ method respect composite keys" do
1359
- @c2.one_to_many :attributes, :class => @c1, :key =>[:node_id, :y], :primary_key=>[:id, :x]
1360
-
1361
- n = @c2.load(:id => 1234, :x=>5)
1362
- a = @c1.load(:id => 2345, :node_id=>1234, :y=>5)
1363
- n.remove_attribute(a).should == a
1364
- sqls = DB.sqls
1365
- sqls.pop.should =~ /UPDATE attributes SET (node_id|y) = NULL, (node_id|y) = NULL WHERE \(id = 2345\)/
1366
- sqls.should == ["SELECT 1 AS one FROM attributes WHERE ((attributes.node_id = 1234) AND (attributes.y = 5) AND (id = 2345)) LIMIT 1"]
1367
- end
1368
-
1369
- it "should accept a array of composite primary key values for the remove_ method and remove an existing record" do
1370
- @c1.set_primary_key [:id, :y]
1371
- @c2.one_to_many :attributes, :class => @c1, :key=>:node_id, :primary_key=>:id
1372
- n = @c2.new(:id => 123)
1373
- @c1.dataset._fetch = {:id=>234, :node_id=>123, :y=>5}
1374
- n.remove_attribute([234, 5]).should == @c1.load(:node_id => nil, :y => 5, :id => 234)
1375
- sqls = DB.sqls
1376
- sqls.length.should == 2
1377
- sqls.first.should =~ /SELECT \* FROM attributes WHERE \(\(attributes.node_id = 123\) AND \(attributes\.(id|y) = (234|5)\) AND \(attributes\.(id|y) = (234|5)\)\) LIMIT 1/
1378
- sqls.last.should =~ /UPDATE attributes SET node_id = NULL WHERE \(\((id|y) = (234|5)\) AND \((id|y) = (234|5)\)\)/
1379
- end
1380
-
1381
- it "should raise an error in add_ and remove_ if the passed object returns false to save (is not valid)" do
1382
- @c2.one_to_many :attributes, :class => @c1
1383
- n = @c2.new(:id => 1234)
1384
- a = @c1.new(:id => 2345)
1385
- def a.validate() errors.add(:id, 'foo') end
1386
- proc{n.add_attribute(a)}.should raise_error(Sequel::Error)
1387
- proc{n.remove_attribute(a)}.should raise_error(Sequel::Error)
1388
- end
1389
-
1390
- it "should not validate the associated object in add_ and remove_ if the :validate=>false option is used" do
1391
- @c2.one_to_many :attributes, :class => @c1, :validate=>false
1392
- n = @c2.new(:id => 1234)
1393
- a = @c1.new(:id => 2345)
1394
- def a.validate() errors.add(:id, 'foo') end
1395
- n.add_attribute(a).should == a
1396
- n.remove_attribute(a).should == a
1397
- end
1398
-
1399
- it "should not raise exception in add_ and remove_ if the :raise_on_save_failure=>false option is used" do
1400
- @c2.one_to_many :attributes, :class => @c1, :raise_on_save_failure=>false
1401
- n = @c2.new(:id => 1234)
1402
- a = @c1.new(:id => 2345)
1403
- def a.validate() errors.add(:id, 'foo') end
1404
- n.associations[:attributes] = []
1405
- n.add_attribute(a).should == nil
1406
- n.associations[:attributes].should == []
1407
- n.remove_attribute(a).should == nil
1408
- n.associations[:attributes].should == []
1409
- end
1410
-
1411
- it "should raise an error if the model object doesn't have a valid primary key" do
1412
- @c2.one_to_many :attributes, :class => @c1
1413
- a = @c2.new
1414
- n = @c1.load(:id=>123)
1415
- proc{a.attributes_dataset}.should raise_error(Sequel::Error)
1416
- proc{a.add_attribute(n)}.should raise_error(Sequel::Error)
1417
- proc{a.remove_attribute(n)}.should raise_error(Sequel::Error)
1418
- proc{a.remove_all_attributes}.should raise_error(Sequel::Error)
1419
- end
1420
-
1421
- it "should use :primary_key option if given" do
1422
- @c1.one_to_many :nodes, :class => @c2, :primary_key => :node_id, :key=>:id
1423
- @c1.load(:id => 1234, :node_id=>4321).nodes_dataset.sql.should == "SELECT * FROM nodes WHERE (nodes.id = 4321)"
1424
- end
1425
-
1426
- it "should support a select option" do
1427
- @c2.one_to_many :attributes, :class => @c1, :select => [:id, :name]
1428
- @c2.new(:id => 1234).attributes_dataset.sql.should == "SELECT id, name FROM attributes WHERE (attributes.node_id = 1234)"
1429
- end
1430
-
1431
- it "should support a conditions option" do
1432
- @c2.one_to_many :attributes, :class => @c1, :conditions => {:a=>32}
1433
- @c2.new(:id => 1234).attributes_dataset.sql.should == "SELECT * FROM attributes WHERE ((a = 32) AND (attributes.node_id = 1234))"
1434
- @c2.one_to_many :attributes, :class => @c1, :conditions => Sequel.~(:a)
1435
- @c2.new(:id => 1234).attributes_dataset.sql.should == "SELECT * FROM attributes WHERE (NOT a AND (attributes.node_id = 1234))"
1436
- end
1437
-
1438
- it "should support an order option" do
1439
- @c2.one_to_many :attributes, :class => @c1, :order => :kind
1440
- @c2.new(:id => 1234).attributes_dataset.sql.should == "SELECT * FROM attributes WHERE (attributes.node_id = 1234) ORDER BY kind"
1441
- end
1442
-
1443
- it "should support an array for the order option" do
1444
- @c2.one_to_many :attributes, :class => @c1, :order => [:kind1, :kind2]
1445
- @c2.new(:id => 1234).attributes_dataset.sql.should == "SELECT * FROM attributes WHERE (attributes.node_id = 1234) ORDER BY kind1, kind2"
1446
- end
1447
-
1448
- it "should have a dataset method for the associated object dataset" do
1449
- @c2.one_to_many :attributes, :class => @c1
1450
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE (attributes.node_id = 1234)'
1451
- end
1452
-
1453
- it "should accept a block" do
1454
- @c2.one_to_many :attributes, :class => @c1 do |ds|
1455
- ds.filter(:xxx => nil)
1456
- end
1457
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE ((attributes.node_id = 1234) AND (xxx IS NULL))'
1458
- end
1459
-
1460
- it "should support :order option with block" do
1461
- @c2.one_to_many :attributes, :class => @c1, :order => :kind do |ds|
1462
- ds.filter(:xxx => nil)
1463
- end
1464
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE ((attributes.node_id = 1234) AND (xxx IS NULL)) ORDER BY kind'
1465
- end
1466
-
1467
- it "should have the block argument affect the _dataset method" do
1468
- @c2.one_to_many :attributes, :class => @c1 do |ds|
1469
- ds.filter(:xxx => 456)
1470
- end
1471
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE ((attributes.node_id = 1234) AND (xxx = 456))'
1472
- end
1473
-
1474
- it "should support a :dataset option that is used instead of the default" do
1475
- c1 = @c1
1476
- @c2.one_to_many :all_other_attributes, :class => @c1, :dataset=>proc{c1.exclude(:nodeid=>pk)}, :order=>:a, :limit=>10 do |ds|
1477
- ds.filter(:xxx => 5)
1478
- end
1479
- @c2.new(:id => 1234).all_other_attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE ((nodeid != 1234) AND (xxx = 5)) ORDER BY a LIMIT 10'
1480
- @c2.new(:id => 1234).all_other_attributes.should == [@c1.load({})]
1481
- DB.sqls.should == ['SELECT * FROM attributes WHERE ((nodeid != 1234) AND (xxx = 5)) ORDER BY a LIMIT 10']
1482
- end
1483
-
1484
- it "should support a :limit option" do
1485
- @c2.one_to_many :attributes, :class => @c1 , :limit=>10
1486
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE (attributes.node_id = 1234) LIMIT 10'
1487
- @c2.one_to_many :attributes, :class => @c1 , :limit=>[10,10]
1488
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT * FROM attributes WHERE (attributes.node_id = 1234) LIMIT 10 OFFSET 10'
1489
- end
1490
-
1491
- it "should have the :eager option affect the _dataset method" do
1492
- @c2.one_to_many :attributes, :class => @c2 , :eager=>:attributes
1493
- @c2.new(:id => 1234).attributes_dataset.opts[:eager].should == {:attributes=>nil}
1494
- end
1495
-
1496
- it "should populate cache when accessed" do
1497
- @c2.one_to_many :attributes, :class => @c1
1498
- n = @c2.new(:id => 1234)
1499
- n.associations.include?(:attributes).should == false
1500
- atts = n.attributes
1501
- atts.should == n.associations[:attributes]
1502
- DB.sqls.should == ['SELECT * FROM attributes WHERE (attributes.node_id = 1234)']
1503
- end
1504
-
1505
- it "should use cache if available" do
1506
- @c2.one_to_many :attributes, :class => @c1
1507
- n = @c2.new(:id => 1234)
1508
- n.associations[:attributes] = 42
1509
- n.attributes.should == 42
1510
- DB.sqls.should == []
1511
- end
1512
-
1513
- it "should not use cache if asked to reload" do
1514
- @c2.one_to_many :attributes, :class => @c1
1515
- n = @c2.new(:id => 1234)
1516
- n.associations[:attributes] = 42
1517
- n.attributes(true).should_not == 42
1518
- DB.sqls.should == ['SELECT * FROM attributes WHERE (attributes.node_id = 1234)']
1519
- end
1520
-
1521
- it "should add item to cache if it exists when calling add_" do
1522
- @c2.one_to_many :attributes, :class => @c1
1523
- n = @c2.new(:id => 1234)
1524
- att = @c1.load(:id => 345)
1525
- a = []
1526
- n.associations[:attributes] = a
1527
- n.add_attribute(att)
1528
- a.should == [att]
1529
- end
1530
-
1531
- it "should set object to item's reciprocal cache when calling add_" do
1532
- @c2.one_to_many :attributes, :class => @c1
1533
- @c1.many_to_one :node, :class => @c2
1534
-
1535
- n = @c2.new(:id => 1234)
1536
- att = @c1.new(:id => 345)
1537
- n.add_attribute(att)
1538
- att.node.should == n
1539
- end
1540
-
1541
- it "should remove item from cache if it exists when calling remove_" do
1542
- @c2.one_to_many :attributes, :class => @c1
1543
-
1544
- n = @c2.load(:id => 1234)
1545
- att = @c1.load(:id => 345)
1546
- a = [att]
1547
- n.associations[:attributes] = a
1548
- n.remove_attribute(att)
1549
- a.should == []
1550
- end
1551
-
1552
- it "should remove item's reciprocal cache calling remove_" do
1553
- @c2.one_to_many :attributes, :class => @c1
1554
- @c1.many_to_one :node, :class => @c2
1555
-
1556
- n = @c2.new(:id => 1234)
1557
- att = @c1.new(:id => 345)
1558
- att.associations[:node] = n
1559
- att.node.should == n
1560
- n.remove_attribute(att)
1561
- att.node.should == nil
1562
- end
1563
-
1564
- it "should not create the add_, remove_, or remove_all_ methods if :read_only option is used" do
1565
- @c2.one_to_many :attributes, :class => @c1, :read_only=>true
1566
- im = @c2.instance_methods.collect{|x| x.to_s}
1567
- im.should(include('attributes'))
1568
- im.should(include('attributes_dataset'))
1569
- im.should_not(include('add_attribute'))
1570
- im.should_not(include('remove_attribute'))
1571
- im.should_not(include('remove_all_attributes'))
1572
- end
1573
-
1574
- it "should not add associations methods directly to class" do
1575
- @c2.one_to_many :attributes, :class => @c1
1576
- im = @c2.instance_methods.collect{|x| x.to_s}
1577
- im.should(include('attributes'))
1578
- im.should(include('attributes_dataset'))
1579
- im.should(include('add_attribute'))
1580
- im.should(include('remove_attribute'))
1581
- im.should(include('remove_all_attributes'))
1582
- im2 = @c2.instance_methods(false).collect{|x| x.to_s}
1583
- im2.should_not(include('attributes'))
1584
- im2.should_not(include('attributes_dataset'))
1585
- im2.should_not(include('add_attribute'))
1586
- im2.should_not(include('remove_attribute'))
1587
- im2.should_not(include('remove_all_attributes'))
1588
- end
1589
-
1590
- it "should populate the reciprocal many_to_one cache when loading the one_to_many association" do
1591
- @c2.one_to_many :attributes, :class => @c1, :key => :node_id
1592
- @c1.many_to_one :node, :class => @c2, :key => :node_id
1593
-
1594
- n = @c2.new(:id => 1234)
1595
- atts = n.attributes
1596
- DB.sqls.should == ['SELECT * FROM attributes WHERE (attributes.node_id = 1234)']
1597
- atts.should == [@c1.load({})]
1598
- atts.map{|a| a.node}.should == [n]
1599
- DB.sqls.should == []
1600
- end
1601
-
1602
- it "should use an explicit :reciprocal option if given" do
1603
- @c2.one_to_many :attributes, :class => @c1, :key => :node_id, :reciprocal=>:wxyz
1604
-
1605
- n = @c2.new(:id => 1234)
1606
- atts = n.attributes
1607
- DB.sqls.should == ['SELECT * FROM attributes WHERE (attributes.node_id = 1234)']
1608
- atts.should == [@c1.load({})]
1609
- atts.map{|a| a.associations[:wxyz]}.should == [n]
1610
- DB.sqls.should == []
1611
- end
1612
-
1613
- it "should have an remove_all_ method that removes all associated objects" do
1614
- @c2.one_to_many :attributes, :class => @c1
1615
- @c2.new(:id => 1234).remove_all_attributes
1616
- DB.sqls.should == ['UPDATE attributes SET node_id = NULL WHERE (node_id = 1234)']
1617
- end
1618
-
1619
- it "should have remove_all method respect association filters" do
1620
- @c2.one_to_many :attributes, :class => @c1, :conditions=>{:a=>1} do |ds|
1621
- ds.filter(:b=>2)
1622
- end
1623
- @c2.new(:id => 1234).remove_all_attributes
1624
- DB.sqls.should == ['UPDATE attributes SET node_id = NULL WHERE ((a = 1) AND (node_id = 1234) AND (b = 2))']
1625
- end
1626
-
1627
- it "should have the remove_all_ method respect the :primary_key option" do
1628
- @c2.one_to_many :attributes, :class => @c1, :primary_key=>:xxx
1629
- @c2.new(:id => 1234, :xxx=>5).remove_all_attributes
1630
- DB.sqls.should == ['UPDATE attributes SET node_id = NULL WHERE (node_id = 5)']
1631
- end
1632
-
1633
- it "should have the remove_all_ method respect composite keys" do
1634
- @c2.one_to_many :attributes, :class => @c1, :key=>[:node_id, :y], :primary_key=>[:id, :x]
1635
- @c2.new(:id => 1234, :x=>5).remove_all_attributes
1636
- sqls = DB.sqls
1637
- sqls.pop.should =~ /UPDATE attributes SET (node_id|y) = NULL, (node_id|y) = NULL WHERE \(\(node_id = 1234\) AND \(y = 5\)\)/
1638
- sqls.should == []
1639
- end
1640
-
1641
- it "remove_all should set the cache to []" do
1642
- @c2.one_to_many :attributes, :class => @c1
1643
- node = @c2.new(:id => 1234)
1644
- node.remove_all_attributes
1645
- node.associations[:attributes].should == []
1646
- end
1647
-
1648
- it "remove_all should return the array of previously associated items if the cache is populated" do
1649
- @c2.one_to_many :attributes, :class => @c1
1650
- attrib = @c1.new(:id=>3)
1651
- node = @c2.new(:id => 1234)
1652
- @c1.dataset._fetch = [[], [{:id=>3, :node_id=>1234}]]
1653
- node.attributes.should == []
1654
- node.add_attribute(attrib)
1655
- node.associations[:attributes].should == [attrib]
1656
- node.remove_all_attributes.should == [attrib]
1657
- end
1658
-
1659
- it "remove_all should return nil if the cache is not populated" do
1660
- @c2.one_to_many :attributes, :class => @c1
1661
- @c2.new(:id => 1234).remove_all_attributes.should == nil
1662
- end
1663
-
1664
- it "remove_all should remove the current item from all reciprocal association caches if they are populated" do
1665
- @c2.one_to_many :attributes, :class => @c1
1666
- @c1.many_to_one :node, :class => @c2
1667
- @c2.dataset._fetch = []
1668
- @c1.dataset._fetch = [[], [{:id=>3, :node_id=>1234}]]
1669
- attrib = @c1.new(:id=>3)
1670
- node = @c2.load(:id => 1234)
1671
- node.attributes.should == []
1672
- attrib.node.should == nil
1673
- node.add_attribute(attrib)
1674
- attrib.associations[:node].should == node
1675
- node.remove_all_attributes
1676
- attrib.associations.fetch(:node, 2).should == nil
1677
- end
1678
-
1679
- it "should call an _add_ method internally to add attributes" do
1680
- @c2.one_to_many :attributes, :class => @c1
1681
- @c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_add_attribute"))
1682
- p = @c2.load(:id=>10)
1683
- c = @c1.load(:id=>123)
1684
- def p._add_attribute(x)
1685
- @x = x
1686
- end
1687
- c.should_not_receive(:node_id=)
1688
- p.add_attribute(c)
1689
- p.instance_variable_get(:@x).should == c
1690
- end
1691
-
1692
- it "should support an :adder option for defining the _add_ method" do
1693
- @c2.one_to_many :attributes, :class => @c1, :adder=>proc{|x| @x = x}
1694
- p = @c2.load(:id=>10)
1695
- c = @c1.load(:id=>123)
1696
- c.should_not_receive(:node_id=)
1697
- p.add_attribute(c)
1698
- p.instance_variable_get(:@x).should == c
1699
- end
1700
-
1701
- it "should allow additional arguments given to the add_ method and pass them onwards to the _add_ method" do
1702
- @c2.one_to_many :attributes, :class => @c1
1703
- p = @c2.load(:id=>10)
1704
- c = @c1.load(:id=>123)
1705
- def p._add_attribute(x,*y)
1706
- @x = x
1707
- @y = y
1708
- end
1709
- c.should_not_receive(:node_id=)
1710
- p.add_attribute(c,:foo,:bar=>:baz)
1711
- p.instance_variable_get(:@x).should == c
1712
- p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
1713
- end
1714
-
1715
- it "should call a _remove_ method internally to remove attributes" do
1716
- @c2.one_to_many :attributes, :class => @c1
1717
- @c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_remove_attribute"))
1718
- p = @c2.load(:id=>10)
1719
- c = @c1.load(:id=>123)
1720
- def p._remove_attribute(x)
1721
- @x = x
1722
- end
1723
- c.should_not_receive(:node_id=)
1724
- p.remove_attribute(c)
1725
- p.instance_variable_get(:@x).should == c
1726
- end
1727
-
1728
- it "should support a :remover option for defining the _remove_ method" do
1729
- @c2.one_to_many :attributes, :class => @c1, :remover=>proc{|x| @x = x}
1730
- p = @c2.load(:id=>10)
1731
- c = @c1.load(:id=>123)
1732
- c.should_not_receive(:node_id=)
1733
- p.remove_attribute(c)
1734
- p.instance_variable_get(:@x).should == c
1735
- end
1736
-
1737
- it "should allow additional arguments given to the remove_ method and pass them onwards to the _remove_ method" do
1738
- @c2.one_to_many :attributes, :class => @c1, :reciprocal=>nil
1739
- p = @c2.load(:id=>10)
1740
- c = @c1.load(:id=>123)
1741
- def p._remove_attribute(x,*y)
1742
- @x = x
1743
- @y = y
1744
- end
1745
- c.should_not_receive(:node_id=)
1746
- p.remove_attribute(c,:foo,:bar=>:baz)
1747
- p.instance_variable_get(:@x).should == c
1748
- p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
1749
- end
1750
-
1751
- it "should allow additional arguments given to the remove_all_ method and pass them onwards to the _remove_all_ method" do
1752
- @c2.one_to_many :attributes, :class => @c1
1753
- p = @c2.load(:id=>10)
1754
- c = @c1.load(:id=>123)
1755
- def p._remove_all_attributes(*y)
1756
- @y = y
1757
- end
1758
- c.should_not_receive(:node_id=)
1759
- p.remove_all_attributes(:foo,:bar=>:baz)
1760
- p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
1761
- end
1762
-
1763
- it "should call a _remove_all_ method internally to remove attributes" do
1764
- @c2.one_to_many :attributes, :class => @c1
1765
- @c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_remove_all_attributes"))
1766
- p = @c2.load(:id=>10)
1767
- def p._remove_all_attributes
1768
- @x = :foo
1769
- end
1770
- p.remove_all_attributes
1771
- p.instance_variable_get(:@x).should == :foo
1772
- end
1773
-
1774
- it "should support a :clearer option for defining the _remove_all_ method" do
1775
- @c2.one_to_many :attributes, :class => @c1, :clearer=>proc{@x = :foo}
1776
- p = @c2.load(:id=>10)
1777
- p.remove_all_attributes
1778
- p.instance_variable_get(:@x).should == :foo
1779
- end
1780
-
1781
- it "should support (before|after)_(add|remove) callbacks" do
1782
- h = []
1783
- @c2.one_to_many :attributes, :class => @c1, :before_add=>[proc{|x,y| h << x.pk; h << -y.pk}, :blah], :after_add=>proc{h << 3}, :before_remove=>:blah, :after_remove=>[:blahr]
1784
- @c2.class_eval do
1785
- self::Foo = h
1786
- def _add_attribute(v)
1787
- model::Foo << 4
1788
- end
1789
- def _remove_attribute(v)
1790
- model::Foo << 5
1791
- end
1792
- def blah(x)
1793
- model::Foo << x.pk
1794
- end
1795
- def blahr(x)
1796
- model::Foo << 6
1797
- end
1798
- end
1799
- p = @c2.load(:id=>10)
1800
- c = @c1.load(:id=>123)
1801
- h.should == []
1802
- p.add_attribute(c)
1803
- h.should == [10, -123, 123, 4, 3]
1804
- p.remove_attribute(c)
1805
- h.should == [10, -123, 123, 4, 3, 123, 5, 6]
1806
- end
1807
-
1808
- it "should support after_load association callback" do
1809
- h = []
1810
- @c2.one_to_many :attributes, :class => @c1, :after_load=>[proc{|x,y| h << [x.pk, y.collect{|z|z.pk}]}, :al]
1811
- @c2.class_eval do
1812
- self::Foo = h
1813
- def al(v)
1814
- v.each{|x| model::Foo << x.pk}
1815
- end
1816
- end
1817
- @c1.dataset._fetch = [{:id=>20}, {:id=>30}]
1818
- p = @c2.load(:id=>10, :parent_id=>20)
1819
- attributes = p.attributes
1820
- h.should == [[10, [20, 30]], 20, 30]
1821
- attributes.collect{|a| a.pk}.should == [20, 30]
1822
- end
1823
-
1824
- it "should raise error and not call internal add or remove method if before callback returns false if raise_on_save_failure is true" do
1825
- p = @c2.load(:id=>10)
1826
- c = @c1.load(:id=>123)
1827
- @c2.one_to_many :attributes, :class => @c1, :before_add=>:ba, :before_remove=>:br
1828
- p.should_receive(:ba).once.with(c).and_return(false)
1829
- p.should_not_receive(:_add_attribute)
1830
- p.should_not_receive(:_remove_attribute)
1831
- p.associations[:attributes] = []
1832
- proc{p.add_attribute(c)}.should raise_error(Sequel::Error)
1833
- p.attributes.should == []
1834
- p.associations[:attributes] = [c]
1835
- p.should_receive(:br).once.with(c).and_return(false)
1836
- proc{p.remove_attribute(c)}.should raise_error(Sequel::Error)
1837
- p.attributes.should == [c]
1838
- end
1839
-
1840
- it "should return nil and not call internal add or remove method if before callback returns false if raise_on_save_failure is false" do
1841
- p = @c2.load(:id=>10)
1842
- c = @c1.load(:id=>123)
1843
- p.raise_on_save_failure = false
1844
- @c2.one_to_many :attributes, :class => @c1, :before_add=>:ba, :before_remove=>:br
1845
- p.should_receive(:ba).once.with(c).and_return(false)
1846
- p.should_not_receive(:_add_attribute)
1847
- p.should_not_receive(:_remove_attribute)
1848
- p.associations[:attributes] = []
1849
- p.add_attribute(c).should == nil
1850
- p.attributes.should == []
1851
- p.associations[:attributes] = [c]
1852
- p.should_receive(:br).once.with(c).and_return(false)
1853
- p.remove_attribute(c).should == nil
1854
- p.attributes.should == [c]
1855
- end
1856
- end
1857
-
1858
- describe Sequel::Model, "many_to_many" do
1859
- before do
1860
- @c1 = Class.new(Sequel::Model(:attributes)) do
1861
- unrestrict_primary_key
1862
- attr_accessor :yyy
1863
- def self.name; 'Attribute'; end
1864
- def self.to_s; 'Attribute'; end
1865
- columns :id, :y, :z
1866
- end
1867
-
1868
- @c2 = Class.new(Sequel::Model(:nodes)) do
1869
- unrestrict_primary_key
1870
- attr_accessor :xxx
1871
-
1872
- def self.name; 'Node'; end
1873
- def self.to_s; 'Node'; end
1874
- columns :id, :x
1875
- end
1876
- @dataset = @c2.dataset
1877
- @c1.dataset.autoid = 1
1878
-
1879
- [@c1, @c2].each{|c| c.dataset._fetch = {}}
1880
- DB.reset
1881
- end
1882
-
1883
- it "should raise an error if current class does not have a primary key, and :left_primary_key is not specified" do
1884
- @c2.no_primary_key
1885
- proc{@c2.many_to_many :attributes, :class => @c1}.should raise_error(Sequel::Error)
1886
- DB.sqls.should == []
1887
- end
1888
-
1889
- it "should raise an error if associated class does not have a primary key, and :right_primary_key is not specified" do
1890
- @c1.no_primary_key
1891
- @c2.many_to_many :attributes, :class => @c1
1892
- d = @c2.new(:id => 1234)
1893
- proc{d.attributes}.should raise_error(Sequel::Error)
1894
- DB.sqls.should == []
1895
- end
1896
-
1897
- it "should use implicit key values and join table if omitted" do
1898
- @c2.many_to_many :attributes, :class => @c1
1899
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)'
1900
- end
1901
-
1902
- it "should use implicit key values and join table if omitted" do
1903
- @c2.one_through_one :attribute, :class => @c1
1904
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 1'
1905
- end
1906
-
1907
- it "should use implicit class if omitted" do
1908
- begin
1909
- class ::Tag < Sequel::Model; end
1910
- @c2.many_to_many :tags
1911
- @c2.new(:id => 1234).tags_dataset.sql.should == 'SELECT tags.* FROM tags INNER JOIN nodes_tags ON (nodes_tags.tag_id = tags.id) WHERE (nodes_tags.node_id = 1234)'
1912
- ensure
1913
- Object.send(:remove_const, :Tag)
1914
- end
1915
- end
1916
-
1917
- it "should use class inside module if given as a string" do
1918
- begin
1919
- module ::Historical
1920
- class Tag < Sequel::Model; end
1921
- end
1922
- @c2.many_to_many :tags, :class=>'::Historical::Tag'
1923
- @c2.new(:id => 1234).tags_dataset.sql.should == 'SELECT tags.* FROM tags INNER JOIN nodes_tags ON (nodes_tags.tag_id = tags.id) WHERE (nodes_tags.node_id = 1234)'
1924
- ensure
1925
- Object.send(:remove_const, :Historical)
1926
- end
1927
- end
1928
-
1929
- it "should not override a selection consisting completely of qualified columns using Sequel::SQL::QualifiedIdentifier" do
1930
- @c1.dataset = @c1.dataset.select(Sequel.qualify(:attributes, :id), Sequel.qualify(:attributes, :b))
1931
- @c2.many_to_many :attributes, :class => @c1
1932
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.id, attributes.b FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)'
1933
- end
1934
-
1935
- it "should not override a selection consisting completely of qualified columns using symbols" do
1936
- @c1.dataset = @c1.dataset.select(:attributes__id, :attributes__b)
1937
- @c2.many_to_many :attributes, :class => @c1
1938
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.id, attributes.b FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)'
1939
- end
1940
-
1941
- it "should not override a selection consisting completely of qualified columns using Sequel::SQL::AliasedExpression" do
1942
- @c1.dataset = @c1.dataset.select(Sequel.qualify(:attributes, :id).as(:a), Sequel.as(:attributes__b, :c))
1943
- @c2.many_to_many :attributes, :class => @c1
1944
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.id AS a, attributes.b AS c FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)'
1945
- end
1946
-
1947
- it "should override a selection consisting of non qualified columns" do
1948
- @c1.dataset = @c1.dataset.select{foo(:bar)}
1949
- @c2.many_to_many :attributes, :class => @c1
1950
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)'
1951
- end
1952
-
1953
- it "should respect :eager_loader_predicate_key when lazily loading" do
1954
- @c2.many_to_many :attributes, :class => @c1, :eager_loading_predicate_key=>Sequel.subscript(:attributes_nodes__node_id, 0)
1955
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id[0] = 1234)'
1956
- end
1957
-
1958
- it "should use explicit key values and join table if given" do
1959
- @c2.many_to_many :attributes, :class => @c1, :left_key => :nodeid, :right_key => :attributeid, :join_table => :attribute2node
1960
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attribute2node ON (attribute2node.attributeid = attributes.id) WHERE (attribute2node.nodeid = 1234)'
1961
- end
1962
-
1963
- it "should support a conditions option" do
1964
- @c2.many_to_many :attributes, :class => @c1, :conditions => {:a=>32}
1965
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((a = 32) AND (attributes_nodes.node_id = 1234))'
1966
-
1967
- @c2.many_to_many :attributes, :class => @c1, :conditions => ['a = ?', 32]
1968
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((a = 32) AND (attributes_nodes.node_id = 1234))'
1969
- @c2.new(:id => 1234).attributes.should == [@c1.load({})]
1970
- end
1971
-
1972
- it "should support an order option" do
1973
- @c2.many_to_many :attributes, :class => @c1, :order => :blah
1974
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) ORDER BY blah'
1975
- end
1976
-
1977
- it "should support an array for the order option" do
1978
- @c2.many_to_many :attributes, :class => @c1, :order => [:blah1, :blah2]
1979
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) ORDER BY blah1, blah2'
1980
- end
1981
-
1982
- it "should support :left_primary_key and :right_primary_key options" do
1983
- @c2.many_to_many :attributes, :class => @c1, :left_primary_key=>:xxx, :right_primary_key=>:yyy
1984
- @c2.new(:id => 1234, :xxx=>5).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.yyy) WHERE (attributes_nodes.node_id = 5)'
1985
- end
1986
-
1987
- it "should support composite keys" do
1988
- @c2.many_to_many :attributes, :class => @c1, :left_key=>[:l1, :l2], :right_key=>[:r1, :r2], :left_primary_key=>[:id, :x], :right_primary_key=>[:id, :y]
1989
- @c2.load(:id => 1234, :x=>5).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON ((attributes_nodes.r1 = attributes.id) AND (attributes_nodes.r2 = attributes.y)) WHERE ((attributes_nodes.l1 = 1234) AND (attributes_nodes.l2 = 5))'
1990
- end
1991
-
1992
- it "should not issue query if not all keys have values" do
1993
- @c2.many_to_many :attributes, :class => @c1, :left_key=>[:l1, :l2], :right_key=>[:r1, :r2], :left_primary_key=>[:id, :x], :right_primary_key=>[:id, :y]
1994
- @c2.load(:id => 1234, :x=>nil).attributes.should == []
1995
- DB.sqls.should == []
1996
- end
1997
-
1998
- it "should raise an Error unless same number of composite keys used" do
1999
- proc{@c2.many_to_many :attributes, :class => @c1, :left_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2000
- proc{@c2.many_to_many :attributes, :class => @c1, :left_primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2001
- proc{@c2.many_to_many :attributes, :class => @c1, :left_key=>[:node_id, :id], :left_primary_key=>:id}.should raise_error(Sequel::Error)
2002
- proc{@c2.many_to_many :attributes, :class => @c1, :left_key=>:id, :left_primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2003
- proc{@c2.many_to_many :attributes, :class => @c1, :left_key=>[:node_id, :id, :x], :left_primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
2004
-
2005
- proc{@c2.many_to_many :attributes, :class => @c1, :right_primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2006
- proc{@c2.many_to_many :attributes, :class => @c1, :right_key=>[:node_id, :id], :right_primary_key=>:id}.should raise_error(Sequel::Error)
2007
- proc{@c2.many_to_many :attributes, :class => @c1, :right_key=>:id, :left_primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2008
- proc{@c2.many_to_many :attributes, :class => @c1, :right_key=>[:node_id, :id, :x], :right_primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
2009
- end
2010
-
2011
- it "should support a select option" do
2012
- @c2.many_to_many :attributes, :class => @c1, :select => :blah
2013
-
2014
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT blah FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)'
2015
- end
2016
-
2017
- it "should support an array for the select option" do
2018
- @c2.many_to_many :attributes, :class => @c1, :select => [Sequel::SQL::ColumnAll.new(:attributes), :attribute_nodes__blah2]
2019
-
2020
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.*, attribute_nodes.blah2 FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)'
2021
- end
2022
-
2023
- it "should accept a block" do
2024
- @c2.many_to_many :attributes, :class => @c1 do |ds|
2025
- ds.filter(:xxx => @xxx)
2026
- end
2027
-
2028
- n = @c2.new(:id => 1234)
2029
- n.xxx = 555
2030
- n.attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((attributes_nodes.node_id = 1234) AND (xxx = 555))'
2031
- end
2032
-
2033
- it "should allow the :order option while accepting a block" do
2034
- @c2.many_to_many :attributes, :class => @c1, :order=>[:blah1, :blah2] do |ds|
2035
- ds.filter(:xxx => @xxx)
2036
- end
2037
-
2038
- n = @c2.new(:id => 1234)
2039
- n.xxx = 555
2040
- n.attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((attributes_nodes.node_id = 1234) AND (xxx = 555)) ORDER BY blah1, blah2'
2041
- end
2042
-
2043
- it "should support a :dataset option that is used instead of the default" do
2044
- c1 = @c1
2045
- @c2.many_to_many :attributes, :class => @c1, :dataset=>proc{c1.join_table(:natural, :an).filter(:an__nodeid=>pk)}, :order=> :a, :limit=>10, :select=>nil do |ds|
2046
- ds.filter(:xxx => @xxx)
2047
- end
2048
-
2049
- n = @c2.new(:id => 1234)
2050
- n.xxx = 555
2051
- n.attributes_dataset.sql.should == 'SELECT * FROM attributes NATURAL JOIN an WHERE ((an.nodeid = 1234) AND (xxx = 555)) ORDER BY a LIMIT 10'
2052
- n.attributes.should == [@c1.load({})]
2053
- DB.sqls.should == ['SELECT * FROM attributes NATURAL JOIN an WHERE ((an.nodeid = 1234) AND (xxx = 555)) ORDER BY a LIMIT 10']
2054
- end
2055
-
2056
- it "should support a :dataset option that accepts the reflection as an argument" do
2057
- @c2.many_to_many :attributes, :class => @c1, :dataset=>lambda{|opts| opts.associated_class.natural_join(:an).filter(:an__nodeid=>pk)}, :order=> :a, :limit=>10, :select=>nil do |ds|
2058
- ds.filter(:xxx => @xxx)
2059
- end
2060
-
2061
- n = @c2.new(:id => 1234)
2062
- n.xxx = 555
2063
- n.attributes_dataset.sql.should == 'SELECT * FROM attributes NATURAL JOIN an WHERE ((an.nodeid = 1234) AND (xxx = 555)) ORDER BY a LIMIT 10'
2064
- n.attributes.should == [@c1.load({})]
2065
- DB.sqls.should == ['SELECT * FROM attributes NATURAL JOIN an WHERE ((an.nodeid = 1234) AND (xxx = 555)) ORDER BY a LIMIT 10']
2066
- end
2067
-
2068
- it "should support a :limit option" do
2069
- @c2.many_to_many :attributes, :class => @c1 , :limit=>10
2070
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 10'
2071
- @c2.many_to_many :attributes, :class => @c1 , :limit=>[10, 10]
2072
- @c2.new(:id => 1234).attributes_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 10 OFFSET 10'
2073
- end
2074
-
2075
- it "should have the :eager option affect the _dataset method" do
2076
- @c2.many_to_many :attributes, :class => @c2 , :eager=>:attributes
2077
- @c2.new(:id => 1234).attributes_dataset.opts[:eager].should == {:attributes=>nil}
2078
- end
2079
-
2080
- it "should handle an aliased join table" do
2081
- @c2.many_to_many :attributes, :class => @c1, :join_table => :attribute2node___attributes_nodes
2082
- n = @c2.load(:id => 1234)
2083
- a = @c1.load(:id => 2345)
2084
- n.attributes_dataset.sql.should == "SELECT attributes.* FROM attributes INNER JOIN attribute2node AS attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)"
2085
- a.should == n.add_attribute(a)
2086
- a.should == n.remove_attribute(a)
2087
- n.remove_all_attributes
2088
- sqls = DB.sqls
2089
- ['INSERT INTO attribute2node (node_id, attribute_id) VALUES (1234, 2345)',
2090
- 'INSERT INTO attribute2node (attribute_id, node_id) VALUES (2345, 1234)'].should(include(sqls.shift))
2091
- ["DELETE FROM attribute2node WHERE ((node_id = 1234) AND (attribute_id = 2345))",
2092
- "DELETE FROM attribute2node WHERE ((attribute_id = 2345) AND (node_id = 1234))"].should(include(sqls.shift))
2093
- sqls.should == ["DELETE FROM attribute2node WHERE (node_id = 1234)"]
2094
- end
2095
-
2096
- it "should define an add_ method that works on existing records" do
2097
- @c2.many_to_many :attributes, :class => @c1
2098
-
2099
- n = @c2.load(:id => 1234)
2100
- a = @c1.load(:id => 2345)
2101
- n.add_attribute(a).should == a
2102
- sqls = DB.sqls
2103
- ['INSERT INTO attributes_nodes (node_id, attribute_id) VALUES (1234, 2345)',
2104
- 'INSERT INTO attributes_nodes (attribute_id, node_id) VALUES (2345, 1234)'].should(include(sqls.shift))
2105
- sqls.should == []
2106
- end
2107
-
2108
- it "should define an add_ method that works with a primary key" do
2109
- @c2.many_to_many :attributes, :class => @c1
2110
-
2111
- n = @c2.load(:id => 1234)
2112
- a = @c1.load(:id => 2345)
2113
- @c1.dataset._fetch = {:id=>2345}
2114
- n.add_attribute(2345).should == a
2115
- sqls = DB.sqls
2116
- ['INSERT INTO attributes_nodes (node_id, attribute_id) VALUES (1234, 2345)',
2117
- 'INSERT INTO attributes_nodes (attribute_id, node_id) VALUES (2345, 1234)'].should(include(sqls.pop))
2118
- sqls.should == ["SELECT * FROM attributes WHERE id = 2345"]
2119
- end
2120
-
2121
- it "should raise an error if the primary key passed to the add_ method does not match an existing record" do
2122
- @c2.many_to_many :attributes, :class => @c1
2123
-
2124
- n = @c2.load(:id => 1234)
2125
- @c1.dataset._fetch = []
2126
- proc{n.add_attribute(2345)}.should raise_error(Sequel::NoMatchingRow)
2127
- DB.sqls.should == ["SELECT * FROM attributes WHERE id = 2345"]
2128
- end
2129
-
2130
- it "should allow passing a hash to the add_ method which creates a new record" do
2131
- @c2.many_to_many :attributes, :class => @c1
2132
-
2133
- n = @c2.load(:id => 1234)
2134
- @c1.dataset._fetch = @c1.instance_dataset._fetch = {:id=>1}
2135
- n.add_attribute(:id => 1).should == @c1.load(:id => 1)
2136
- sqls = DB.sqls
2137
- ['INSERT INTO attributes_nodes (node_id, attribute_id) VALUES (1234, 1)',
2138
- 'INSERT INTO attributes_nodes (attribute_id, node_id) VALUES (1, 1234)'
2139
- ].should(include(sqls.pop))
2140
- sqls.should == ['INSERT INTO attributes (id) VALUES (1)', "SELECT * FROM attributes WHERE (id = 1) LIMIT 1"]
2141
- end
2142
-
2143
- it "should define a remove_ method that works on existing records" do
2144
- @c2.many_to_many :attributes, :class => @c1
2145
-
2146
- n = @c2.new(:id => 1234)
2147
- a = @c1.new(:id => 2345)
2148
- n.remove_attribute(a).should == a
2149
- DB.sqls.should == ['DELETE FROM attributes_nodes WHERE ((node_id = 1234) AND (attribute_id = 2345))']
2150
- end
2151
-
2152
- it "should raise an error in the add_ method if the passed associated object is not of the correct type" do
2153
- @c2.many_to_many :attributes, :class => @c1
2154
- proc{@c2.new(:id => 1234).add_attribute(@c2.new)}.should raise_error(Sequel::Error)
2155
- end
2156
-
2157
- it "should accept a primary key for the remove_ method and remove an existing record" do
2158
- @c2.many_to_many :attributes, :class => @c1
2159
- n = @c2.new(:id => 1234)
2160
- @c1.dataset._fetch = {:id=>234}
2161
- n.remove_attribute(234).should == @c1.load(:id => 234)
2162
- DB.sqls.should == ["SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((attributes_nodes.node_id = 1234) AND (attributes.id = 234)) LIMIT 1",
2163
- "DELETE FROM attributes_nodes WHERE ((node_id = 1234) AND (attribute_id = 234))"]
2164
- end
2165
-
2166
- it "should raise an error in the remove_ method if the passed associated object is not of the correct type" do
2167
- @c2.many_to_many :attributes, :class => @c1
2168
- proc{@c2.new(:id => 1234).remove_attribute(@c2.new)}.should raise_error(Sequel::Error)
2169
- end
2170
-
2171
- it "should have the add_ method respect the :left_primary_key and :right_primary_key options" do
2172
- @c2.many_to_many :attributes, :class => @c1, :left_primary_key=>:xxx, :right_primary_key=>:yyy
2173
-
2174
- n = @c2.load(:id => 1234).set(:xxx=>5)
2175
- a = @c1.load(:id => 2345).set(:yyy=>8)
2176
- n.add_attribute(a).should == a
2177
- sqls = DB.sqls
2178
- ['INSERT INTO attributes_nodes (node_id, attribute_id) VALUES (5, 8)',
2179
- 'INSERT INTO attributes_nodes (attribute_id, node_id) VALUES (8, 5)'
2180
- ].should(include(sqls.pop))
2181
- sqls.should == []
2182
- end
2183
-
2184
- it "should have add_ method not add the same object to the cached association array if the object is already in the array" do
2185
- @c2.many_to_many :attributes, :class => @c1
2186
-
2187
- n = @c2.load(:id => 1234).set(:xxx=>5)
2188
- a = @c1.load(:id => 2345).set(:yyy=>8)
2189
- n.associations[:attributes] = []
2190
- a.should == n.add_attribute(a)
2191
- a.should == n.add_attribute(a)
2192
- n.attributes.should == [a]
2193
- end
2194
-
2195
- it "should have the add_ method respect composite keys" do
2196
- @c2.many_to_many :attributes, :class => @c1, :left_key=>[:l1, :l2], :right_key=>[:r1, :r2], :left_primary_key=>[:id, :x], :right_primary_key=>[:id, :z]
2197
- n = @c2.load(:id => 1234, :x=>5)
2198
- a = @c1.load(:id => 2345, :z=>8)
2199
- a.should == n.add_attribute(a)
2200
- sqls = DB.sqls
2201
- m = /INSERT INTO attributes_nodes \((\w+), (\w+), (\w+), (\w+)\) VALUES \((\d+), (\d+), (\d+), (\d+)\)/.match(sqls.pop)
2202
- sqls.should == []
2203
- m.should_not == nil
2204
- map = {'l1'=>1234, 'l2'=>5, 'r1'=>2345, 'r2'=>8}
2205
- %w[l1 l2 r1 r2].each do |x|
2206
- v = false
2207
- 4.times do |i| i += 1
2208
- if m[i] == x
2209
- m[i+4].should == map[x].to_s
2210
- v = true
2211
- end
2212
- end
2213
- v.should == true
2214
- end
2215
- end
2216
-
2217
- it "should have the add_ method respect composite keys" do
2218
- @c2.many_to_many :attributes, :class => @c1, :left_key=>[:l1, :l2], :right_key=>[:r1, :r2], :left_primary_key=>[:id, :x], :right_primary_key=>[:id, :z]
2219
- @c1.set_primary_key [:id, :z]
2220
- n = @c2.load(:id => 1234, :x=>5)
2221
- a = @c1.load(:id => 2345, :z=>8)
2222
- @c1.dataset._fetch = {:id => 2345, :z=>8}
2223
- n.add_attribute([2345, 8]).should == a
2224
- sqls = DB.sqls
2225
- sqls.shift.should =~ /SELECT \* FROM attributes WHERE \(\((id|z) = (8|2345)\) AND \((id|z) = (8|2345)\)\) LIMIT 1/
2226
- sqls.pop.should =~ /INSERT INTO attributes_nodes \([lr][12], [lr][12], [lr][12], [lr][12]\) VALUES \((1234|5|2345|8), (1234|5|2345|8), (1234|5|2345|8), (1234|5|2345|8)\)/
2227
- sqls.should == []
2228
- end
2229
-
2230
- it "should have the remove_ method respect the :left_primary_key and :right_primary_key options" do
2231
- @c2.many_to_many :attributes, :class => @c1, :left_primary_key=>:xxx, :right_primary_key=>:yyy
2232
-
2233
- n = @c2.new(:id => 1234, :xxx=>5)
2234
- a = @c1.new(:id => 2345, :yyy=>8)
2235
- n.remove_attribute(a).should == a
2236
- DB.sqls.should == ['DELETE FROM attributes_nodes WHERE ((node_id = 5) AND (attribute_id = 8))']
2237
- end
2238
-
2239
- it "should have the remove_ method respect composite keys" do
2240
- @c2.many_to_many :attributes, :class => @c1, :left_key=>[:l1, :l2], :right_key=>[:r1, :r2], :left_primary_key=>[:id, :x], :right_primary_key=>[:id, :z]
2241
- n = @c2.load(:id => 1234, :x=>5)
2242
- a = @c1.load(:id => 2345, :z=>8)
2243
- a.should == n.remove_attribute(a)
2244
- DB.sqls.should == ["DELETE FROM attributes_nodes WHERE ((l1 = 1234) AND (l2 = 5) AND (r1 = 2345) AND (r2 = 8))"]
2245
- end
2246
-
2247
- it "should accept a array of composite primary key values for the remove_ method and remove an existing record" do
2248
- @c1.set_primary_key [:id, :y]
2249
- @c2.many_to_many :attributes, :class => @c1
2250
- n = @c2.new(:id => 1234)
2251
- @c1.dataset._fetch = {:id=>234, :y=>8}
2252
- @c1.load(:id => 234, :y=>8).should == n.remove_attribute([234, 8])
2253
- sqls = DB.sqls
2254
- ["SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((attributes_nodes.node_id = 1234) AND (attributes.id = 234) AND (attributes.y = 8)) LIMIT 1",
2255
- "SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((attributes_nodes.node_id = 1234) AND (attributes.y = 8) AND (attributes.id = 234)) LIMIT 1"].should include(sqls.shift)
2256
- sqls.should == ["DELETE FROM attributes_nodes WHERE ((node_id = 1234) AND (attribute_id = 234))"]
2257
- end
2258
-
2259
- it "should raise an error if the model object doesn't have a valid primary key" do
2260
- @c2.many_to_many :attributes, :class => @c1
2261
- a = @c2.new
2262
- n = @c1.load(:id=>123)
2263
- proc{a.attributes_dataset}.should raise_error(Sequel::Error)
2264
- proc{a.add_attribute(n)}.should raise_error(Sequel::Error)
2265
- proc{a.remove_attribute(n)}.should raise_error(Sequel::Error)
2266
- proc{a.remove_all_attributes}.should raise_error(Sequel::Error)
2267
- end
2268
-
2269
- it "should save the associated object first in add_ if passed a new model object" do
2270
- @c2.many_to_many :attributes, :class => @c1
2271
- n = @c1.new
2272
- a = @c2.load(:id=>123)
2273
- n.new?.should == true
2274
- @c1.dataset._fetch = {:id=>1}
2275
- a.add_attribute(n)
2276
- n.new?.should == false
2277
- end
2278
-
2279
- it "should raise a ValidationFailed in add_ if the associated object is new and invalid" do
2280
- @c2.many_to_many :attributes, :class => @c1
2281
- n = @c1.new
2282
- a = @c2.load(:id=>123)
2283
- def n.validate() errors.add(:id, 'foo') end
2284
- proc{a.add_attribute(n)}.should raise_error(Sequel::ValidationFailed)
2285
- end
2286
-
2287
- it "should raise an Error in add_ if the associated object is new and invalid and raise_on_save_failure is false" do
2288
- @c2.many_to_many :attributes, :class => @c1
2289
- n = @c1.new
2290
- n.raise_on_save_failure = false
2291
- a = @c2.load(:id=>123)
2292
- def n.validate() errors.add(:id, 'foo') end
2293
- proc{a.add_attribute(n)}.should raise_error(Sequel::Error)
2294
- end
2295
-
2296
- it "should not attempt to validate the associated object in add_ if the :validate=>false option is used" do
2297
- @c2.many_to_many :attributes, :class => @c1, :validate=>false
2298
- n = @c1.new
2299
- a = @c2.load(:id=>123)
2300
- def n.validate() errors.add(:id, 'foo') end
2301
- @c1.dataset._fetch = {:id=>1}
2302
- a.add_attribute(n)
2303
- n.new?.should == false
2304
- end
2305
-
2306
- it "should raise an error if trying to remove a model object that doesn't have a valid primary key" do
2307
- @c2.many_to_many :attributes, :class => @c1
2308
- n = @c1.new
2309
- a = @c2.load(:id=>123)
2310
- proc{a.remove_attribute(n)}.should raise_error(Sequel::Error)
2311
- end
2312
-
2313
- it "should provide an array with all members of the association" do
2314
- @c2.many_to_many :attributes, :class => @c1
2315
-
2316
- @c2.new(:id => 1234).attributes.should == [@c1.load({})]
2317
- DB.sqls.should == ['SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)']
2318
- end
2319
-
2320
- it "should populate cache when accessed" do
2321
- @c2.many_to_many :attributes, :class => @c1
2322
-
2323
- n = @c2.new(:id => 1234)
2324
- n.associations.include?(:attributes).should == false
2325
- atts = n.attributes
2326
- atts.should == n.associations[:attributes]
2327
- end
2328
-
2329
- it "should use cache if available" do
2330
- @c2.many_to_many :attributes, :class => @c1
2331
-
2332
- n = @c2.new(:id => 1234)
2333
- n.associations[:attributes] = 42
2334
- n.attributes.should == 42
2335
- DB.sqls.should == []
2336
- end
2337
-
2338
- it "should not use cache if asked to reload" do
2339
- @c2.many_to_many :attributes, :class => @c1
2340
-
2341
- n = @c2.new(:id => 1234)
2342
- n.associations[:attributes] = 42
2343
- n.attributes(true).should_not == 42
2344
- DB.sqls.should == ["SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234)"]
2345
- end
2346
-
2347
- it "should add item to cache if it exists when calling add_" do
2348
- @c2.many_to_many :attributes, :class => @c1
2349
-
2350
- n = @c2.new(:id => 1234)
2351
- att = @c1.load(:id => 345)
2352
- a = []
2353
- n.associations[:attributes] = a
2354
- n.add_attribute(att)
2355
- a.should == [att]
2356
- end
2357
-
2358
- it "should add item to reciprocal's cache if it exists when calling add_" do
2359
- @c2.many_to_many :attributes, :class => @c1
2360
- @c1.many_to_many :nodes, :class => @c2
2361
-
2362
- n = @c2.new(:id => 1234)
2363
- att = @c1.load(:id => 345)
2364
- att.associations[:nodes] = []
2365
- n.add_attribute(att)
2366
- att.nodes.should == [n]
2367
- end
2368
-
2369
- it "should remove item from cache if it exists when calling remove_" do
2370
- @c2.many_to_many :attributes, :class => @c1
2371
-
2372
- n = @c2.new(:id => 1234)
2373
- att = @c1.load(:id => 345)
2374
- a = [att]
2375
- n.associations[:attributes] = a
2376
- n.remove_attribute(att)
2377
- a.should == []
2378
- end
2379
-
2380
- it "should remove item from reciprocal's if it exists when calling remove_" do
2381
- @c2.many_to_many :attributes, :class => @c1
2382
- @c1.many_to_many :nodes, :class => @c2
2383
-
2384
- n = @c2.new(:id => 1234)
2385
- att = @c1.new(:id => 345)
2386
- att.associations[:nodes] = [n]
2387
- n.remove_attribute(att)
2388
- att.nodes.should == []
2389
- end
2390
-
2391
- it "should not create the add_, remove_, or remove_all_ methods if :read_only option is used" do
2392
- @c2.many_to_many :attributes, :class => @c1, :read_only=>true
2393
- im = @c2.instance_methods.collect{|x| x.to_s}
2394
- im.should(include('attributes'))
2395
- im.should(include('attributes_dataset'))
2396
- im.should_not(include('add_attribute'))
2397
- im.should_not(include('remove_attribute'))
2398
- im.should_not(include('remove_all_attributes'))
2399
- end
2400
-
2401
- it "should not add associations methods directly to class" do
2402
- @c2.many_to_many :attributes, :class => @c1
2403
- im = @c2.instance_methods.collect{|x| x.to_s}
2404
- im.should(include('attributes'))
2405
- im.should(include('attributes_dataset'))
2406
- im.should(include('add_attribute'))
2407
- im.should(include('remove_attribute'))
2408
- im.should(include('remove_all_attributes'))
2409
- im2 = @c2.instance_methods(false).collect{|x| x.to_s}
2410
- im2.should_not(include('attributes'))
2411
- im2.should_not(include('attributes_dataset'))
2412
- im2.should_not(include('add_attribute'))
2413
- im2.should_not(include('remove_attribute'))
2414
- im2.should_not(include('remove_all_attributes'))
2415
- end
2416
-
2417
- it "should have an remove_all_ method that removes all associations" do
2418
- @c2.many_to_many :attributes, :class => @c1
2419
- @c2.new(:id => 1234).remove_all_attributes
2420
- DB.sqls.should == ['DELETE FROM attributes_nodes WHERE (node_id = 1234)']
2421
- end
2422
-
2423
- it "should have the remove_all_ method respect the :left_primary_key option" do
2424
- @c2.many_to_many :attributes, :class => @c1, :left_primary_key=>:xxx
2425
- @c2.new(:id => 1234, :xxx=>5).remove_all_attributes
2426
- DB.sqls.should == ['DELETE FROM attributes_nodes WHERE (node_id = 5)']
2427
- end
2428
-
2429
- it "should have the remove_all_ method respect composite keys" do
2430
- @c2.many_to_many :attributes, :class => @c1, :left_primary_key=>[:id, :x], :left_key=>[:l1, :l2]
2431
- @c2.load(:id => 1234, :x=>5).remove_all_attributes
2432
- DB.sqls.should == ['DELETE FROM attributes_nodes WHERE ((l1 = 1234) AND (l2 = 5))']
2433
- end
2434
-
2435
- it "remove_all should set the cached instance variable to []" do
2436
- @c2.many_to_many :attributes, :class => @c1
2437
- node = @c2.new(:id => 1234)
2438
- node.remove_all_attributes
2439
- node.associations[:attributes].should == []
2440
- end
2441
-
2442
- it "remove_all should return the array of previously associated items if the cached instance variable exists" do
2443
- @c2.many_to_many :attributes, :class => @c1
2444
- attrib = @c1.load(:id=>3)
2445
- node = @c2.load(:id => 1234)
2446
- @c1.dataset._fetch = []
2447
- node.attributes.should == []
2448
- node.add_attribute(attrib)
2449
- node.associations[:attributes].should == [attrib]
2450
- node.remove_all_attributes.should == [attrib]
2451
- end
2452
-
2453
- it "remove_all should return nil if the cached instance variable does not exist" do
2454
- @c2.many_to_many :attributes, :class => @c1
2455
- @c2.new(:id => 1234).remove_all_attributes.should == nil
2456
- end
2457
-
2458
- it "remove_all should remove the current item from all reciprocal instance varaibles if it cached instance variable exists" do
2459
- @c2.many_to_many :attributes, :class => @c1
2460
- @c1.many_to_many :nodes, :class => @c2
2461
- @c1.dataset._fetch = []
2462
- @c2.dataset._fetch = []
2463
- attrib = @c1.load(:id=>3)
2464
- node = @c2.new(:id => 1234)
2465
- node.attributes.should == []
2466
- attrib.nodes.should == []
2467
- node.add_attribute(attrib)
2468
- attrib.associations[:nodes].should == [node]
2469
- node.remove_all_attributes
2470
- attrib.associations[:nodes].should == []
2471
- end
2472
-
2473
- it "add, remove, and remove_all methods should respect :join_table_block option" do
2474
- @c2.many_to_many :attributes, :class => @c1, :join_table_block=>proc{|ds| ds.filter(:x=>123)}
2475
- o = @c2.load(:id => 1234)
2476
- o.add_attribute(@c1.load(:id=>44))
2477
- o.remove_attribute(@c1.load(:id=>45))
2478
- o.remove_all_attributes
2479
- sqls = DB.sqls
2480
- sqls.shift =~ /INSERT INTO attributes_nodes \((node_id|attribute_id), (node_id|attribute_id)\) VALUES \((1234|44), (1234|44)\)/
2481
- sqls.should == ["DELETE FROM attributes_nodes WHERE ((x = 123) AND (node_id = 1234) AND (attribute_id = 45))",
2482
- "DELETE FROM attributes_nodes WHERE ((x = 123) AND (node_id = 1234))"]
2483
- end
2484
-
2485
- it "should call an _add_ method internally to add attributes" do
2486
- @c2.many_to_many :attributes, :class => @c1
2487
- @c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_add_attribute"))
2488
- p = @c2.load(:id=>10)
2489
- c = @c1.load(:id=>123)
2490
- def p._add_attribute(x)
2491
- @x = x
2492
- end
2493
- p.add_attribute(c)
2494
- p.instance_variable_get(:@x).should == c
2495
- DB.sqls.should == []
2496
- end
2497
-
2498
- it "should support an :adder option for defining the _add_ method" do
2499
- @c2.many_to_many :attributes, :class => @c1, :adder=>proc{|x| @x = x}
2500
- p = @c2.load(:id=>10)
2501
- c = @c1.load(:id=>123)
2502
- p.add_attribute(c)
2503
- p.instance_variable_get(:@x).should == c
2504
- DB.sqls.should == []
2505
- end
2506
-
2507
- it "should allow additional arguments given to the add_ method and pass them onwards to the _add_ method" do
2508
- @c2.many_to_many :attributes, :class => @c1
2509
- p = @c2.load(:id=>10)
2510
- c = @c1.load(:id=>123)
2511
- def p._add_attribute(x,*y)
2512
- @x = x
2513
- @y = y
2514
- end
2515
- p.add_attribute(c,:foo,:bar=>:baz)
2516
- p.instance_variable_get(:@x).should == c
2517
- p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
2518
- end
2519
-
2520
- it "should call a _remove_ method internally to remove attributes" do
2521
- @c2.many_to_many :attributes, :class => @c1
2522
- @c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_remove_attribute"))
2523
- p = @c2.load(:id=>10)
2524
- c = @c1.load(:id=>123)
2525
- def p._remove_attribute(x)
2526
- @x = x
2527
- end
2528
- p.remove_attribute(c)
2529
- p.instance_variable_get(:@x).should == c
2530
- DB.sqls.should == []
2531
- end
2532
-
2533
- it "should support a :remover option for defining the _remove_ method" do
2534
- @c2.many_to_many :attributes, :class => @c1, :remover=>proc{|x| @x = x}
2535
- p = @c2.load(:id=>10)
2536
- c = @c1.load(:id=>123)
2537
- p.remove_attribute(c)
2538
- p.instance_variable_get(:@x).should == c
2539
- DB.sqls.should == []
2540
- end
2541
-
2542
- it "should allow additional arguments given to the remove_ method and pass them onwards to the _remove_ method" do
2543
- @c2.many_to_many :attributes, :class => @c1
2544
- p = @c2.load(:id=>10)
2545
- c = @c1.load(:id=>123)
2546
- def p._remove_attribute(x,*y)
2547
- @x = x
2548
- @y = y
2549
- end
2550
- p.remove_attribute(c,:foo,:bar=>:baz)
2551
- p.instance_variable_get(:@x).should == c
2552
- p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
2553
- end
2554
-
2555
- it "should allow additional arguments given to the remove_all_ method and pass them onwards to the _remove_all_ method" do
2556
- @c2.many_to_many :attributes, :class => @c1
2557
- p = @c2.load(:id=>10)
2558
- def p._remove_all_attributes(*y)
2559
- @y = y
2560
- end
2561
- p.remove_all_attributes(:foo,:bar=>:baz)
2562
- p.instance_variable_get(:@y).should == [:foo,{:bar=>:baz}]
2563
- end
2564
-
2565
- it "should call a _remove_all_ method internally to remove attributes" do
2566
- @c2.many_to_many :attributes, :class => @c1
2567
- @c2.private_instance_methods.collect{|x| x.to_s}.sort.should(include("_remove_all_attributes"))
2568
- p = @c2.load(:id=>10)
2569
- def p._remove_all_attributes
2570
- @x = :foo
2571
- end
2572
- p.remove_all_attributes
2573
- p.instance_variable_get(:@x).should == :foo
2574
- DB.sqls.should == []
2575
- end
2576
-
2577
- it "should support a :clearer option for defining the _remove_all_ method" do
2578
- @c2.many_to_many :attributes, :class => @c1, :clearer=>proc{@x = :foo}
2579
- p = @c2.load(:id=>10)
2580
- p.remove_all_attributes
2581
- p.instance_variable_get(:@x).should == :foo
2582
- DB.sqls.should == []
2583
- end
2584
-
2585
- it "should support (before|after)_(add|remove) callbacks" do
2586
- h = []
2587
- @c2.many_to_many :attributes, :class => @c1, :before_add=>[proc{|x,y| h << x.pk; h << -y.pk}, :blah], :after_add=>proc{h << 3}, :before_remove=>:blah, :after_remove=>[:blahr]
2588
- @c2.class_eval do
2589
- self::Foo = h
2590
- def _add_attribute(v)
2591
- model::Foo << 4
2592
- end
2593
- def _remove_attribute(v)
2594
- model::Foo << 5
2595
- end
2596
- def blah(x)
2597
- model::Foo << x.pk
2598
- end
2599
- def blahr(x)
2600
- model::Foo << 6
2601
- end
2602
- end
2603
- p = @c2.load(:id=>10)
2604
- c = @c1.load(:id=>123)
2605
- h.should == []
2606
- p.add_attribute(c)
2607
- h.should == [10, -123, 123, 4, 3]
2608
- p.remove_attribute(c)
2609
- h.should == [10, -123, 123, 4, 3, 123, 5, 6]
2610
- end
2611
-
2612
- it "should support after_load association callback" do
2613
- h = []
2614
- @c2.many_to_many :attributes, :class => @c1, :after_load=>[proc{|x,y| h << [x.pk, y.collect{|z|z.pk}]}, :al]
2615
- @c2.class_eval do
2616
- self::Foo = h
2617
- def al(v)
2618
- v.each{|x| model::Foo << x.pk}
2619
- end
2620
- end
2621
- @c1.dataset._fetch = [{:id=>20}, {:id=>30}]
2622
- p = @c2.load(:id=>10, :parent_id=>20)
2623
- attributes = p.attributes
2624
- h.should == [[10, [20, 30]], 20, 30]
2625
- attributes.collect{|a| a.pk}.should == [20, 30]
2626
- end
2627
-
2628
- it "should raise error and not call internal add or remove method if before callback returns false if raise_on_save_failure is true" do
2629
- p = @c2.load(:id=>10)
2630
- c = @c1.load(:id=>123)
2631
- @c2.many_to_many :attributes, :class => @c1, :before_add=>:ba, :before_remove=>:br
2632
- p.should_receive(:ba).once.with(c).and_return(false)
2633
- p.should_not_receive(:_add_attribute)
2634
- p.should_not_receive(:_remove_attribute)
2635
- p.associations[:attributes] = []
2636
- p.raise_on_save_failure = true
2637
- proc{p.add_attribute(c)}.should raise_error(Sequel::Error)
2638
- p.attributes.should == []
2639
- p.associations[:attributes] = [c]
2640
- p.should_receive(:br).once.with(c).and_return(false)
2641
- proc{p.remove_attribute(c)}.should raise_error(Sequel::Error)
2642
- p.attributes.should == [c]
2643
- end
2644
-
2645
- it "should return nil and not call internal add or remove method if before callback returns false if raise_on_save_failure is false" do
2646
- p = @c2.load(:id=>10)
2647
- c = @c1.load(:id=>123)
2648
- p.raise_on_save_failure = false
2649
- @c2.many_to_many :attributes, :class => @c1, :before_add=>:ba, :before_remove=>:br
2650
- p.should_receive(:ba).once.with(c).and_return(false)
2651
- p.should_not_receive(:_add_attribute)
2652
- p.should_not_receive(:_remove_attribute)
2653
- p.associations[:attributes] = []
2654
- p.add_attribute(c).should == nil
2655
- p.attributes.should == []
2656
- p.associations[:attributes] = [c]
2657
- p.should_receive(:br).once.with(c).and_return(false)
2658
- p.remove_attribute(c).should == nil
2659
- p.attributes.should == [c]
2660
- end
2661
-
2662
- it "should support a :uniq option that removes duplicates from the association" do
2663
- @c2.many_to_many :attributes, :class => @c1, :uniq=>true
2664
- @c1.dataset._fetch = [{:id=>20}, {:id=>30}, {:id=>20}, {:id=>30}]
2665
- @c2.load(:id=>10, :parent_id=>20).attributes.should == [@c1.load(:id=>20), @c1.load(:id=>30)]
2666
- end
2667
-
2668
- it "should support a :distinct option that uses the DISTINCT clause" do
2669
- @c2.many_to_many :attributes, :class => @c1, :distinct=>true
2670
- @c2.load(:id=>10).attributes_dataset.sql.should == "SELECT DISTINCT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 10)"
2671
- end
2672
-
2673
- it "should not apply association options when removing all associated records" do
2674
- @c2.many_to_many :attributes, :class => @c1 do |ds|
2675
- ds.filter(:name=>'John')
2676
- end
2677
- @c2.load(:id=>1).remove_all_attributes
2678
- DB.sqls.should == ["DELETE FROM attributes_nodes WHERE (node_id = 1)"]
2679
- end
2680
-
2681
- it "should use assocation's dataset when grabbing a record to remove from the assocation by primary key" do
2682
- @c2.many_to_many :attributes, :class => @c1 do |ds|
2683
- ds.filter(:join_table_att=>3)
2684
- end
2685
- @c1.dataset._fetch = {:id=>2}
2686
- @c2.load(:id=>1).remove_attribute(2)
2687
- DB.sqls.should == ["SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((attributes_nodes.node_id = 1) AND (join_table_att = 3) AND (attributes.id = 2)) LIMIT 1",
2688
- "DELETE FROM attributes_nodes WHERE ((node_id = 1) AND (attribute_id = 2))"]
2689
- end
2690
- end
2691
-
2692
- describe Sequel::Model, "one_through_one" do
2693
- before do
2694
- @c1 = Class.new(Sequel::Model(:attributes)) do
2695
- unrestrict_primary_key
2696
- attr_accessor :yyy
2697
- def self.name; 'Attribute'; end
2698
- def self.to_s; 'Attribute'; end
2699
- columns :id, :y, :z
2700
- end
2701
-
2702
- @c2 = Class.new(Sequel::Model(:nodes)) do
2703
- unrestrict_primary_key
2704
- attr_accessor :xxx
2705
-
2706
- def self.name; 'Node'; end
2707
- def self.to_s; 'Node'; end
2708
- columns :id, :x
2709
- end
2710
- @dataset = @c2.dataset
2711
- @c1.dataset.autoid = 1
2712
-
2713
- [@c1, @c2].each{|c| c.dataset._fetch = {}}
2714
- DB.reset
2715
- end
2716
-
2717
- it "should use implicit key values and join table if omitted" do
2718
- @c2.one_through_one :attribute, :class => @c1
2719
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 1'
2720
- end
2721
-
2722
- it "should respect :eager_loader_predicate_key when lazily loading" do
2723
- @c2.one_through_one :attribute, :class => @c1, :eager_loading_predicate_key=>Sequel.subscript(:attributes_nodes__node_id, 0)
2724
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id[0] = 1234) LIMIT 1'
2725
- end
2726
-
2727
- it "should use explicit key values and join table if given" do
2728
- @c2.one_through_one :attribute, :class => @c1, :left_key => :nodeid, :right_key => :attributeid, :join_table => :attribute2node
2729
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attribute2node ON (attribute2node.attributeid = attributes.id) WHERE (attribute2node.nodeid = 1234) LIMIT 1'
2730
- end
2731
-
2732
- it "should support a conditions option" do
2733
- @c2.one_through_one :attribute, :class => @c1, :conditions => {:a=>32}
2734
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((a = 32) AND (attributes_nodes.node_id = 1234)) LIMIT 1'
2735
-
2736
- @c2.one_through_one :attribute, :class => @c1, :conditions => ['a = ?', 32]
2737
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((a = 32) AND (attributes_nodes.node_id = 1234)) LIMIT 1'
2738
- @c2.new(:id => 1234).attribute.should == @c1.load({})
2739
- end
2740
-
2741
- it "should support an order option" do
2742
- @c2.one_through_one :attribute, :class => @c1, :order => :blah
2743
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) ORDER BY blah LIMIT 1'
2744
- end
2745
-
2746
- it "should support an array for the order option" do
2747
- @c2.one_through_one :attribute, :class => @c1, :order => [:blah1, :blah2]
2748
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) ORDER BY blah1, blah2 LIMIT 1'
2749
- end
2750
-
2751
- it "should support :left_primary_key and :right_primary_key options" do
2752
- @c2.one_through_one :attribute, :class => @c1, :left_primary_key=>:xxx, :right_primary_key=>:yyy
2753
- @c2.new(:id => 1234, :xxx=>5).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.yyy) WHERE (attributes_nodes.node_id = 5) LIMIT 1'
2754
- end
2755
-
2756
- it "should support composite keys" do
2757
- @c2.one_through_one :attribute, :class => @c1, :left_key=>[:l1, :l2], :right_key=>[:r1, :r2], :left_primary_key=>[:id, :x], :right_primary_key=>[:id, :y]
2758
- @c2.load(:id => 1234, :x=>5).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON ((attributes_nodes.r1 = attributes.id) AND (attributes_nodes.r2 = attributes.y)) WHERE ((attributes_nodes.l1 = 1234) AND (attributes_nodes.l2 = 5)) LIMIT 1'
2759
- end
2760
-
2761
- it "should not issue query if not all keys have values" do
2762
- @c2.one_through_one :attribute, :class => @c1, :left_key=>[:l1, :l2], :right_key=>[:r1, :r2], :left_primary_key=>[:id, :x], :right_primary_key=>[:id, :y]
2763
- @c2.load(:id => 1234, :x=>nil).attribute.should == nil
2764
- DB.sqls.should == []
2765
- end
2766
-
2767
- it "should raise an Error unless same number of composite keys used" do
2768
- proc{@c2.one_through_one :attribute, :class => @c1, :left_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2769
- proc{@c2.one_through_one :attribute, :class => @c1, :left_primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2770
- proc{@c2.one_through_one :attribute, :class => @c1, :left_key=>[:node_id, :id], :left_primary_key=>:id}.should raise_error(Sequel::Error)
2771
- proc{@c2.one_through_one :attribute, :class => @c1, :left_key=>:id, :left_primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2772
- proc{@c2.one_through_one :attribute, :class => @c1, :left_key=>[:node_id, :id, :x], :left_primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
2773
-
2774
- proc{@c2.one_through_one :attribute, :class => @c1, :right_primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2775
- proc{@c2.one_through_one :attribute, :class => @c1, :right_key=>[:node_id, :id], :right_primary_key=>:id}.should raise_error(Sequel::Error)
2776
- proc{@c2.one_through_one :attribute, :class => @c1, :right_key=>:id, :left_primary_key=>[:node_id, :id]}.should raise_error(Sequel::Error)
2777
- proc{@c2.one_through_one :attribute, :class => @c1, :right_key=>[:node_id, :id, :x], :right_primary_key=>[:parent_id, :id]}.should raise_error(Sequel::Error)
2778
- end
2779
-
2780
- it "should support a select option" do
2781
- @c2.one_through_one :attribute, :class => @c1, :select => :blah
2782
-
2783
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT blah FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 1'
2784
- end
2785
-
2786
- it "should support an array for the select option" do
2787
- @c2.one_through_one :attribute, :class => @c1, :select => [Sequel::SQL::ColumnAll.new(:attributes), :attribute_nodes__blah2]
2788
-
2789
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.*, attribute_nodes.blah2 FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 1'
2790
- end
2791
-
2792
- it "should accept a block" do
2793
- @c2.one_through_one :attribute, :class => @c1 do |ds|
2794
- ds.filter(:xxx => @xxx)
2795
- end
2796
-
2797
- n = @c2.new(:id => 1234)
2798
- n.xxx = 555
2799
- n.attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((attributes_nodes.node_id = 1234) AND (xxx = 555)) LIMIT 1'
2800
- end
2801
-
2802
- it "should allow the :order option while accepting a block" do
2803
- @c2.one_through_one :attribute, :class => @c1, :order=>[:blah1, :blah2] do |ds|
2804
- ds.filter(:xxx => @xxx)
2805
- end
2806
-
2807
- n = @c2.new(:id => 1234)
2808
- n.xxx = 555
2809
- n.attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE ((attributes_nodes.node_id = 1234) AND (xxx = 555)) ORDER BY blah1, blah2 LIMIT 1'
2810
- end
2811
-
2812
- it "should support a :dataset option that is used instead of the default" do
2813
- c1 = @c1
2814
- @c2.one_through_one :attribute, :class => @c1, :dataset=>proc{c1.join_table(:natural, :an).filter(:an__nodeid=>pk)}, :order=> :a, :select=>nil do |ds|
2815
- ds.filter(:xxx => @xxx)
2816
- end
2817
-
2818
- n = @c2.new(:id => 1234)
2819
- n.xxx = 555
2820
- n.attribute_dataset.sql.should == 'SELECT * FROM attributes NATURAL JOIN an WHERE ((an.nodeid = 1234) AND (xxx = 555)) ORDER BY a LIMIT 1'
2821
- n.attribute.should == @c1.load({})
2822
- DB.sqls.should == ['SELECT * FROM attributes NATURAL JOIN an WHERE ((an.nodeid = 1234) AND (xxx = 555)) ORDER BY a LIMIT 1']
2823
- end
2824
-
2825
- it "should support a :dataset option that accepts the reflection as an argument" do
2826
- @c2.one_through_one :attribute, :class => @c1, :dataset=>lambda{|opts| opts.associated_class.natural_join(:an).filter(:an__nodeid=>pk)}, :order=> :a, :select=>nil do |ds|
2827
- ds.filter(:xxx => @xxx)
2828
- end
2829
-
2830
- n = @c2.new(:id => 1234)
2831
- n.xxx = 555
2832
- n.attribute_dataset.sql.should == 'SELECT * FROM attributes NATURAL JOIN an WHERE ((an.nodeid = 1234) AND (xxx = 555)) ORDER BY a LIMIT 1'
2833
- n.attribute.should == @c1.load({})
2834
- DB.sqls.should == ['SELECT * FROM attributes NATURAL JOIN an WHERE ((an.nodeid = 1234) AND (xxx = 555)) ORDER BY a LIMIT 1']
2835
- end
2836
-
2837
- it "should support a :limit option to specify an offset" do
2838
- @c2.one_through_one :attribute, :class => @c1 , :limit=>[nil, 10]
2839
- @c2.new(:id => 1234).attribute_dataset.sql.should == 'SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 1 OFFSET 10'
2840
- end
2841
-
2842
- it "should have the :eager option affect the _dataset method" do
2843
- @c2.one_through_one :attribute, :class => @c2 , :eager=>:attribute
2844
- @c2.new(:id => 1234).attribute_dataset.opts[:eager].should == {:attribute=>nil}
2845
- end
2846
-
2847
- it "should handle an aliased join table" do
2848
- @c2.one_through_one :attribute, :class => @c1, :join_table => :attribute2node___attributes_nodes
2849
- n = @c2.load(:id => 1234)
2850
- n.attribute_dataset.sql.should == "SELECT attributes.* FROM attributes INNER JOIN attribute2node AS attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 1"
2851
- end
2852
-
2853
- it "should raise an error if the model object doesn't have a valid primary key" do
2854
- @c2.one_through_one :attribute, :class => @c1
2855
- a = @c2.new
2856
- proc{a.attribute_dataset}.should raise_error(Sequel::Error)
2857
- end
2858
-
2859
- it "should provide an array with all members of the association" do
2860
- @c2.one_through_one :attribute, :class => @c1
2861
-
2862
- @c2.new(:id => 1234).attribute.should == @c1.load({})
2863
- DB.sqls.should == ['SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 1']
2864
- end
2865
-
2866
- it "should populate cache when accessed" do
2867
- @c2.one_through_one :attribute, :class => @c1
2868
-
2869
- n = @c2.new(:id => 1234)
2870
- n.associations.include?(:attribute).should == false
2871
- atts = n.attribute
2872
- atts.should == n.associations[:attribute]
2873
- end
2874
-
2875
- it "should use cache if available" do
2876
- @c2.one_through_one :attribute, :class => @c1
2877
-
2878
- n = @c2.new(:id => 1234)
2879
- n.associations[:attribute] = 42
2880
- n.attribute.should == 42
2881
- DB.sqls.should == []
2882
- end
2883
-
2884
- it "should not use cache if asked to reload" do
2885
- @c2.one_through_one :attribute, :class => @c1
2886
-
2887
- n = @c2.new(:id => 1234)
2888
- n.associations[:attribute] = 42
2889
- n.attribute(true).should_not == 42
2890
- DB.sqls.should == ["SELECT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 1234) LIMIT 1"]
2891
- end
2892
-
2893
- it "should not add associations methods directly to class" do
2894
- @c2.one_through_one :attribute, :class => @c1
2895
- im = @c2.instance_methods.collect{|x| x.to_s}
2896
- im.should(include('attribute'))
2897
- im.should(include('attribute_dataset'))
2898
- im2 = @c2.instance_methods(false).collect{|x| x.to_s}
2899
- im2.should_not(include('attribute'))
2900
- im2.should_not(include('attribute_dataset'))
2901
- end
2902
-
2903
- it "should support after_load association callback" do
2904
- h = []
2905
- @c2.one_through_one :attribute, :class => @c1, :after_load=>[proc{|x,y| h << [x.pk, y.pk]}, :al]
2906
- @c2.class_eval do
2907
- self::Foo = h
2908
- def al(v)
2909
- model::Foo << v.pk
2910
- end
2911
- end
2912
- @c1.dataset._fetch = [{:id=>20}]
2913
- p = @c2.load(:id=>10, :parent_id=>20)
2914
- attribute = p.attribute
2915
- h.should == [[10, 20], 20]
2916
- attribute.pk.should == 20
2917
- end
2918
-
2919
- it "should support a :distinct option that uses the DISTINCT clause" do
2920
- @c2.one_through_one :attribute, :class => @c1, :distinct=>true
2921
- @c2.load(:id=>10).attribute_dataset.sql.should == "SELECT DISTINCT attributes.* FROM attributes INNER JOIN attributes_nodes ON (attributes_nodes.attribute_id = attributes.id) WHERE (attributes_nodes.node_id = 10) LIMIT 1"
2922
- end
2923
- end
2924
-
2925
- describe "Filtering by associations" do
2926
- before(:all) do
2927
- db = Sequel.mock
2928
- db.extend_datasets do
2929
- def supports_window_functions?; true; end
2930
- def supports_distinct_on?; true; end
2931
- end
2932
- @Album = Class.new(Sequel::Model(db[:albums]))
2933
- artist = @Artist = Class.new(Sequel::Model(db[:artists]))
2934
- tag = @Tag = Class.new(Sequel::Model(db[:tags]))
2935
- track = @Track = Class.new(Sequel::Model(db[:tracks]))
2936
- album_info = @AlbumInfo = Class.new(Sequel::Model(db[:album_infos]))
2937
- @Artist.columns :id, :id1, :id2
2938
- @Tag.columns :id, :tid1, :tid2
2939
- @Track.columns :id, :album_id, :album_id1, :album_id2
2940
- @AlbumInfo.columns :id, :album_id, :album_id1, :album_id2
2941
- @Album.class_eval do
2942
- columns :id, :id1, :id2, :artist_id, :artist_id1, :artist_id2
2943
- b = lambda{|ds| ds.where(:name=>'B')}
2944
- c = {:name=>'A'}
2945
-
2946
- many_to_one :artist, :class=>artist, :key=>:artist_id
2947
- one_to_many :tracks, :class=>track, :key=>:album_id
2948
- one_to_one :track, :class=>track, :key=>:album_id
2949
- one_to_one :album_info, :class=>album_info, :key=>:album_id
2950
- many_to_many :tags, :class=>tag, :left_key=>:album_id, :join_table=>:albums_tags, :right_key=>:tag_id
2951
-
2952
- many_to_one :a_artist, :clone=>:artist, :conditions=>c
2953
- one_to_many :a_tracks, :clone=>:tracks, :conditions=>c
2954
- one_to_one :a_album_info, :clone=>:album_info, :conditions=>c
2955
- many_to_many :a_tags, :clone=>:tags, :conditions=>c
2956
-
2957
- many_to_one :b_artist, :clone=>:artist, &b
2958
- one_to_many :b_tracks, :clone=>:tracks, &b
2959
- one_to_one :b_album_info, :clone=>:album_info, &b
2960
- many_to_many :b_tags, :clone=>:tags, &b
2961
-
2962
- one_to_many :l_tracks, :clone=>:tracks, :limit=>10
2963
- one_to_one :l_track, :clone=>:tracks, :order=>:name
2964
- many_to_many :l_tags, :clone=>:tags, :limit=>10
2965
- one_through_one :l_tag, :clone=>:tags, :order=>:name
2966
-
2967
- one_to_many :al_tracks, :clone=>:l_tracks, :conditions=>c
2968
- one_to_one :al_track, :clone=>:l_track, :conditions=>c
2969
- many_to_many :al_tags, :clone=>:l_tags, :conditions=>c
2970
- one_through_one :al_tag, :clone=>:l_tag, :conditions=>c
2971
-
2972
- many_to_one :cartist, :class=>artist, :key=>[:artist_id1, :artist_id2], :primary_key=>[:id1, :id2]
2973
- one_to_many :ctracks, :class=>track, :key=>[:album_id1, :album_id2], :primary_key=>[:id1, :id2]
2974
- one_to_one :calbum_info, :class=>album_info, :key=>[:album_id1, :album_id2], :primary_key=>[:id1, :id2]
2975
- many_to_many :ctags, :class=>tag, :left_key=>[:album_id1, :album_id2], :left_primary_key=>[:id1, :id2], :right_key=>[:tag_id1, :tag_id2], :right_primary_key=>[:tid1, :tid2], :join_table=>:albums_tags
2976
-
2977
- many_to_one :a_cartist, :clone=>:cartist, :conditions=>c
2978
- one_to_many :a_ctracks, :clone=>:ctracks, :conditions=>c
2979
- one_to_one :a_calbum_info, :clone=>:calbum_info, :conditions=>c
2980
- many_to_many :a_ctags, :clone=>:ctags, :conditions=>c
2981
-
2982
- many_to_one :b_cartist, :clone=>:cartist, &b
2983
- one_to_many :b_ctracks, :clone=>:ctracks, &b
2984
- one_to_one :b_calbum_info, :clone=>:calbum_info, &b
2985
- many_to_many :b_ctags, :clone=>:ctags, &b
2986
-
2987
- one_to_many :l_ctracks, :clone=>:ctracks, :limit=>10
2988
- one_to_one :l_ctrack, :clone=>:ctracks, :order=>:name
2989
- many_to_many :l_ctags, :clone=>:ctags, :limit=>10
2990
- one_through_one :l_ctag, :clone=>:ctags, :order=>:name
2991
-
2992
- one_to_many :al_ctracks, :clone=>:l_ctracks, :conditions=>c
2993
- one_to_one :al_ctrack, :clone=>:l_ctrack, :conditions=>c
2994
- many_to_many :al_ctags, :clone=>:l_ctags, :conditions=>c
2995
- one_through_one :al_ctag, :clone=>:l_ctag, :conditions=>c
2996
- end
2997
- end
2998
- after do
2999
- @Album.default_eager_limit_strategy = true
3000
- end
3001
-
3002
- it "should be able to filter on many_to_one associations" do
3003
- @Album.filter(:artist=>@Artist.load(:id=>3)).sql.should == 'SELECT * FROM albums WHERE (albums.artist_id = 3)'
3004
- end
3005
-
3006
- it "should be able to filter on one_to_many associations" do
3007
- @Album.filter(:tracks=>@Track.load(:album_id=>3)).sql.should == 'SELECT * FROM albums WHERE (albums.id = 3)'
3008
- end
3009
-
3010
- it "should be able to filter on one_to_one associations" do
3011
- @Album.filter(:album_info=>@AlbumInfo.load(:album_id=>3)).sql.should == 'SELECT * FROM albums WHERE (albums.id = 3)'
3012
- end
3013
-
3014
- it "should be able to filter on many_to_many associations" do
3015
- @Album.filter(:tags=>@Tag.load(:id=>3)).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM albums_tags WHERE ((albums_tags.tag_id = 3) AND (albums_tags.album_id IS NOT NULL))))'
3016
- end
3017
-
3018
- it "should be able to filter on many_to_one associations with :conditions" do
3019
- @Album.filter(:a_artist=>@Artist.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.artist_id IN (SELECT artists.id FROM artists WHERE ((name = 'A') AND (artists.id IS NOT NULL) AND (artists.id = 3))))"
3020
- end
3021
-
3022
- it "should be able to filter on one_to_many associations with :conditions" do
3023
- @Album.filter(:a_tracks=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'A') AND (tracks.album_id IS NOT NULL) AND (tracks.id = 5))))"
3024
- end
3025
-
3026
- it "should be able to filter on one_to_one associations with :conditions" do
3027
- @Album.filter(:a_album_info=>@AlbumInfo.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id = 5))))"
3028
- end
3029
-
3030
- it "should be able to filter on many_to_many associations with :conditions" do
3031
- @Album.filter(:a_tags=>@Tag.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'A') AND (albums_tags.album_id IS NOT NULL) AND (tags.id = 3))))"
3032
- end
3033
-
3034
- it "should be able to filter on many_to_one associations with block" do
3035
- @Album.filter(:b_artist=>@Artist.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.artist_id IN (SELECT artists.id FROM artists WHERE ((name = 'B') AND (artists.id IS NOT NULL) AND (artists.id = 3))))"
3036
- end
3037
-
3038
- it "should be able to filter on one_to_many associations with block" do
3039
- @Album.filter(:b_tracks=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'B') AND (tracks.album_id IS NOT NULL) AND (tracks.id = 5))))"
3040
- end
3041
-
3042
- it "should be able to filter on one_to_one associations with block" do
3043
- @Album.filter(:b_album_info=>@AlbumInfo.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id = 5))))"
3044
- end
3045
-
3046
- it "should be able to filter on many_to_many associations with block" do
3047
- @Album.filter(:b_tags=>@Tag.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'B') AND (albums_tags.album_id IS NOT NULL) AND (tags.id = 3))))"
3048
- end
3049
-
3050
- it "should be able to filter on one_to_many associations with :limit" do
3051
- @Album.filter(:l_tracks=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT id FROM (SELECT tracks.id, row_number() OVER (PARTITION BY tracks.album_id) AS x_sequel_row_number_x FROM tracks) AS t1 WHERE (x_sequel_row_number_x <= 10))) AND (tracks.id = 5))))"
3052
- end
3053
-
3054
- it "should be able to filter on one_to_one associations with :order" do
3055
- @Album.filter(:l_track=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT DISTINCT ON (tracks.album_id) tracks.id FROM tracks ORDER BY tracks.album_id, name)) AND (tracks.id = 5))))"
3056
- end
3057
-
3058
- it "should be able to filter on one_to_one associations with :filter_limit_strategy" do
3059
- @Album.one_to_one :l_track2, :clone=>:track, :filter_limit_strategy=>:window_function
3060
- @Album.filter(:l_track2=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT id FROM (SELECT tracks.id, row_number() OVER (PARTITION BY tracks.album_id) AS x_sequel_row_number_x FROM tracks) AS t1 WHERE (x_sequel_row_number_x = 1))) AND (tracks.id = 5))))"
3061
- end
3062
-
3063
- it "should be able to filter on one_to_one associations with :eager_limit_strategy" do
3064
- @Album.one_to_one :l_track2, :clone=>:track, :eager_limit_strategy=>:window_function
3065
- @Album.filter(:l_track2=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT id FROM (SELECT tracks.id, row_number() OVER (PARTITION BY tracks.album_id) AS x_sequel_row_number_x FROM tracks) AS t1 WHERE (x_sequel_row_number_x = 1))) AND (tracks.id = 5))))"
3066
- end
3067
-
3068
- it "should be able to filter on one_to_one associations with :order and :filter_limit_strategy" do
3069
- @Album.one_to_one :l_track2, :clone=>:l_track, :filter_limit_strategy=>:window_function
3070
- @Album.filter(:l_track2=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT id FROM (SELECT tracks.id, row_number() OVER (PARTITION BY tracks.album_id ORDER BY name) AS x_sequel_row_number_x FROM tracks) AS t1 WHERE (x_sequel_row_number_x = 1))) AND (tracks.id = 5))))"
3071
- end
3072
-
3073
- it "should be able to filter on one_to_one associations with :order and :eager_limit_strategy" do
3074
- @Album.one_to_one :l_track2, :clone=>:l_track, :eager_limit_strategy=>:window_function
3075
- @Album.filter(:l_track2=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT id FROM (SELECT tracks.id, row_number() OVER (PARTITION BY tracks.album_id ORDER BY name) AS x_sequel_row_number_x FROM tracks) AS t1 WHERE (x_sequel_row_number_x = 1))) AND (tracks.id = 5))))"
3076
- end
3077
-
3078
- it "should be able to filter on one_to_one associations with :order and Model.default_eager_limit_strategy" do
3079
- @Album.default_eager_limit_strategy = :window_function
3080
- @Album.one_to_one :l_track2, :clone=>:l_track
3081
- @Album.filter(:l_track2=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT id FROM (SELECT tracks.id, row_number() OVER (PARTITION BY tracks.album_id ORDER BY name) AS x_sequel_row_number_x FROM tracks) AS t1 WHERE (x_sequel_row_number_x = 1))) AND (tracks.id = 5))))"
3082
- end
3083
-
3084
- it "should be able to filter on one_to_one associations with :order and :eager_limit_strategy=>:union" do
3085
- @Album.one_to_one :l_track2, :clone=>:l_track, :eager_limit_strategy=>:union
3086
- @Album.filter(:l_track2=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT DISTINCT ON (tracks.album_id) tracks.id FROM tracks ORDER BY tracks.album_id, name)) AND (tracks.id = 5))))"
3087
- end
3088
-
3089
- it "should be able to filter on one_to_one associations with :order and :eager_limit_strategy=>:ruby" do
3090
- @Album.one_to_one :l_track2, :clone=>:l_track, :eager_limit_strategy=>:ruby
3091
- @Album.filter(:l_track2=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT DISTINCT ON (tracks.album_id) tracks.id FROM tracks ORDER BY tracks.album_id, name)) AND (tracks.id = 5))))"
3092
- end
3093
-
3094
- it "should be able to filter on one_to_one associations with :filter_limit_strategy :correlated_subquery" do
3095
- @Album.one_to_one :l_track2, :clone=>:track, :filter_limit_strategy=>:correlated_subquery
3096
- @Album.filter(:l_track2=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT t1.id FROM tracks AS t1 WHERE (t1.album_id = tracks.album_id) LIMIT 1)) AND (tracks.id = 5))))"
3097
- end
3098
-
3099
- it "should be able to filter on many_to_many associations with :limit" do
3100
- @Album.filter(:l_tags=>@Tag.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((albums_tags.album_id IS NOT NULL) AND ((albums_tags.album_id, tags.id) IN (SELECT b, c FROM (SELECT albums_tags.album_id AS b, tags.id AS c, row_number() OVER (PARTITION BY albums_tags.album_id) AS x_sequel_row_number_x FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id)) AS t1 WHERE (x_sequel_row_number_x <= 10))) AND (tags.id = 3))))"
3101
- end
3102
-
3103
- it "should be able to filter on one_through_one associations with :order" do
3104
- @Album.filter(:l_tag=>@Tag.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((albums_tags.album_id IS NOT NULL) AND ((albums_tags.album_id, tags.id) IN (SELECT DISTINCT ON (albums_tags.album_id) albums_tags.album_id, tags.id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) ORDER BY albums_tags.album_id, name)) AND (tags.id = 3))))"
3105
- end
3106
-
3107
- it "should be able to filter on one_to_many associations with :limit and :conditions" do
3108
- @Album.filter(:al_tracks=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'A') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT id FROM (SELECT tracks.id, row_number() OVER (PARTITION BY tracks.album_id) AS x_sequel_row_number_x FROM tracks WHERE (name = 'A')) AS t1 WHERE (x_sequel_row_number_x <= 10))) AND (tracks.id = 5))))"
3109
- end
3110
-
3111
- it "should be able to filter on one_to_one associations with :order and :conditions" do
3112
- @Album.filter(:al_track=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'A') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT DISTINCT ON (tracks.album_id) tracks.id FROM tracks WHERE (name = 'A') ORDER BY tracks.album_id, name)) AND (tracks.id = 5))))"
3113
- end
3114
-
3115
- it "should be able to filter on many_to_many associations with :limit and :conditions" do
3116
- @Album.filter(:al_tags=>@Tag.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'A') AND (albums_tags.album_id IS NOT NULL) AND ((albums_tags.album_id, tags.id) IN (SELECT b, c FROM (SELECT albums_tags.album_id AS b, tags.id AS c, row_number() OVER (PARTITION BY albums_tags.album_id) AS x_sequel_row_number_x FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE (name = 'A')) AS t1 WHERE (x_sequel_row_number_x <= 10))) AND (tags.id = 3))))"
3117
- end
3118
-
3119
- it "should be able to filter on one_through_one associations with :order and :conditions" do
3120
- @Album.filter(:al_tag=>@Tag.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'A') AND (albums_tags.album_id IS NOT NULL) AND ((albums_tags.album_id, tags.id) IN (SELECT DISTINCT ON (albums_tags.album_id) albums_tags.album_id, tags.id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE (name = 'A') ORDER BY albums_tags.album_id, name)) AND (tags.id = 3))))"
3121
- end
3122
-
3123
- it "should be able to filter on many_to_one associations with composite keys" do
3124
- @Album.filter(:cartist=>@Artist.load(:id1=>3, :id2=>4)).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id1 = 3) AND (albums.artist_id2 = 4))'
3125
- end
3126
-
3127
- it "should be able to filter on one_to_many associations with composite keys" do
3128
- @Album.filter(:ctracks=>@Track.load(:album_id1=>3, :album_id2=>4)).sql.should == 'SELECT * FROM albums WHERE ((albums.id1 = 3) AND (albums.id2 = 4))'
3129
- end
3130
-
3131
- it "should be able to filter on one_to_one associations with composite keys" do
3132
- @Album.filter(:calbum_info=>@AlbumInfo.load(:album_id1=>3, :album_id2=>4)).sql.should == 'SELECT * FROM albums WHERE ((albums.id1 = 3) AND (albums.id2 = 4))'
3133
- end
3134
-
3135
- it "should be able to filter on many_to_many associations with composite keys" do
3136
- @Album.filter(:ctags=>@Tag.load(:tid1=>3, :tid2=>4)).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE ((albums_tags.tag_id1 = 3) AND (albums_tags.tag_id2 = 4) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL))))'
3137
- end
3138
-
3139
- it "should be able to filter on many_to_one associations with :conditions and composite keys" do
3140
- @Album.filter(:a_cartist=>@Artist.load(:id=>5, :id1=>3, :id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'A') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id = 5))))"
3141
- end
3142
-
3143
- it "should be able to filter on one_to_many associations with :conditions and composite keys" do
3144
- @Album.filter(:a_ctracks=>@Track.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'A') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id = 5))))"
3145
- end
3146
-
3147
- it "should be able to filter on one_to_one associations with :conditions and composite keys" do
3148
- @Album.filter(:a_calbum_info=>@AlbumInfo.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id = 5))))"
3149
- end
3150
-
3151
- it "should be able to filter on many_to_many associations with block and composite keys" do
3152
- @Album.filter(:a_ctags=>@Tag.load(:id=>5, :tid1=>3, :tid2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'A') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id = 5))))"
3153
- end
3154
-
3155
- it "should be able to filter on many_to_one associations with block and composite keys" do
3156
- @Album.filter(:b_cartist=>@Artist.load(:id=>5, :id1=>3, :id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'B') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id = 5))))"
3157
- end
3158
-
3159
- it "should be able to filter on one_to_many associations with block and composite keys" do
3160
- @Album.filter(:b_ctracks=>@Track.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'B') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id = 5))))"
3161
- end
3162
-
3163
- it "should be able to filter on one_to_one associations with block and composite keys" do
3164
- @Album.filter(:b_calbum_info=>@AlbumInfo.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id = 5))))"
3165
- end
3166
-
3167
- it "should be able to filter on many_to_many associations with block and composite keys" do
3168
- @Album.filter(:b_ctags=>@Tag.load(:id=>5, :tid1=>3, :tid2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'B') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id = 5))))"
3169
- end
3170
-
3171
- it "should be able to filter on one_to_many associations with :limit and composite keys" do
3172
- @Album.filter(:l_ctracks=>@Track.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (SELECT id FROM (SELECT tracks.id, row_number() OVER (PARTITION BY tracks.album_id1, tracks.album_id2) AS x_sequel_row_number_x FROM tracks) AS t1 WHERE (x_sequel_row_number_x <= 10))) AND (tracks.id = 5))))"
3173
- end
3174
-
3175
- it "should be able to filter on one_to_many associations with composite keys and :filter_limit_strategy :correlated_subquery" do
3176
- @Album.one_to_one :l_ctracks2, :clone=>:l_ctracks, :filter_limit_strategy=>:correlated_subquery
3177
- @Album.filter(:l_ctracks2=>@Track.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (SELECT t1.id FROM tracks AS t1 WHERE ((t1.album_id1 = tracks.album_id1) AND (t1.album_id2 = tracks.album_id2)) LIMIT 1)) AND (tracks.id = 5))))"
3178
- end
3179
-
3180
- it "should be able to filter on one_to_one associations with :order and composite keys" do
3181
- @Album.filter(:l_ctrack=>@Track.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (SELECT DISTINCT ON (tracks.album_id1, tracks.album_id2) tracks.id FROM tracks ORDER BY tracks.album_id1, tracks.album_id2, name)) AND (tracks.id = 5))))"
3182
- end
3183
-
3184
- it "should be able to filter on many_to_many associations with :limit and composite keys" do
3185
- @Album.filter(:l_ctags=>@Tag.load(:id=>5, :tid1=>3, :tid2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND ((albums_tags.album_id1, albums_tags.album_id2, tags.id) IN (SELECT b, c, d FROM (SELECT albums_tags.album_id1 AS b, albums_tags.album_id2 AS c, tags.id AS d, row_number() OVER (PARTITION BY albums_tags.album_id1, albums_tags.album_id2) AS x_sequel_row_number_x FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2))) AS t1 WHERE (x_sequel_row_number_x <= 10))) AND (tags.id = 5))))"
3186
- end
3187
-
3188
- it "should be able to filter on one_through_one associations with :order and composite keys" do
3189
- @Album.filter(:l_ctag=>@Tag.load(:id=>5, :tid1=>3, :tid2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND ((albums_tags.album_id1, albums_tags.album_id2, tags.id) IN (SELECT DISTINCT ON (albums_tags.album_id1, albums_tags.album_id2) albums_tags.album_id1, albums_tags.album_id2, tags.id FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) ORDER BY albums_tags.album_id1, albums_tags.album_id2, name)) AND (tags.id = 5))))"
3190
- end
3191
-
3192
- it "should be able to filter on one_to_many associations with :limit and :conditions and composite keys" do
3193
- @Album.filter(:al_ctracks=>@Track.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'A') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (SELECT id FROM (SELECT tracks.id, row_number() OVER (PARTITION BY tracks.album_id1, tracks.album_id2) AS x_sequel_row_number_x FROM tracks WHERE (name = 'A')) AS t1 WHERE (x_sequel_row_number_x <= 10))) AND (tracks.id = 5))))"
3194
- end
3195
-
3196
- it "should be able to filter on one_to_one associations with :order and :conditions and composite keys" do
3197
- @Album.filter(:al_ctrack=>@Track.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'A') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (SELECT DISTINCT ON (tracks.album_id1, tracks.album_id2) tracks.id FROM tracks WHERE (name = 'A') ORDER BY tracks.album_id1, tracks.album_id2, name)) AND (tracks.id = 5))))"
3198
- end
3199
-
3200
- it "should be able to filter on many_to_many associations with :limit and :conditions and composite keys" do
3201
- @Album.filter(:al_ctags=>@Tag.load(:id=>5, :tid1=>3, :tid2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'A') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND ((albums_tags.album_id1, albums_tags.album_id2, tags.id) IN (SELECT b, c, d FROM (SELECT albums_tags.album_id1 AS b, albums_tags.album_id2 AS c, tags.id AS d, row_number() OVER (PARTITION BY albums_tags.album_id1, albums_tags.album_id2) AS x_sequel_row_number_x FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE (name = 'A')) AS t1 WHERE (x_sequel_row_number_x <= 10))) AND (tags.id = 5))))"
3202
- end
3203
-
3204
- it "should be able to filter on one_through_one associations with :order and :conditions and composite keys" do
3205
- @Album.filter(:al_ctag=>@Tag.load(:id=>5, :tid1=>3, :tid2=>4)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'A') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND ((albums_tags.album_id1, albums_tags.album_id2, tags.id) IN (SELECT DISTINCT ON (albums_tags.album_id1, albums_tags.album_id2) albums_tags.album_id1, albums_tags.album_id2, tags.id FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE (name = 'A') ORDER BY albums_tags.album_id1, albums_tags.album_id2, name)) AND (tags.id = 5))))"
3206
- end
3207
-
3208
- it "should work inside a complex filter" do
3209
- artist = @Artist.load(:id=>3)
3210
- @Album.filter{foo & {:artist=>artist}}.sql.should == 'SELECT * FROM albums WHERE (foo AND (albums.artist_id = 3))'
3211
- track = @Track.load(:album_id=>4)
3212
- @Album.filter{foo & [[:artist, artist], [:tracks, track]]}.sql.should == 'SELECT * FROM albums WHERE (foo AND (albums.artist_id = 3) AND (albums.id = 4))'
3213
- end
3214
-
3215
- it "should raise for an invalid association name" do
3216
- proc{@Album.filter(:foo=>@Artist.load(:id=>3)).sql}.should raise_error(Sequel::Error)
3217
- end
3218
-
3219
- it "should raise for an invalid association type" do
3220
- @Album.many_to_many :iatags, :clone=>:tags
3221
- @Album.association_reflection(:iatags)[:type] = :foo
3222
- proc{@Album.filter(:iatags=>@Tag.load(:id=>3)).sql}.should raise_error(Sequel::Error)
3223
- end
3224
-
3225
- it "should raise for an invalid associated object class " do
3226
- proc{@Album.filter(:tags=>@Artist.load(:id=>3)).sql}.should raise_error(Sequel::Error)
3227
- end
3228
-
3229
- it "should raise for an invalid associated object class when multiple objects are used" do
3230
- proc{@Album.filter(:tags=>[@Tag.load(:id=>3), @Artist.load(:id=>3)]).sql}.should raise_error(Sequel::Error)
3231
- end
3232
-
3233
- it "should correctly handle case when a multiple value association is used" do
3234
- proc{@Album.filter(:tags=>[@Tag.load(:id=>3), @Artist.load(:id=>3)]).sql}.should raise_error(Sequel::Error)
3235
- end
3236
-
3237
- it "should not affect non-association IN/NOT IN filtering with an empty array" do
3238
- @Album.filter(:tag_id=>[]).sql.should == 'SELECT * FROM albums WHERE (tag_id != tag_id)'
3239
- @Album.exclude(:tag_id=>[]).sql.should == 'SELECT * FROM albums WHERE (tag_id = tag_id)'
3240
- end
3241
-
3242
- it "should work correctly in subclasses" do
3243
- c = Class.new(@Album)
3244
- c.many_to_one :sartist, :class=>@Artist
3245
- c.filter(:sartist=>@Artist.load(:id=>3)).sql.should == 'SELECT * FROM albums WHERE (albums.sartist_id = 3)'
3246
- end
3247
-
3248
- it "should be able to exclude on many_to_one associations" do
3249
- @Album.exclude(:artist=>@Artist.load(:id=>3)).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id != 3) OR (albums.artist_id IS NULL))'
3250
- end
3251
-
3252
- it "should be able to exclude on one_to_many associations" do
3253
- @Album.exclude(:tracks=>@Track.load(:album_id=>3)).sql.should == 'SELECT * FROM albums WHERE ((albums.id != 3) OR (albums.id IS NULL))'
3254
- end
3255
-
3256
- it "should be able to exclude on one_to_one associations" do
3257
- @Album.exclude(:album_info=>@AlbumInfo.load(:album_id=>3)).sql.should == 'SELECT * FROM albums WHERE ((albums.id != 3) OR (albums.id IS NULL))'
3258
- end
3259
-
3260
- it "should be able to exclude on many_to_many associations" do
3261
- @Album.exclude(:tags=>@Tag.load(:id=>3)).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM albums_tags WHERE ((albums_tags.tag_id = 3) AND (albums_tags.album_id IS NOT NULL)))) OR (albums.id IS NULL))'
3262
- end
3263
-
3264
- it "should be able to exclude on many_to_one associations with :conditions" do
3265
- @Album.exclude(:a_artist=>@Artist.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id NOT IN (SELECT artists.id FROM artists WHERE ((name = 'A') AND (artists.id IS NOT NULL) AND (artists.id = 3)))) OR (albums.artist_id IS NULL))"
3266
- end
3267
-
3268
- it "should be able to exclude on one_to_many associations with :conditions" do
3269
- @Album.exclude(:a_tracks=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'A') AND (tracks.album_id IS NOT NULL) AND (tracks.id = 5)))) OR (albums.id IS NULL))"
3270
- end
3271
-
3272
- it "should be able to exclude on one_to_one associations with :conditions" do
3273
- @Album.exclude(:a_album_info=>@AlbumInfo.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id = 5)))) OR (albums.id IS NULL))"
3274
- end
3275
-
3276
- it "should be able to exclude on many_to_many associations with :conditions" do
3277
- @Album.exclude(:a_tags=>@Tag.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'A') AND (albums_tags.album_id IS NOT NULL) AND (tags.id = 3)))) OR (albums.id IS NULL))"
3278
- end
3279
-
3280
- it "should be able to exclude on many_to_one associations with block" do
3281
- @Album.exclude(:b_artist=>@Artist.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id NOT IN (SELECT artists.id FROM artists WHERE ((name = 'B') AND (artists.id IS NOT NULL) AND (artists.id = 3)))) OR (albums.artist_id IS NULL))"
3282
- end
3283
-
3284
- it "should be able to exclude on one_to_many associations with block" do
3285
- @Album.exclude(:b_tracks=>@Track.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'B') AND (tracks.album_id IS NOT NULL) AND (tracks.id = 5)))) OR (albums.id IS NULL))"
3286
- end
3287
-
3288
- it "should be able to exclude on one_to_one associations with block" do
3289
- @Album.exclude(:b_album_info=>@AlbumInfo.load(:id=>5, :album_id=>3)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id = 5)))) OR (albums.id IS NULL))"
3290
- end
3291
-
3292
- it "should be able to exclude on many_to_many associations with block" do
3293
- @Album.exclude(:b_tags=>@Tag.load(:id=>3)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'B') AND (albums_tags.album_id IS NOT NULL) AND (tags.id = 3)))) OR (albums.id IS NULL))"
3294
- end
3295
-
3296
- it "should be able to exclude on many_to_one associations with composite keys" do
3297
- @Album.exclude(:cartist=>@Artist.load(:id1=>3, :id2=>4)).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id1 != 3) OR (albums.artist_id2 != 4) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))'
3298
- end
3299
-
3300
- it "should be able to exclude on one_to_many associations with composite keys" do
3301
- @Album.exclude(:ctracks=>@Track.load(:album_id1=>3, :album_id2=>4)).sql.should == 'SELECT * FROM albums WHERE ((albums.id1 != 3) OR (albums.id2 != 4) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3302
- end
3303
-
3304
- it "should be able to exclude on one_to_one associations with composite keys" do
3305
- @Album.exclude(:calbum_info=>@AlbumInfo.load(:album_id1=>3, :album_id2=>4)).sql.should == 'SELECT * FROM albums WHERE ((albums.id1 != 3) OR (albums.id2 != 4) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3306
- end
3307
-
3308
- it "should be able to exclude on many_to_many associations with composite keys" do
3309
- @Album.exclude(:ctags=>@Tag.load(:tid1=>3, :tid2=>4)).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE ((albums_tags.tag_id1 = 3) AND (albums_tags.tag_id2 = 4) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3310
- end
3311
-
3312
- it "should be able to exclude on many_to_one associations with :conditions and composite keys" do
3313
- @Album.exclude(:a_cartist=>@Artist.load(:id=>5, :id1=>3, :id2=>4)).sql.should == "SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'A') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id = 5)))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))"
3314
- end
3315
-
3316
- it "should be able to exclude on one_to_many associations with :conditions and composite keys" do
3317
- @Album.exclude(:a_ctracks=>@Track.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'A') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id = 5)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3318
- end
3319
-
3320
- it "should be able to exclude on one_to_one associations with :conditions and composite keys" do
3321
- @Album.exclude(:a_calbum_info=>@AlbumInfo.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id = 5)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3322
- end
3323
-
3324
- it "should be able to exclude on many_to_many associations with block and composite keys" do
3325
- @Album.exclude(:a_ctags=>@Tag.load(:id=>5, :tid1=>3, :tid2=>4)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'A') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id = 5)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3326
- end
3327
-
3328
- it "should be able to exclude on many_to_one associations with block and composite keys" do
3329
- @Album.exclude(:b_cartist=>@Artist.load(:id=>5, :id1=>3, :id2=>4)).sql.should == "SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'B') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id = 5)))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))"
3330
- end
3331
-
3332
- it "should be able to exclude on one_to_many associations with block and composite keys" do
3333
- @Album.exclude(:b_ctracks=>@Track.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'B') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id = 5)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3334
- end
3335
-
3336
- it "should be able to exclude on one_to_one associations with block and composite keys" do
3337
- @Album.exclude(:b_calbum_info=>@AlbumInfo.load(:id=>5, :album_id1=>3, :album_id2=>4)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id = 5)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3338
- end
3339
-
3340
- it "should be able to exclude on many_to_many associations with block and composite keys" do
3341
- @Album.exclude(:b_ctags=>@Tag.load(:id=>5, :tid1=>3, :tid2=>4)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'B') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id = 5)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3342
- end
3343
-
3344
- it "should be able to filter on multiple many_to_one associations" do
3345
- @Album.filter(:artist=>[@Artist.load(:id=>3), @Artist.load(:id=>4)]).sql.should == 'SELECT * FROM albums WHERE (albums.artist_id IN (3, 4))'
3346
- end
3347
-
3348
- it "should be able to filter on multiple one_to_many associations" do
3349
- @Album.filter(:tracks=>[@Track.load(:album_id=>3), @Track.load(:album_id=>4)]).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (3, 4))'
3350
- end
3351
-
3352
- it "should be able to filter on multiple one_to_one associations" do
3353
- @Album.filter(:album_info=>[@AlbumInfo.load(:album_id=>3), @AlbumInfo.load(:album_id=>4)]).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (3, 4))'
3354
- end
3355
-
3356
- it "should be able to filter on multiple many_to_many associations" do
3357
- @Album.filter(:tags=>[@Tag.load(:id=>3), @Tag.load(:id=>4)]).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM albums_tags WHERE ((albums_tags.tag_id IN (3, 4)) AND (albums_tags.album_id IS NOT NULL))))'
3358
- end
3359
-
3360
- it "should be able to filter on multiple many_to_one associations with :conditions" do
3361
- @Album.filter(:a_artist=>[@Artist.load(:id=>3), @Artist.load(:id=>4)]).sql.should == "SELECT * FROM albums WHERE (albums.artist_id IN (SELECT artists.id FROM artists WHERE ((name = 'A') AND (artists.id IS NOT NULL) AND (artists.id IN (3, 4)))))"
3362
- end
3363
-
3364
- it "should be able to filter on multiple one_to_many associations with :conditions" do
3365
- @Album.filter(:a_tracks=>[@Track.load(:id=>5, :album_id=>3), @Track.load(:id=>6, :album_id=>4)]).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'A') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (5, 6)))))"
3366
- end
3367
-
3368
- it "should be able to filter on multiple one_to_one associations with :conditions" do
3369
- @Album.filter(:a_album_info=>[@AlbumInfo.load(:id=>5, :album_id=>3), @AlbumInfo.load(:id=>6, :album_id=>4)]).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id IN (5, 6)))))"
3370
- end
3371
-
3372
- it "should be able to filter on multiple many_to_many associations with :conditions" do
3373
- @Album.filter(:a_tags=>[@Tag.load(:id=>3), @Tag.load(:id=>4)]).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'A') AND (albums_tags.album_id IS NOT NULL) AND (tags.id IN (3, 4)))))"
3374
- end
3375
-
3376
- it "should be able to filter on multiple many_to_one associations with block" do
3377
- @Album.filter(:b_artist=>[@Artist.load(:id=>3), @Artist.load(:id=>4)]).sql.should == "SELECT * FROM albums WHERE (albums.artist_id IN (SELECT artists.id FROM artists WHERE ((name = 'B') AND (artists.id IS NOT NULL) AND (artists.id IN (3, 4)))))"
3378
- end
3379
-
3380
- it "should be able to filter on multiple one_to_many associations with block" do
3381
- @Album.filter(:b_tracks=>[@Track.load(:id=>5, :album_id=>3), @Track.load(:id=>6, :album_id=>4)]).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'B') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (5, 6)))))"
3382
- end
3383
-
3384
- it "should be able to filter on multiple one_to_one associations with block" do
3385
- @Album.filter(:b_album_info=>[@AlbumInfo.load(:id=>5, :album_id=>3), @AlbumInfo.load(:id=>6, :album_id=>4)]).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id IN (5, 6)))))"
3386
- end
3387
-
3388
- it "should be able to filter on multiple many_to_many associations with block" do
3389
- @Album.filter(:b_tags=>[@Tag.load(:id=>3), @Tag.load(:id=>4)]).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'B') AND (albums_tags.album_id IS NOT NULL) AND (tags.id IN (3, 4)))))"
3390
- end
3391
-
3392
- it "should be able to filter on multiple many_to_one associations with composite keys" do
3393
- @Album.filter(:cartist=>[@Artist.load(:id1=>3, :id2=>4), @Artist.load(:id1=>5, :id2=>6)]).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN ((3, 4), (5, 6)))'
3394
- end
3395
-
3396
- it "should be able to filter on multiple one_to_many associations with composite keys" do
3397
- @Album.filter(:ctracks=>[@Track.load(:album_id1=>3, :album_id2=>4), @Track.load(:album_id1=>5, :album_id2=>6)]).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN ((3, 4), (5, 6)))'
3398
- end
3399
-
3400
- it "should be able to filter on multiple one_to_one associations with composite keys" do
3401
- @Album.filter(:calbum_info=>[@AlbumInfo.load(:album_id1=>3, :album_id2=>4), @AlbumInfo.load(:album_id1=>5, :album_id2=>6)]).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN ((3, 4), (5, 6)))'
3402
- end
3403
-
3404
- it "should be able to filter on multiple many_to_many associations with composite keys" do
3405
- @Album.filter(:ctags=>[@Tag.load(:tid1=>3, :tid2=>4), @Tag.load(:tid1=>5, :tid2=>6)]).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE (((albums_tags.tag_id1, albums_tags.tag_id2) IN ((3, 4), (5, 6))) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL))))'
3406
- end
3407
-
3408
- it "should be able to filter on multiple many_to_one associations with :conditions and composite keys" do
3409
- @Album.filter(:a_cartist=>[@Artist.load(:id=>7, :id1=>3, :id2=>4), @Artist.load(:id=>8, :id1=>5, :id2=>6)]).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'A') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id IN (7, 8)))))"
3410
- end
3411
-
3412
- it "should be able to filter on multiple one_to_many associations with :conditions and composite keys" do
3413
- @Album.filter(:a_ctracks=>[@Track.load(:id=>7, :album_id1=>3, :album_id2=>4), @Track.load(:id=>8, :album_id1=>5, :album_id2=>6)]).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'A') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (7, 8)))))"
3414
- end
3415
-
3416
- it "should be able to filter on multiple one_to_one associations with :conditions and composite keys" do
3417
- @Album.filter(:a_calbum_info=>[@AlbumInfo.load(:id=>7, :album_id1=>3, :album_id2=>4), @AlbumInfo.load(:id=>8, :album_id1=>5, :album_id2=>6)]).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id IN (7, 8)))))"
3418
- end
3419
-
3420
- it "should be able to filter on multiple many_to_many associations with block and composite keys" do
3421
- @Album.filter(:a_ctags=>[@Tag.load(:id=>7, :tid1=>3, :tid2=>4), @Tag.load(:id=>8, :tid1=>5, :tid2=>6)]).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'A') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id IN (7, 8)))))"
3422
- end
3423
-
3424
- it "should be able to filter on multiple many_to_one associations with block and composite keys" do
3425
- @Album.filter(:b_cartist=>[@Artist.load(:id=>7, :id1=>3, :id2=>4), @Artist.load(:id=>8, :id1=>5, :id2=>6)]).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'B') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id IN (7, 8)))))"
3426
- end
3427
-
3428
- it "should be able to filter on multiple one_to_many associations with block and composite keys" do
3429
- @Album.filter(:b_ctracks=>[@Track.load(:id=>7, :album_id1=>3, :album_id2=>4), @Track.load(:id=>8, :album_id1=>5, :album_id2=>6)]).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'B') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (7, 8)))))"
3430
- end
3431
-
3432
- it "should be able to filter on multiple one_to_one associations with block and composite keys" do
3433
- @Album.filter(:b_calbum_info=>[@AlbumInfo.load(:id=>7, :album_id1=>3, :album_id2=>4), @AlbumInfo.load(:id=>8, :album_id1=>5, :album_id2=>6)]).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id IN (7, 8)))))"
3434
- end
3435
-
3436
- it "should be able to filter on multiple many_to_many associations with block and composite keys" do
3437
- @Album.filter(:b_ctags=>[@Tag.load(:id=>7, :tid1=>3, :tid2=>4), @Tag.load(:id=>8, :tid1=>5, :tid2=>6)]).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'B') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id IN (7, 8)))))"
3438
- end
3439
-
3440
- it "should be able to exclude on multiple many_to_one associations" do
3441
- @Album.exclude(:artist=>[@Artist.load(:id=>3), @Artist.load(:id=>4)]).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id NOT IN (3, 4)) OR (albums.artist_id IS NULL))'
3442
- end
3443
-
3444
- it "should be able to exclude on multiple one_to_many associations" do
3445
- @Album.exclude(:tracks=>[@Track.load(:album_id=>3), @Track.load(:album_id=>4)]).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (3, 4)) OR (albums.id IS NULL))'
3446
- end
3447
-
3448
- it "should be able to exclude on multiple one_to_one associations" do
3449
- @Album.exclude(:album_info=>[@AlbumInfo.load(:album_id=>3), @AlbumInfo.load(:album_id=>4)]).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (3, 4)) OR (albums.id IS NULL))'
3450
- end
3451
-
3452
- it "should be able to exclude on multiple many_to_many associations" do
3453
- @Album.exclude(:tags=>[@Tag.load(:id=>3), @Tag.load(:id=>4)]).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM albums_tags WHERE ((albums_tags.tag_id IN (3, 4)) AND (albums_tags.album_id IS NOT NULL)))) OR (albums.id IS NULL))'
3454
- end
3455
-
3456
- it "should be able to exclude on multiple many_to_one associations with :conditions" do
3457
- @Album.exclude(:a_artist=>[@Artist.load(:id=>3), @Artist.load(:id=>4)]).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id NOT IN (SELECT artists.id FROM artists WHERE ((name = 'A') AND (artists.id IS NOT NULL) AND (artists.id IN (3, 4))))) OR (albums.artist_id IS NULL))"
3458
- end
3459
-
3460
- it "should be able to exclude on multiple one_to_many associations with :conditions" do
3461
- @Album.exclude(:a_tracks=>[@Track.load(:id=>5, :album_id=>3), @Track.load(:id=>6, :album_id=>4)]).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'A') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (5, 6))))) OR (albums.id IS NULL))"
3462
- end
3463
-
3464
- it "should be able to exclude on multiple one_to_one associations with :conditions" do
3465
- @Album.exclude(:a_album_info=>[@AlbumInfo.load(:id=>5, :album_id=>3), @AlbumInfo.load(:id=>6, :album_id=>4)]).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id IN (5, 6))))) OR (albums.id IS NULL))"
3466
- end
3467
-
3468
- it "should be able to exclude on multiple many_to_many associations with :conditions" do
3469
- @Album.exclude(:a_tags=>[@Tag.load(:id=>3), @Tag.load(:id=>4)]).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'A') AND (albums_tags.album_id IS NOT NULL) AND (tags.id IN (3, 4))))) OR (albums.id IS NULL))"
3470
- end
3471
-
3472
- it "should be able to exclude on multiple many_to_one associations with block" do
3473
- @Album.exclude(:b_artist=>[@Artist.load(:id=>3), @Artist.load(:id=>4)]).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id NOT IN (SELECT artists.id FROM artists WHERE ((name = 'B') AND (artists.id IS NOT NULL) AND (artists.id IN (3, 4))))) OR (albums.artist_id IS NULL))"
3474
- end
3475
-
3476
- it "should be able to exclude on multiple one_to_many associations with block" do
3477
- @Album.exclude(:b_tracks=>[@Track.load(:id=>5, :album_id=>3), @Track.load(:id=>6, :album_id=>4)]).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'B') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (5, 6))))) OR (albums.id IS NULL))"
3478
- end
3479
-
3480
- it "should be able to exclude on multiple one_to_one associations with block" do
3481
- @Album.exclude(:b_album_info=>[@AlbumInfo.load(:id=>5, :album_id=>3), @AlbumInfo.load(:id=>6, :album_id=>4)]).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id IN (5, 6))))) OR (albums.id IS NULL))"
3482
- end
3483
-
3484
- it "should be able to exclude on multiple many_to_many associations with block" do
3485
- @Album.exclude(:b_tags=>[@Tag.load(:id=>3), @Tag.load(:id=>4)]).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'B') AND (albums_tags.album_id IS NOT NULL) AND (tags.id IN (3, 4))))) OR (albums.id IS NULL))"
3486
- end
3487
-
3488
- it "should be able to exclude on multiple many_to_one associations with composite keys" do
3489
- @Album.exclude(:cartist=>[@Artist.load(:id1=>3, :id2=>4), @Artist.load(:id1=>5, :id2=>6)]).sql.should == 'SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN ((3, 4), (5, 6))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))'
3490
- end
3491
-
3492
- it "should be able to exclude on multiple one_to_many associations with composite keys" do
3493
- @Album.exclude(:ctracks=>[@Track.load(:album_id1=>3, :album_id2=>4), @Track.load(:album_id1=>5, :album_id2=>6)]).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN ((3, 4), (5, 6))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3494
- end
3495
-
3496
- it "should be able to exclude on multiple one_to_one associations with composite keys" do
3497
- @Album.exclude(:calbum_info=>[@AlbumInfo.load(:album_id1=>3, :album_id2=>4), @AlbumInfo.load(:album_id1=>5, :album_id2=>6)]).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN ((3, 4), (5, 6))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3498
- end
3499
-
3500
- it "should be able to exclude on multiple many_to_many associations with composite keys" do
3501
- @Album.exclude(:ctags=>[@Tag.load(:tid1=>3, :tid2=>4), @Tag.load(:tid1=>5, :tid2=>6)]).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE (((albums_tags.tag_id1, albums_tags.tag_id2) IN ((3, 4), (5, 6))) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3502
- end
3503
-
3504
- it "should be able to exclude on multiple many_to_one associations with :conditions and composite keys" do
3505
- @Album.exclude(:a_cartist=>[@Artist.load(:id=>7, :id1=>3, :id2=>4), @Artist.load(:id=>8, :id1=>5, :id2=>6)]).sql.should == "SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'A') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id IN (7, 8))))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))"
3506
- end
3507
-
3508
- it "should be able to exclude on multiple one_to_many associations with :conditions and composite keys" do
3509
- @Album.exclude(:a_ctracks=>[@Track.load(:id=>7, :album_id1=>3, :album_id2=>4), @Track.load(:id=>8, :album_id1=>5, :album_id2=>6)]).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'A') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (7, 8))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3510
- end
3511
-
3512
- it "should be able to exclude on multiple one_to_one associations with :conditions and composite keys" do
3513
- @Album.exclude(:a_calbum_info=>[@AlbumInfo.load(:id=>7, :album_id1=>3, :album_id2=>4), @AlbumInfo.load(:id=>8, :album_id1=>5, :album_id2=>6)]).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id IN (7, 8))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3514
- end
3515
-
3516
- it "should be able to exclude on multiple many_to_many associations with :conditions and composite keys" do
3517
- @Album.exclude(:a_ctags=>[@Tag.load(:id=>7, :tid1=>3, :tid2=>4), @Tag.load(:id=>8, :tid1=>5, :tid2=>6)]).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'A') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id IN (7, 8))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3518
- end
3519
-
3520
- it "should be able to exclude on multiple many_to_one associations with block and composite keys" do
3521
- @Album.exclude(:b_cartist=>[@Artist.load(:id=>7, :id1=>3, :id2=>4), @Artist.load(:id=>8, :id1=>5, :id2=>6)]).sql.should == "SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'B') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id IN (7, 8))))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))"
3522
- end
3523
-
3524
- it "should be able to exclude on multiple one_to_many associations with block and composite keys" do
3525
- @Album.exclude(:b_ctracks=>[@Track.load(:id=>7, :album_id1=>3, :album_id2=>4), @Track.load(:id=>8, :album_id1=>5, :album_id2=>6)]).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'B') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (7, 8))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3526
- end
3527
-
3528
- it "should be able to exclude on multiple one_to_one associations with block and composite keys" do
3529
- @Album.exclude(:b_calbum_info=>[@AlbumInfo.load(:id=>7, :album_id1=>3, :album_id2=>4), @AlbumInfo.load(:id=>8, :album_id1=>5, :album_id2=>6)]).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id IN (7, 8))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3530
- end
3531
-
3532
- it "should be able to exclude on multiple many_to_many associations with block and composite keys" do
3533
- @Album.exclude(:b_ctags=>[@Tag.load(:id=>7, :tid1=>3, :tid2=>4), @Tag.load(:id=>8, :tid1=>5, :tid2=>6)]).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'B') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id IN (7, 8))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3534
- end
3535
-
3536
- it "should be able to handle NULL values when filtering many_to_one associations" do
3537
- @Album.filter(:artist=>@Artist.new).sql.should == 'SELECT * FROM albums WHERE \'f\''
3538
- end
3539
-
3540
- it "should be able to handle NULL values when filtering one_to_many associations" do
3541
- @Album.filter(:tracks=>@Track.new).sql.should == 'SELECT * FROM albums WHERE \'f\''
3542
- end
3543
-
3544
- it "should be able to handle NULL values when filtering one_to_one associations" do
3545
- @Album.filter(:album_info=>@AlbumInfo.new).sql.should == 'SELECT * FROM albums WHERE \'f\''
3546
- end
3547
-
3548
- it "should be able to handle NULL values when filtering many_to_many associations" do
3549
- @Album.filter(:tags=>@Tag.new).sql.should == 'SELECT * FROM albums WHERE \'f\''
3550
- end
3551
-
3552
- it "should be able to handle filtering with NULL values for many_to_one associations with composite keys" do
3553
- @Album.filter(:cartist=>@Artist.load(:id2=>4)).sql.should == 'SELECT * FROM albums WHERE \'f\''
3554
- @Album.filter(:cartist=>@Artist.load(:id1=>3)).sql.should == 'SELECT * FROM albums WHERE \'f\''
3555
- @Album.filter(:cartist=>@Artist.new).sql.should == 'SELECT * FROM albums WHERE \'f\''
3556
- end
3557
-
3558
- it "should be able to filter with NULL values for one_to_many associations with composite keys" do
3559
- @Album.filter(:ctracks=>@Track.load(:album_id2=>4)).sql.should == 'SELECT * FROM albums WHERE \'f\''
3560
- @Album.filter(:ctracks=>@Track.load(:album_id1=>3)).sql.should == 'SELECT * FROM albums WHERE \'f\''
3561
- @Album.filter(:ctracks=>@Track.new).sql.should == 'SELECT * FROM albums WHERE \'f\''
3562
- end
3563
-
3564
- it "should be able to filter with NULL values for one_to_one associations with composite keys" do
3565
- @Album.filter(:calbum_info=>@AlbumInfo.load(:album_id2=>4)).sql.should == 'SELECT * FROM albums WHERE \'f\''
3566
- @Album.filter(:calbum_info=>@AlbumInfo.load(:album_id1=>3)).sql.should == 'SELECT * FROM albums WHERE \'f\''
3567
- @Album.filter(:calbum_info=>@AlbumInfo.new).sql.should == 'SELECT * FROM albums WHERE \'f\''
3568
- end
3569
-
3570
- it "should be able to filter with NULL values for many_to_many associations with composite keys" do
3571
- @Album.filter(:ctags=>@Tag.load(:tid1=>3)).sql.should == 'SELECT * FROM albums WHERE \'f\''
3572
- @Album.filter(:ctags=>@Tag.load(:tid2=>4)).sql.should == 'SELECT * FROM albums WHERE \'f\''
3573
- @Album.filter(:ctags=>@Tag.new).sql.should == 'SELECT * FROM albums WHERE \'f\''
3574
- end
3575
-
3576
- it "should be able to handle NULL values when excluding many_to_one associations" do
3577
- @Album.exclude(:artist=>@Artist.new).sql.should == 'SELECT * FROM albums WHERE \'t\''
3578
- end
3579
-
3580
- it "should be able to handle NULL values when excluding one_to_many associations" do
3581
- @Album.exclude(:tracks=>@Track.new).sql.should == 'SELECT * FROM albums WHERE \'t\''
3582
- end
3583
-
3584
- it "should be able to handle NULL values when excluding one_to_one associations" do
3585
- @Album.exclude(:album_info=>@AlbumInfo.new).sql.should == 'SELECT * FROM albums WHERE \'t\''
3586
- end
3587
-
3588
- it "should be able to handle NULL values when excluding many_to_many associations" do
3589
- @Album.exclude(:tags=>@Tag.new).sql.should == 'SELECT * FROM albums WHERE \'t\''
3590
- end
3591
-
3592
- it "should be able to handle excluding with NULL values for many_to_one associations with composite keys" do
3593
- @Album.exclude(:cartist=>@Artist.load(:id2=>4)).sql.should == 'SELECT * FROM albums WHERE \'t\''
3594
- @Album.exclude(:cartist=>@Artist.load(:id1=>3)).sql.should == 'SELECT * FROM albums WHERE \'t\''
3595
- @Album.exclude(:cartist=>@Artist.new).sql.should == 'SELECT * FROM albums WHERE \'t\''
3596
- end
3597
-
3598
- it "should be able to excluding with NULL values for one_to_many associations with composite keys" do
3599
- @Album.exclude(:ctracks=>@Track.load(:album_id2=>4)).sql.should == 'SELECT * FROM albums WHERE \'t\''
3600
- @Album.exclude(:ctracks=>@Track.load(:album_id1=>3)).sql.should == 'SELECT * FROM albums WHERE \'t\''
3601
- @Album.exclude(:ctracks=>@Track.new).sql.should == 'SELECT * FROM albums WHERE \'t\''
3602
- end
3603
-
3604
- it "should be able to excluding with NULL values for one_to_one associations with composite keys" do
3605
- @Album.exclude(:calbum_info=>@AlbumInfo.load(:album_id2=>4)).sql.should == 'SELECT * FROM albums WHERE \'t\''
3606
- @Album.exclude(:calbum_info=>@AlbumInfo.load(:album_id1=>3)).sql.should == 'SELECT * FROM albums WHERE \'t\''
3607
- @Album.exclude(:calbum_info=>@AlbumInfo.new).sql.should == 'SELECT * FROM albums WHERE \'t\''
3608
- end
3609
-
3610
- it "should be able to excluding with NULL values for many_to_many associations with composite keys" do
3611
- @Album.exclude(:ctags=>@Tag.load(:tid1=>3)).sql.should == 'SELECT * FROM albums WHERE \'t\''
3612
- @Album.exclude(:ctags=>@Tag.load(:tid2=>4)).sql.should == 'SELECT * FROM albums WHERE \'t\''
3613
- @Album.exclude(:ctags=>@Tag.new).sql.should == 'SELECT * FROM albums WHERE \'t\''
3614
- end
3615
-
3616
- it "should be able to handle NULL values when filtering multiple many_to_one associations" do
3617
- @Album.filter(:artist=>[@Artist.load(:id=>3), @Artist.new]).sql.should == 'SELECT * FROM albums WHERE (albums.artist_id IN (3))'
3618
- @Album.filter(:artist=>[@Artist.new, @Artist.new]).sql.should == 'SELECT * FROM albums WHERE \'f\''
3619
- end
3620
-
3621
- it "should be able to handle NULL values when filtering multiple one_to_many associations" do
3622
- @Album.filter(:tracks=>[@Track.load(:album_id=>3), @Track.new]).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (3))'
3623
- @Album.filter(:tracks=>[@Track.new, @Track.new]).sql.should == 'SELECT * FROM albums WHERE \'f\''
3624
- end
3625
-
3626
- it "should be able to handle NULL values when filtering multiple one_to_one associations" do
3627
- @Album.filter(:album_info=>[@AlbumInfo.load(:album_id=>3), @AlbumInfo.new]).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (3))'
3628
- @Album.filter(:album_info=>[@AlbumInfo.new, @AlbumInfo.new]).sql.should == 'SELECT * FROM albums WHERE \'f\''
3629
- end
3630
-
3631
- it "should be able to handle NULL values when filtering multiple many_to_many associations" do
3632
- @Album.filter(:tags=>[@Tag.load(:id=>3), @Tag.new]).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM albums_tags WHERE ((albums_tags.tag_id IN (3)) AND (albums_tags.album_id IS NOT NULL))))'
3633
- @Album.filter(:tags=>[@Tag.new, @Tag.new]).sql.should == 'SELECT * FROM albums WHERE \'f\''
3634
- end
3635
-
3636
- it "should be able to handle NULL values when filtering multiple many_to_one associations with composite keys" do
3637
- @Album.filter(:cartist=>[@Artist.load(:id1=>3, :id2=>4), @Artist.load(:id1=>3)]).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN ((3, 4)))'
3638
- @Album.filter(:cartist=>[@Artist.load(:id1=>3, :id2=>4), @Artist.new]).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN ((3, 4)))'
3639
- end
3640
-
3641
- it "should be able handle NULL values when filtering multiple one_to_many associations with composite keys" do
3642
- @Album.filter(:ctracks=>[@Track.load(:album_id1=>3, :album_id2=>4), @Track.load(:album_id1=>3)]).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN ((3, 4)))'
3643
- @Album.filter(:ctracks=>[@Track.load(:album_id1=>3, :album_id2=>4), @Track.new]).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN ((3, 4)))'
3644
- end
3645
-
3646
- it "should be able to handle NULL values when filtering multiple one_to_one associations with composite keys" do
3647
- @Album.filter(:calbum_info=>[@AlbumInfo.load(:album_id1=>3, :album_id2=>4), @AlbumInfo.load(:album_id1=>5)]).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN ((3, 4)))'
3648
- @Album.filter(:calbum_info=>[@AlbumInfo.load(:album_id1=>3, :album_id2=>4), @AlbumInfo.new]).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN ((3, 4)))'
3649
- end
3650
-
3651
- it "should be able to handle NULL values when filtering multiple many_to_many associations with composite keys" do
3652
- @Album.filter(:ctags=>[@Tag.load(:tid1=>3, :tid2=>4), @Tag.load(:tid1=>5)]).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE (((albums_tags.tag_id1, albums_tags.tag_id2) IN ((3, 4))) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL))))'
3653
- @Album.filter(:ctags=>[@Tag.load(:tid1=>3, :tid2=>4), @Tag.new]).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE (((albums_tags.tag_id1, albums_tags.tag_id2) IN ((3, 4))) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL))))'
3654
- end
3655
-
3656
- it "should be able to handle NULL values when excluding multiple many_to_one associations" do
3657
- @Album.exclude(:artist=>[@Artist.load(:id=>3), @Artist.new]).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id NOT IN (3)) OR (albums.artist_id IS NULL))'
3658
- @Album.exclude(:artist=>[@Artist.new, @Artist.new]).sql.should == 'SELECT * FROM albums WHERE \'t\''
3659
- end
3660
-
3661
- it "should be able to handle NULL values when excluding multiple one_to_many associations" do
3662
- @Album.exclude(:tracks=>[@Track.load(:album_id=>3), @Track.new]).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (3)) OR (albums.id IS NULL))'
3663
- @Album.exclude(:tracks=>[@Track.new, @Track.new]).sql.should == 'SELECT * FROM albums WHERE \'t\''
3664
- end
3665
-
3666
- it "should be able to handle NULL values when excluding multiple one_to_one associations" do
3667
- @Album.exclude(:album_info=>[@AlbumInfo.load(:album_id=>3), @AlbumInfo.new]).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (3)) OR (albums.id IS NULL))'
3668
- @Album.exclude(:album_info=>[@AlbumInfo.new, @AlbumInfo.new]).sql.should == 'SELECT * FROM albums WHERE \'t\''
3669
- end
3670
-
3671
- it "should be able to handle NULL values when excluding multiple many_to_many associations" do
3672
- @Album.exclude(:tags=>[@Tag.load(:id=>3), @Tag.new]).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM albums_tags WHERE ((albums_tags.tag_id IN (3)) AND (albums_tags.album_id IS NOT NULL)))) OR (albums.id IS NULL))'
3673
- @Album.exclude(:tags=>[@Tag.new, @Tag.new]).sql.should == 'SELECT * FROM albums WHERE \'t\''
3674
- end
3675
-
3676
- it "should be able to handle NULL values when excluding multiple many_to_one associations with composite keys" do
3677
- @Album.exclude(:cartist=>[@Artist.load(:id1=>3, :id2=>4), @Artist.load(:id1=>3)]).sql.should == 'SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN ((3, 4))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))'
3678
- @Album.exclude(:cartist=>[@Artist.load(:id1=>3, :id2=>4), @Artist.new]).sql.should == 'SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN ((3, 4))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))'
3679
- end
3680
-
3681
- it "should be able handle NULL values when excluding multiple one_to_many associations with composite keys" do
3682
- @Album.exclude(:ctracks=>[@Track.load(:album_id1=>3, :album_id2=>4), @Track.load(:album_id1=>3)]).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN ((3, 4))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3683
- @Album.exclude(:ctracks=>[@Track.load(:album_id1=>3, :album_id2=>4), @Track.new]).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN ((3, 4))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3684
- end
3685
-
3686
- it "should be able to handle NULL values when excluding multiple one_to_one associations with composite keys" do
3687
- @Album.exclude(:calbum_info=>[@AlbumInfo.load(:album_id1=>3, :album_id2=>4), @AlbumInfo.load(:album_id1=>5)]).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN ((3, 4))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3688
- @Album.exclude(:calbum_info=>[@AlbumInfo.load(:album_id1=>3, :album_id2=>4), @AlbumInfo.new]).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN ((3, 4))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3689
- end
3690
-
3691
- it "should be able to handle NULL values when excluding multiple many_to_many associations with composite keys" do
3692
- @Album.exclude(:ctags=>[@Tag.load(:tid1=>3, :tid2=>4), @Tag.load(:tid1=>5)]).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE (((albums_tags.tag_id1, albums_tags.tag_id2) IN ((3, 4))) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3693
- @Album.exclude(:ctags=>[@Tag.load(:tid1=>3, :tid2=>4), @Tag.new]).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE (((albums_tags.tag_id1, albums_tags.tag_id2) IN ((3, 4))) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3694
- end
3695
-
3696
- it "should be able to filter on many_to_one association datasets" do
3697
- @Album.filter(:artist=>@Artist.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE (albums.artist_id IN (SELECT artists.id FROM artists WHERE ((x = 1) AND (artists.id IS NOT NULL))))'
3698
- end
3699
-
3700
- it "should be able to filter on one_to_many association datasets" do
3701
- @Album.filter(:tracks=>@Track.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((x = 1) AND (tracks.album_id IS NOT NULL))))'
3702
- end
3703
-
3704
- it "should be able to filter on one_to_one association datasets" do
3705
- @Album.filter(:album_info=>@AlbumInfo.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (SELECT album_infos.album_id FROM album_infos WHERE ((x = 1) AND (album_infos.album_id IS NOT NULL))))'
3706
- end
3707
-
3708
- it "should be able to filter on many_to_many association datasets" do
3709
- @Album.filter(:tags=>@Tag.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM albums_tags WHERE ((albums_tags.tag_id IN (SELECT tags.id FROM tags WHERE ((x = 1) AND (tags.id IS NOT NULL)))) AND (albums_tags.album_id IS NOT NULL))))'
3710
- end
3711
-
3712
- it "should be able to filter on many_to_one association datasets with :conditions" do
3713
- @Album.filter(:a_artist=>@Artist.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (albums.artist_id IN (SELECT artists.id FROM artists WHERE ((name = 'A') AND (artists.id IS NOT NULL) AND (artists.id IN (SELECT artists.id FROM artists WHERE (x = 1))))))"
3714
- end
3715
-
3716
- it "should be able to filter on one_to_many association datasets with :conditions" do
3717
- @Album.filter(:a_tracks=>@Track.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'A') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT tracks.id FROM tracks WHERE (x = 1))))))"
3718
- end
3719
-
3720
- it "should be able to filter on one_to_one association datasets with :conditions" do
3721
- @Album.filter(:a_album_info=>@AlbumInfo.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id IN (SELECT album_infos.id FROM album_infos WHERE (x = 1))))))"
3722
- end
3723
-
3724
- it "should be able to filter on many_to_many association datasets with :conditions" do
3725
- @Album.filter(:a_tags=>@Tag.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'A') AND (albums_tags.album_id IS NOT NULL) AND (tags.id IN (SELECT tags.id FROM tags WHERE (x = 1))))))"
3726
- end
3727
-
3728
- it "should be able to filter on many_to_one association datasets with block" do
3729
- @Album.filter(:b_artist=>@Artist.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (albums.artist_id IN (SELECT artists.id FROM artists WHERE ((name = 'B') AND (artists.id IS NOT NULL) AND (artists.id IN (SELECT artists.id FROM artists WHERE (x = 1))))))"
3730
- end
3731
-
3732
- it "should be able to filter on one_to_many association datasets with block" do
3733
- @Album.filter(:b_tracks=>@Track.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'B') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT tracks.id FROM tracks WHERE (x = 1))))))"
3734
- end
3735
-
3736
- it "should be able to filter on one_to_one association datasets with block" do
3737
- @Album.filter(:b_album_info=>@AlbumInfo.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id IN (SELECT album_infos.id FROM album_infos WHERE (x = 1))))))"
3738
- end
3739
-
3740
- it "should be able to filter on many_to_many association datasets with block" do
3741
- @Album.filter(:b_tags=>@Tag.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (albums.id IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'B') AND (albums_tags.album_id IS NOT NULL) AND (tags.id IN (SELECT tags.id FROM tags WHERE (x = 1))))))"
3742
- end
3743
-
3744
- it "should be able to filter on many_to_one association datasets with composite keys" do
3745
- @Album.filter(:cartist=>@Artist.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((x = 1) AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL))))'
3746
- end
3747
-
3748
- it "should be able to filter on one_to_many association datasets with composite keys" do
3749
- @Album.filter(:ctracks=>@Track.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((x = 1) AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL))))'
3750
- end
3751
-
3752
- it "should be able to filter on one_to_one association datasets with composite keys" do
3753
- @Album.filter(:calbum_info=>@AlbumInfo.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((x = 1) AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL))))'
3754
- end
3755
-
3756
- it "should be able to filter on many_to_many association datasets with composite keys" do
3757
- @Album.filter(:ctags=>@Tag.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE (((albums_tags.tag_id1, albums_tags.tag_id2) IN (SELECT tags.tid1, tags.tid2 FROM tags WHERE ((x = 1) AND (tags.tid1 IS NOT NULL) AND (tags.tid2 IS NOT NULL)))) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL))))'
3758
- end
3759
-
3760
- it "should be able to filter on many_to_one association datasets with :conditions and composite keys" do
3761
- @Album.filter(:a_cartist=>@Artist.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'A') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id IN (SELECT artists.id FROM artists WHERE (x = 1))))))"
3762
- end
3763
-
3764
- it "should be able to filter on one_to_many association datasets with :conditions and composite keys" do
3765
- @Album.filter(:a_ctracks=>@Track.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'A') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (SELECT tracks.id FROM tracks WHERE (x = 1))))))"
3766
- end
3767
-
3768
- it "should be able to filter on one_to_one association datasets with :conditions and composite keys" do
3769
- @Album.filter(:a_calbum_info=>@AlbumInfo.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id IN (SELECT album_infos.id FROM album_infos WHERE (x = 1))))))"
3770
- end
3771
-
3772
- it "should be able to filter on many_to_many association datasets with :conditions and composite keys" do
3773
- @Album.filter(:a_ctags=>@Tag.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'A') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id IN (SELECT tags.id FROM tags WHERE (x = 1))))))"
3774
- end
3775
-
3776
- it "should be able to filter on many_to_one association datasets with block and composite keys" do
3777
- @Album.filter(:b_cartist=>@Artist.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id1, albums.artist_id2) IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'B') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id IN (SELECT artists.id FROM artists WHERE (x = 1))))))"
3778
- end
3779
-
3780
- it "should be able to filter on one_to_many association datasets with block and composite keys" do
3781
- @Album.filter(:b_ctracks=>@Track.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'B') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (SELECT tracks.id FROM tracks WHERE (x = 1))))))"
3782
- end
3783
-
3784
- it "should be able to filter on one_to_one association datasets with block and composite keys" do
3785
- @Album.filter(:b_calbum_info=>@AlbumInfo.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id IN (SELECT album_infos.id FROM album_infos WHERE (x = 1))))))"
3786
- end
3787
-
3788
- it "should be able to filter on many_to_many association datasets with block and composite keys" do
3789
- @Album.filter(:b_ctags=>@Tag.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id1, albums.id2) IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'B') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id IN (SELECT tags.id FROM tags WHERE (x = 1))))))"
3790
- end
3791
-
3792
- it "should be able to exclude on many_to_one association datasets" do
3793
- @Album.exclude(:artist=>@Artist.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE ((albums.artist_id NOT IN (SELECT artists.id FROM artists WHERE ((x = 1) AND (artists.id IS NOT NULL)))) OR (albums.artist_id IS NULL))'
3794
- end
3795
-
3796
- it "should be able to exclude on one_to_many association datasets" do
3797
- @Album.exclude(:tracks=>@Track.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT tracks.album_id FROM tracks WHERE ((x = 1) AND (tracks.album_id IS NOT NULL)))) OR (albums.id IS NULL))'
3798
- end
3799
-
3800
- it "should be able to exclude on one_to_one association datasets" do
3801
- @Album.exclude(:album_info=>@AlbumInfo.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT album_infos.album_id FROM album_infos WHERE ((x = 1) AND (album_infos.album_id IS NOT NULL)))) OR (albums.id IS NULL))'
3802
- end
3803
-
3804
- it "should be able to exclude on many_to_many association datasets" do
3805
- @Album.exclude(:tags=>@Tag.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM albums_tags WHERE ((albums_tags.tag_id IN (SELECT tags.id FROM tags WHERE ((x = 1) AND (tags.id IS NOT NULL)))) AND (albums_tags.album_id IS NOT NULL)))) OR (albums.id IS NULL))'
3806
- end
3807
-
3808
- it "should be able to exclude on many_to_one association datasets with :conditions" do
3809
- @Album.exclude(:a_artist=>@Artist.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id NOT IN (SELECT artists.id FROM artists WHERE ((name = 'A') AND (artists.id IS NOT NULL) AND (artists.id IN (SELECT artists.id FROM artists WHERE (x = 1)))))) OR (albums.artist_id IS NULL))"
3810
- end
3811
-
3812
- it "should be able to exclude on one_to_many association datasets with :conditions" do
3813
- @Album.exclude(:a_tracks=>@Track.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'A') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT tracks.id FROM tracks WHERE (x = 1)))))) OR (albums.id IS NULL))"
3814
- end
3815
-
3816
- it "should be able to exclude on one_to_one association datasets with :conditions" do
3817
- @Album.exclude(:a_album_info=>@AlbumInfo.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id IN (SELECT album_infos.id FROM album_infos WHERE (x = 1)))))) OR (albums.id IS NULL))"
3818
- end
3819
-
3820
- it "should be able to exclude on many_to_many association datasets with :conditions" do
3821
- @Album.exclude(:a_tags=>@Tag.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'A') AND (albums_tags.album_id IS NOT NULL) AND (tags.id IN (SELECT tags.id FROM tags WHERE (x = 1)))))) OR (albums.id IS NULL))"
3822
- end
3823
-
3824
- it "should be able to exclude on many_to_one association datasets with block" do
3825
- @Album.exclude(:b_artist=>@Artist.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.artist_id NOT IN (SELECT artists.id FROM artists WHERE ((name = 'B') AND (artists.id IS NOT NULL) AND (artists.id IN (SELECT artists.id FROM artists WHERE (x = 1)))))) OR (albums.artist_id IS NULL))"
3826
- end
3827
-
3828
- it "should be able to exclude on one_to_many association datasets with block" do
3829
- @Album.exclude(:b_tracks=>@Track.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT tracks.album_id FROM tracks WHERE ((name = 'B') AND (tracks.album_id IS NOT NULL) AND (tracks.id IN (SELECT tracks.id FROM tracks WHERE (x = 1)))))) OR (albums.id IS NULL))"
3830
- end
3831
-
3832
- it "should be able to exclude on one_to_one association datasets with block" do
3833
- @Album.exclude(:b_album_info=>@AlbumInfo.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT album_infos.album_id FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id IS NOT NULL) AND (album_infos.id IN (SELECT album_infos.id FROM album_infos WHERE (x = 1)))))) OR (albums.id IS NULL))"
3834
- end
3835
-
3836
- it "should be able to exclude on many_to_many association datasets with block" do
3837
- @Album.exclude(:b_tags=>@Tag.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE ((albums.id NOT IN (SELECT albums_tags.album_id FROM tags INNER JOIN albums_tags ON (albums_tags.tag_id = tags.id) WHERE ((name = 'B') AND (albums_tags.album_id IS NOT NULL) AND (tags.id IN (SELECT tags.id FROM tags WHERE (x = 1)))))) OR (albums.id IS NULL))"
3838
- end
3839
-
3840
- it "should be able to exclude on many_to_one association datasets with composite keys" do
3841
- @Album.exclude(:cartist=>@Artist.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((x = 1) AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL)))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))'
3842
- end
3843
-
3844
- it "should be able to exclude on one_to_many association datasets with composite keys" do
3845
- @Album.exclude(:ctracks=>@Track.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((x = 1) AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3846
- end
3847
-
3848
- it "should be able to exclude on one_to_one association datasets with composite keys" do
3849
- @Album.exclude(:calbum_info=>@AlbumInfo.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((x = 1) AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3850
- end
3851
-
3852
- it "should be able to exclude on many_to_many association datasets with composite keys" do
3853
- @Album.exclude(:ctags=>@Tag.filter(:x=>1)).sql.should == 'SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM albums_tags WHERE (((albums_tags.tag_id1, albums_tags.tag_id2) IN (SELECT tags.tid1, tags.tid2 FROM tags WHERE ((x = 1) AND (tags.tid1 IS NOT NULL) AND (tags.tid2 IS NOT NULL)))) AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL)))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))'
3854
- end
3855
-
3856
- it "should be able to exclude on many_to_one association datasets with :conditions and composite keys" do
3857
- @Album.exclude(:a_cartist=>@Artist.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'A') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id IN (SELECT artists.id FROM artists WHERE (x = 1)))))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))"
3858
- end
3859
-
3860
- it "should be able to exclude on one_to_many association datasets with :conditions and composite keys" do
3861
- @Album.exclude(:a_ctracks=>@Track.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'A') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (SELECT tracks.id FROM tracks WHERE (x = 1)))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3862
- end
3863
-
3864
- it "should be able to exclude on one_to_one association datasets with :conditions and composite keys" do
3865
- @Album.exclude(:a_calbum_info=>@AlbumInfo.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'A') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id IN (SELECT album_infos.id FROM album_infos WHERE (x = 1)))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3866
- end
3867
-
3868
- it "should be able to exclude on many_to_many association datasets with :conditions and composite keys" do
3869
- @Album.exclude(:a_ctags=>@Tag.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'A') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id IN (SELECT tags.id FROM tags WHERE (x = 1)))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3870
- end
3871
-
3872
- it "should be able to exclude on many_to_one association datasets with block and composite keys" do
3873
- @Album.exclude(:b_cartist=>@Artist.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (((albums.artist_id1, albums.artist_id2) NOT IN (SELECT artists.id1, artists.id2 FROM artists WHERE ((name = 'B') AND (artists.id1 IS NOT NULL) AND (artists.id2 IS NOT NULL) AND (artists.id IN (SELECT artists.id FROM artists WHERE (x = 1)))))) OR (albums.artist_id1 IS NULL) OR (albums.artist_id2 IS NULL))"
3874
- end
3875
-
3876
- it "should be able to exclude on one_to_many association datasets with block and composite keys" do
3877
- @Album.exclude(:b_ctracks=>@Track.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT tracks.album_id1, tracks.album_id2 FROM tracks WHERE ((name = 'B') AND (tracks.album_id1 IS NOT NULL) AND (tracks.album_id2 IS NOT NULL) AND (tracks.id IN (SELECT tracks.id FROM tracks WHERE (x = 1)))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3878
- end
3879
-
3880
- it "should be able to exclude on one_to_one association datasets with block and composite keys" do
3881
- @Album.exclude(:b_calbum_info=>@AlbumInfo.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT album_infos.album_id1, album_infos.album_id2 FROM album_infos WHERE ((name = 'B') AND (album_infos.album_id1 IS NOT NULL) AND (album_infos.album_id2 IS NOT NULL) AND (album_infos.id IN (SELECT album_infos.id FROM album_infos WHERE (x = 1)))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3882
- end
3883
-
3884
- it "should be able to exclude on many_to_many association datasets with block and composite keys" do
3885
- @Album.exclude(:b_ctags=>@Tag.filter(:x=>1)).sql.should == "SELECT * FROM albums WHERE (((albums.id1, albums.id2) NOT IN (SELECT albums_tags.album_id1, albums_tags.album_id2 FROM tags INNER JOIN albums_tags ON ((albums_tags.tag_id1 = tags.tid1) AND (albums_tags.tag_id2 = tags.tid2)) WHERE ((name = 'B') AND (albums_tags.album_id1 IS NOT NULL) AND (albums_tags.album_id2 IS NOT NULL) AND (tags.id IN (SELECT tags.id FROM tags WHERE (x = 1)))))) OR (albums.id1 IS NULL) OR (albums.id2 IS NULL))"
3886
- end
3887
-
3888
- it "should do a regular IN query if the dataset for a different model is used" do
3889
- @Album.filter(:artist=>@Album.select(:x)).sql.should == 'SELECT * FROM albums WHERE (artist IN (SELECT x FROM albums))'
3890
- end
3891
-
3892
- it "should do a regular IN query if a non-model dataset is used" do
3893
- @Album.filter(:artist=>@Album.db.from(:albums).select(:x)).sql.should == 'SELECT * FROM albums WHERE (artist IN (SELECT x FROM albums))'
3894
- end
3895
- end
3896
-
3897
- describe "Sequel::Model Associations with clashing column names" do
3898
- before do
3899
- @db = Sequel.mock(:fetch=>{:id=>1, :object_id=>2})
3900
- @Foo = Class.new(Sequel::Model(@db[:foos]))
3901
- @Bar = Class.new(Sequel::Model(@db[:bars]))
3902
- @Foo.columns :id, :object_id
3903
- @Bar.columns :id, :object_id
3904
- @Foo.def_column_alias(:obj_id, :object_id)
3905
- @Bar.def_column_alias(:obj_id, :object_id)
3906
- @Foo.one_to_many :bars, :primary_key=>:obj_id, :primary_key_column=>:object_id, :key=>:object_id, :key_method=>:obj_id, :class=>@Bar
3907
- @Foo.one_to_one :bar, :primary_key=>:obj_id, :primary_key_column=>:object_id, :key=>:object_id, :key_method=>:obj_id, :class=>@Bar
3908
- @Bar.many_to_one :foo, :key=>:obj_id, :key_column=>:object_id, :primary_key=>:object_id, :primary_key_method=>:obj_id, :class=>@Foo
3909
- @Foo.many_to_many :mtmbars, :join_table=>:bars_foos, :left_primary_key=>:obj_id, :left_primary_key_column=>:object_id, :right_primary_key=>:object_id, :right_primary_key_method=>:obj_id, :left_key=>:foo_id, :right_key=>:object_id, :class=>@Bar
3910
- @Bar.many_to_many :mtmfoos, :join_table=>:bars_foos, :left_primary_key=>:obj_id, :left_primary_key_column=>:object_id, :right_primary_key=>:object_id, :right_primary_key_method=>:obj_id, :left_key=>:object_id, :right_key=>:foo_id, :class=>@Foo
3911
- @foo = @Foo.load(:id=>1, :object_id=>2)
3912
- @bar = @Bar.load(:id=>1, :object_id=>2)
3913
- @db.sqls
3914
- end
3915
-
3916
- it "should have working regular association methods" do
3917
- @Bar.first.foo.should == @foo
3918
- @db.sqls.should == ["SELECT * FROM bars LIMIT 1", "SELECT * FROM foos WHERE (foos.object_id = 2) LIMIT 1"]
3919
- @Foo.first.bars.should == [@bar]
3920
- @db.sqls.should == ["SELECT * FROM foos LIMIT 1", "SELECT * FROM bars WHERE (bars.object_id = 2)"]
3921
- @Foo.first.bar.should == @bar
3922
- @db.sqls.should == ["SELECT * FROM foos LIMIT 1", "SELECT * FROM bars WHERE (bars.object_id = 2) LIMIT 1"]
3923
- @Foo.first.mtmbars.should == [@bar]
3924
- @db.sqls.should == ["SELECT * FROM foos LIMIT 1", "SELECT bars.* FROM bars INNER JOIN bars_foos ON (bars_foos.object_id = bars.object_id) WHERE (bars_foos.foo_id = 2)"]
3925
- @Bar.first.mtmfoos.should == [@foo]
3926
- @db.sqls.should == ["SELECT * FROM bars LIMIT 1", "SELECT foos.* FROM foos INNER JOIN bars_foos ON (bars_foos.foo_id = foos.object_id) WHERE (bars_foos.object_id = 2)"]
3927
- end
3928
-
3929
- it "should have working eager loading methods" do
3930
- @Bar.eager(:foo).all.map{|o| [o, o.foo]}.should == [[@bar, @foo]]
3931
- @db.sqls.should == ["SELECT * FROM bars", "SELECT * FROM foos WHERE (foos.object_id IN (2))"]
3932
- @Foo.eager(:bars).all.map{|o| [o, o.bars]}.should == [[@foo, [@bar]]]
3933
- @db.sqls.should == ["SELECT * FROM foos", "SELECT * FROM bars WHERE (bars.object_id IN (2))"]
3934
- @Foo.eager(:bar).all.map{|o| [o, o.bar]}.should == [[@foo, @bar]]
3935
- @db.sqls.should == ["SELECT * FROM foos", "SELECT * FROM bars WHERE (bars.object_id IN (2))"]
3936
- @db.fetch = [[{:id=>1, :object_id=>2}], [{:id=>1, :object_id=>2, :x_foreign_key_x=>2}]]
3937
- @Foo.eager(:mtmbars).all.map{|o| [o, o.mtmbars]}.should == [[@foo, [@bar]]]
3938
- @db.sqls.should == ["SELECT * FROM foos", "SELECT bars.*, bars_foos.foo_id AS x_foreign_key_x FROM bars INNER JOIN bars_foos ON (bars_foos.object_id = bars.object_id) WHERE (bars_foos.foo_id IN (2))"]
3939
- @db.fetch = [[{:id=>1, :object_id=>2}], [{:id=>1, :object_id=>2, :x_foreign_key_x=>2}]]
3940
- @Bar.eager(:mtmfoos).all.map{|o| [o, o.mtmfoos]}.should == [[@bar, [@foo]]]
3941
- @db.sqls.should == ["SELECT * FROM bars", "SELECT foos.*, bars_foos.object_id AS x_foreign_key_x FROM foos INNER JOIN bars_foos ON (bars_foos.foo_id = foos.object_id) WHERE (bars_foos.object_id IN (2))"]
3942
- end
3943
-
3944
- it "should have working eager graphing methods" do
3945
- @db.fetch = {:id=>1, :object_id=>2, :foo_id=>1, :foo_object_id=>2}
3946
- @Bar.eager_graph(:foo).all.map{|o| [o, o.foo]}.should == [[@bar, @foo]]
3947
- @db.sqls.should == ["SELECT bars.id, bars.object_id, foo.id AS foo_id, foo.object_id AS foo_object_id FROM bars LEFT OUTER JOIN foos AS foo ON (foo.object_id = bars.object_id)"]
3948
- @db.fetch = {:id=>1, :object_id=>2, :bars_id=>1, :bars_object_id=>2}
3949
- @Foo.eager_graph(:bars).all.map{|o| [o, o.bars]}.should == [[@foo, [@bar]]]
3950
- @db.sqls.should == ["SELECT foos.id, foos.object_id, bars.id AS bars_id, bars.object_id AS bars_object_id FROM foos LEFT OUTER JOIN bars ON (bars.object_id = foos.object_id)"]
3951
- @db.fetch = {:id=>1, :object_id=>2, :bar_id=>1, :bar_object_id=>2}
3952
- @Foo.eager_graph(:bar).all.map{|o| [o, o.bar]}.should == [[@foo, @bar]]
3953
- @db.sqls.should == ["SELECT foos.id, foos.object_id, bar.id AS bar_id, bar.object_id AS bar_object_id FROM foos LEFT OUTER JOIN bars AS bar ON (bar.object_id = foos.object_id)"]
3954
- @db.fetch = {:id=>1, :object_id=>2, :mtmfoos_id=>1, :mtmfoos_object_id=>2}
3955
- @Bar.eager_graph(:mtmfoos).all.map{|o| [o, o.mtmfoos]}.should == [[@bar, [@foo]]]
3956
- @db.sqls.should == ["SELECT bars.id, bars.object_id, mtmfoos.id AS mtmfoos_id, mtmfoos.object_id AS mtmfoos_object_id FROM bars LEFT OUTER JOIN bars_foos ON (bars_foos.object_id = bars.object_id) LEFT OUTER JOIN foos AS mtmfoos ON (mtmfoos.object_id = bars_foos.foo_id)"]
3957
- @db.fetch = {:id=>1, :object_id=>2, :mtmbars_id=>1, :mtmbars_object_id=>2}
3958
- @Foo.eager_graph(:mtmbars).all.map{|o| [o, o.mtmbars]}.should == [[@foo, [@bar]]]
3959
- @db.sqls.should == ["SELECT foos.id, foos.object_id, mtmbars.id AS mtmbars_id, mtmbars.object_id AS mtmbars_object_id FROM foos LEFT OUTER JOIN bars_foos ON (bars_foos.foo_id = foos.object_id) LEFT OUTER JOIN bars AS mtmbars ON (mtmbars.object_id = bars_foos.object_id)"]
3960
- end
3961
-
3962
- it "should have working filter by associations with model instances" do
3963
- @Bar.first(:foo=>@foo).should == @bar
3964
- @db.sqls.should == ["SELECT * FROM bars WHERE (bars.object_id = 2) LIMIT 1"]
3965
- @Foo.first(:bars=>@bar).should == @foo
3966
- @db.sqls.should == ["SELECT * FROM foos WHERE (foos.object_id = 2) LIMIT 1"]
3967
- @Foo.first(:bar=>@bar).should == @foo
3968
- @db.sqls.should == ["SELECT * FROM foos WHERE (foos.object_id = 2) LIMIT 1"]
3969
- @Foo.first(:mtmbars=>@bar).should == @foo
3970
- @db.sqls.should == ["SELECT * FROM foos WHERE (foos.object_id IN (SELECT bars_foos.foo_id FROM bars_foos WHERE ((bars_foos.object_id = 2) AND (bars_foos.foo_id IS NOT NULL)))) LIMIT 1"]
3971
- @Bar.first(:mtmfoos=>@foo).should == @bar
3972
- @db.sqls.should == ["SELECT * FROM bars WHERE (bars.object_id IN (SELECT bars_foos.object_id FROM bars_foos WHERE ((bars_foos.foo_id = 2) AND (bars_foos.object_id IS NOT NULL)))) LIMIT 1"]
3973
- end
3974
-
3975
- it "should have working filter by associations for associations with :conditions with model instances" do
3976
- @Bar.many_to_one :foo, :clone=>:foo, :conditions=>{:name=>'A'}
3977
- @Foo.one_to_many :bars, :clone=>:bars, :conditions=>{:name=>'A'}
3978
- @Foo.one_to_one :bar, :clone=>:bars
3979
- @Foo.many_to_many :mtmbars, :clone=>:mtmbars, :conditions=>{:name=>'A'}
3980
- @Bar.many_to_many :mtmfoos, :clone=>:mtmfoos, :conditions=>{:name=>'A'}
3981
-
3982
- @Bar.where(:foo=>@foo).sql.should == "SELECT * FROM bars WHERE (bars.object_id IN (SELECT foos.object_id FROM foos WHERE ((name = 'A') AND (foos.object_id IS NOT NULL) AND (foos.id = 1))))"
3983
- @Foo.where(:bars=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_id IN (SELECT bars.object_id FROM bars WHERE ((name = 'A') AND (bars.object_id IS NOT NULL) AND (bars.id = 1))))"
3984
- @Foo.where(:bar=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_id IN (SELECT bars.object_id FROM bars WHERE ((name = 'A') AND (bars.object_id IS NOT NULL) AND (bars.id = 1))))"
3985
- @Foo.where(:mtmbars=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_id IN (SELECT bars_foos.foo_id FROM bars INNER JOIN bars_foos ON (bars_foos.object_id = bars.object_id) WHERE ((name = 'A') AND (bars_foos.foo_id IS NOT NULL) AND (bars.id = 1))))"
3986
- @Bar.where(:mtmfoos=>@foo).sql.should == "SELECT * FROM bars WHERE (bars.object_id IN (SELECT bars_foos.object_id FROM foos INNER JOIN bars_foos ON (bars_foos.foo_id = foos.object_id) WHERE ((name = 'A') AND (bars_foos.object_id IS NOT NULL) AND (foos.id = 1))))"
3987
- end
3988
-
3989
- it "should have working filter by associations for associations with block with model instances" do
3990
- b = lambda{|ds| ds.where(:name=>'A')}
3991
- @Bar.many_to_one :foo, :clone=>:foo, &b
3992
- @Foo.one_to_many :bars, :clone=>:bars, &b
3993
- @Foo.one_to_one :bar, :clone=>:bars
3994
- @Foo.many_to_many :mtmbars, :clone=>:mtmbars, &b
3995
- @Bar.many_to_many :mtmfoos, :clone=>:mtmfoos, &b
3996
-
3997
- @Bar.where(:foo=>@foo).sql.should == "SELECT * FROM bars WHERE (bars.object_id IN (SELECT foos.object_id FROM foos WHERE ((name = 'A') AND (foos.object_id IS NOT NULL) AND (foos.id = 1))))"
3998
- @Foo.where(:bars=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_id IN (SELECT bars.object_id FROM bars WHERE ((name = 'A') AND (bars.object_id IS NOT NULL) AND (bars.id = 1))))"
3999
- @Foo.where(:bar=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_id IN (SELECT bars.object_id FROM bars WHERE ((name = 'A') AND (bars.object_id IS NOT NULL) AND (bars.id = 1))))"
4000
- @Foo.where(:mtmbars=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_id IN (SELECT bars_foos.foo_id FROM bars INNER JOIN bars_foos ON (bars_foos.object_id = bars.object_id) WHERE ((name = 'A') AND (bars_foos.foo_id IS NOT NULL) AND (bars.id = 1))))"
4001
- @Bar.where(:mtmfoos=>@foo).sql.should == "SELECT * FROM bars WHERE (bars.object_id IN (SELECT bars_foos.object_id FROM foos INNER JOIN bars_foos ON (bars_foos.foo_id = foos.object_id) WHERE ((name = 'A') AND (bars_foos.object_id IS NOT NULL) AND (foos.id = 1))))"
4002
- end
4003
-
4004
- it "should have working modification methods" do
4005
- b = @Bar.load(:id=>2, :object_id=>3)
4006
- f = @Foo.load(:id=>2, :object_id=>3)
4007
- @db.numrows = 1
4008
-
4009
- @bar.foo = f
4010
- @bar.obj_id.should == 3
4011
- @foo.bar = @bar
4012
- @bar.obj_id.should == 2
4013
-
4014
- @foo.add_bar(b)
4015
- @db.fetch = [[{:id=>1, :object_id=>2}, {:id=>2, :object_id=>2}], [{:id=>1, :object_id=>2}]]
4016
- @foo.bars.should == [@bar, b]
4017
- @foo.remove_bar(b)
4018
- @foo.bars.should == [@bar]
4019
- @foo.remove_all_bars
4020
- @foo.bars.should == []
4021
-
4022
- @db.fetch = [[{:id=>1, :object_id=>2}], [], [{:id=>2, :object_id=>2}]]
4023
- @bar = @Bar.load(:id=>1, :object_id=>2)
4024
- @foo.mtmbars.should == [@bar]
4025
- @foo.remove_all_mtmbars
4026
- @foo.mtmbars.should == []
4027
- @foo.add_mtmbar(b)
4028
- @foo.mtmbars.should == [b]
4029
- @foo.remove_mtmbar(b)
4030
- @foo.mtmbars.should == []
4031
-
4032
- @db.fetch = [[{:id=>2, :object_id=>3}], [], [{:id=>2, :object_id=>3}]]
4033
- @bar.add_mtmfoo(f)
4034
- @bar.mtmfoos.should == [f]
4035
- @bar.remove_all_mtmfoos
4036
- @bar.mtmfoos.should == []
4037
- @bar.add_mtmfoo(f)
4038
- @bar.mtmfoos.should == [f]
4039
- @bar.remove_mtmfoo(f)
4040
- @bar.mtmfoos.should == []
4041
- end
4042
- end
4043
-
4044
- describe "Sequel::Model Associations with non-column expression keys" do
4045
- before do
4046
- @db = Sequel.mock(:fetch=>{:id=>1, :object_ids=>[2]})
4047
- @Foo = Class.new(Sequel::Model(@db[:foos]))
4048
- @Bar = Class.new(Sequel::Model(@db[:bars]))
4049
- @Foo.columns :id, :object_ids
4050
- @Bar.columns :id, :object_ids
4051
- m = Module.new{def obj_id; object_ids[0]; end}
4052
- @Foo.include m
4053
- @Bar.include m
4054
-
4055
- @Foo.one_to_many :bars, :primary_key=>:obj_id, :primary_key_column=>Sequel.subscript(:object_ids, 0), :key=>Sequel.subscript(:object_ids, 0), :key_method=>:obj_id, :class=>@Bar
4056
- @Foo.one_to_one :bar, :primary_key=>:obj_id, :primary_key_column=>Sequel.subscript(:object_ids, 0), :key=>Sequel.subscript(:object_ids, 0), :key_method=>:obj_id, :class=>@Bar
4057
- @Bar.many_to_one :foo, :key=>:obj_id, :key_column=>Sequel.subscript(:object_ids, 0), :primary_key=>Sequel.subscript(:object_ids, 0), :primary_key_method=>:obj_id, :class=>@Foo
4058
- @Foo.many_to_many :mtmbars, :join_table=>:bars_foos, :left_primary_key=>:obj_id, :left_primary_key_column=>Sequel.subscript(:object_ids, 0), :right_primary_key=>Sequel.subscript(:object_ids, 0), :right_primary_key_method=>:obj_id, :left_key=>Sequel.subscript(:foo_ids, 0), :right_key=>Sequel.subscript(:bar_ids, 0), :class=>@Bar
4059
- @Bar.many_to_many :mtmfoos, :join_table=>:bars_foos, :left_primary_key=>:obj_id, :left_primary_key_column=>Sequel.subscript(:object_ids, 0), :right_primary_key=>Sequel.subscript(:object_ids, 0), :right_primary_key_method=>:obj_id, :left_key=>Sequel.subscript(:bar_ids, 0), :right_key=>Sequel.subscript(:foo_ids, 0), :class=>@Foo, :reciprocal=>nil
4060
- @foo = @Foo.load(:id=>1, :object_ids=>[2])
4061
- @bar = @Bar.load(:id=>1, :object_ids=>[2])
4062
- @db.sqls
4063
- end
4064
-
4065
- it "should have working regular association methods" do
4066
- @Bar.first.foo.should == @foo
4067
- @db.sqls.should == ["SELECT * FROM bars LIMIT 1", "SELECT * FROM foos WHERE (foos.object_ids[0] = 2) LIMIT 1"]
4068
- @Foo.first.bars.should == [@bar]
4069
- @db.sqls.should == ["SELECT * FROM foos LIMIT 1", "SELECT * FROM bars WHERE (bars.object_ids[0] = 2)"]
4070
- @Foo.first.bar.should == @bar
4071
- @db.sqls.should == ["SELECT * FROM foos LIMIT 1", "SELECT * FROM bars WHERE (bars.object_ids[0] = 2) LIMIT 1"]
4072
- @Foo.first.mtmbars.should == [@bar]
4073
- @db.sqls.should == ["SELECT * FROM foos LIMIT 1", "SELECT bars.* FROM bars INNER JOIN bars_foos ON (bars_foos.bar_ids[0] = bars.object_ids[0]) WHERE (bars_foos.foo_ids[0] = 2)"]
4074
- @Bar.first.mtmfoos.should == [@foo]
4075
- @db.sqls.should == ["SELECT * FROM bars LIMIT 1", "SELECT foos.* FROM foos INNER JOIN bars_foos ON (bars_foos.foo_ids[0] = foos.object_ids[0]) WHERE (bars_foos.bar_ids[0] = 2)"]
4076
- end
4077
-
4078
- it "should have working eager loading methods" do
4079
- @Bar.eager(:foo).all.map{|o| [o, o.foo]}.should == [[@bar, @foo]]
4080
- @db.sqls.should == ["SELECT * FROM bars", "SELECT * FROM foos WHERE (foos.object_ids[0] IN (2))"]
4081
- @Foo.eager(:bars).all.map{|o| [o, o.bars]}.should == [[@foo, [@bar]]]
4082
- @db.sqls.should == ["SELECT * FROM foos", "SELECT * FROM bars WHERE (bars.object_ids[0] IN (2))"]
4083
- @Foo.eager(:bar).all.map{|o| [o, o.bar]}.should == [[@foo, @bar]]
4084
- @db.sqls.should == ["SELECT * FROM foos", "SELECT * FROM bars WHERE (bars.object_ids[0] IN (2))"]
4085
- @db.fetch = [[{:id=>1, :object_ids=>[2]}], [{:id=>1, :object_ids=>[2], :x_foreign_key_x=>2}]]
4086
- @Foo.eager(:mtmbars).all.map{|o| [o, o.mtmbars]}.should == [[@foo, [@bar]]]
4087
- @db.sqls.should == ["SELECT * FROM foos", "SELECT bars.*, bars_foos.foo_ids[0] AS x_foreign_key_x FROM bars INNER JOIN bars_foos ON (bars_foos.bar_ids[0] = bars.object_ids[0]) WHERE (bars_foos.foo_ids[0] IN (2))"]
4088
- @db.fetch = [[{:id=>1, :object_ids=>[2]}], [{:id=>1, :object_ids=>[2], :x_foreign_key_x=>2}]]
4089
- @Bar.eager(:mtmfoos).all.map{|o| [o, o.mtmfoos]}.should == [[@bar, [@foo]]]
4090
- @db.sqls.should == ["SELECT * FROM bars", "SELECT foos.*, bars_foos.bar_ids[0] AS x_foreign_key_x FROM foos INNER JOIN bars_foos ON (bars_foos.foo_ids[0] = foos.object_ids[0]) WHERE (bars_foos.bar_ids[0] IN (2))"]
4091
- end
4092
-
4093
- it "should have working eager graphing methods" do
4094
- @db.fetch = {:id=>1, :object_ids=>[2], :foo_id=>1, :foo_object_ids=>[2]}
4095
- @Bar.eager_graph(:foo).all.map{|o| [o, o.foo]}.should == [[@bar, @foo]]
4096
- @db.sqls.should == ["SELECT bars.id, bars.object_ids, foo.id AS foo_id, foo.object_ids AS foo_object_ids FROM bars LEFT OUTER JOIN foos AS foo ON (foo.object_ids[0] = bars.object_ids[0])"]
4097
- @db.fetch = {:id=>1, :object_ids=>[2], :bars_id=>1, :bars_object_ids=>[2]}
4098
- @Foo.eager_graph(:bars).all.map{|o| [o, o.bars]}.should == [[@foo, [@bar]]]
4099
- @db.sqls.should == ["SELECT foos.id, foos.object_ids, bars.id AS bars_id, bars.object_ids AS bars_object_ids FROM foos LEFT OUTER JOIN bars ON (bars.object_ids[0] = foos.object_ids[0])"]
4100
- @db.fetch = {:id=>1, :object_ids=>[2], :bar_id=>1, :bar_object_ids=>[2]}
4101
- @Foo.eager_graph(:bar).all.map{|o| [o, o.bar]}.should == [[@foo, @bar]]
4102
- @db.sqls.should == ["SELECT foos.id, foos.object_ids, bar.id AS bar_id, bar.object_ids AS bar_object_ids FROM foos LEFT OUTER JOIN bars AS bar ON (bar.object_ids[0] = foos.object_ids[0])"]
4103
- @db.fetch = {:id=>1, :object_ids=>[2], :mtmfoos_id=>1, :mtmfoos_object_ids=>[2]}
4104
- @Bar.eager_graph(:mtmfoos).all.map{|o| [o, o.mtmfoos]}.should == [[@bar, [@foo]]]
4105
- @db.sqls.should == ["SELECT bars.id, bars.object_ids, mtmfoos.id AS mtmfoos_id, mtmfoos.object_ids AS mtmfoos_object_ids FROM bars LEFT OUTER JOIN bars_foos ON (bars_foos.bar_ids[0] = bars.object_ids[0]) LEFT OUTER JOIN foos AS mtmfoos ON (mtmfoos.object_ids[0] = bars_foos.foo_ids[0])"]
4106
- @db.fetch = {:id=>1, :object_ids=>[2], :mtmbars_id=>1, :mtmbars_object_ids=>[2]}
4107
- @Foo.eager_graph(:mtmbars).all.map{|o| [o, o.mtmbars]}.should == [[@foo, [@bar]]]
4108
- @db.sqls.should == ["SELECT foos.id, foos.object_ids, mtmbars.id AS mtmbars_id, mtmbars.object_ids AS mtmbars_object_ids FROM foos LEFT OUTER JOIN bars_foos ON (bars_foos.foo_ids[0] = foos.object_ids[0]) LEFT OUTER JOIN bars AS mtmbars ON (mtmbars.object_ids[0] = bars_foos.bar_ids[0])"]
4109
- end
4110
-
4111
- it "should have working filter by associations with model instances" do
4112
- @Bar.first(:foo=>@foo).should == @bar
4113
- @db.sqls.should == ["SELECT * FROM bars WHERE (bars.object_ids[0] = 2) LIMIT 1"]
4114
- @Foo.first(:bars=>@bar).should == @foo
4115
- @db.sqls.should == ["SELECT * FROM foos WHERE (foos.object_ids[0] = 2) LIMIT 1"]
4116
- @Foo.first(:bar=>@bar).should == @foo
4117
- @db.sqls.should == ["SELECT * FROM foos WHERE (foos.object_ids[0] = 2) LIMIT 1"]
4118
- @Foo.first(:mtmbars=>@bar).should == @foo
4119
- @db.sqls.should == ["SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars_foos.foo_ids[0] FROM bars_foos WHERE ((bars_foos.bar_ids[0] = 2) AND (bars_foos.foo_ids[0] IS NOT NULL)))) LIMIT 1"]
4120
- @Bar.first(:mtmfoos=>@foo).should == @bar
4121
- @db.sqls.should == ["SELECT * FROM bars WHERE (bars.object_ids[0] IN (SELECT bars_foos.bar_ids[0] FROM bars_foos WHERE ((bars_foos.foo_ids[0] = 2) AND (bars_foos.bar_ids[0] IS NOT NULL)))) LIMIT 1"]
4122
- end
4123
-
4124
- it "should have working filter by associations for associations with :conditions with model instances" do
4125
- @Bar.many_to_one :foo, :clone=>:foo, :conditions=>{:name=>'A'}
4126
- @Foo.one_to_many :bars, :clone=>:bars, :conditions=>{:name=>'A'}
4127
- @Foo.one_to_one :bar, :clone=>:bars
4128
- @Foo.many_to_many :mtmbars, :clone=>:mtmbars, :conditions=>{:name=>'A'}
4129
- @Bar.many_to_many :mtmfoos, :clone=>:mtmfoos, :conditions=>{:name=>'A'}
4130
-
4131
- @Bar.where(:foo=>@foo).sql.should == "SELECT * FROM bars WHERE (bars.object_ids[0] IN (SELECT foos.object_ids[0] FROM foos WHERE ((name = 'A') AND (foos.object_ids[0] IS NOT NULL) AND (foos.id = 1))))"
4132
- @Foo.where(:bars=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars.object_ids[0] FROM bars WHERE ((name = 'A') AND (bars.object_ids[0] IS NOT NULL) AND (bars.id = 1))))"
4133
- @Foo.where(:bar=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars.object_ids[0] FROM bars WHERE ((name = 'A') AND (bars.object_ids[0] IS NOT NULL) AND (bars.id = 1))))"
4134
- @Foo.where(:mtmbars=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars_foos.foo_ids[0] FROM bars INNER JOIN bars_foos ON (bars_foos.bar_ids[0] = bars.object_ids[0]) WHERE ((name = 'A') AND (bars_foos.foo_ids[0] IS NOT NULL) AND (bars.id = 1))))"
4135
- @Bar.where(:mtmfoos=>@foo).sql.should == "SELECT * FROM bars WHERE (bars.object_ids[0] IN (SELECT bars_foos.bar_ids[0] FROM foos INNER JOIN bars_foos ON (bars_foos.foo_ids[0] = foos.object_ids[0]) WHERE ((name = 'A') AND (bars_foos.bar_ids[0] IS NOT NULL) AND (foos.id = 1))))"
4136
- end
4137
-
4138
- it "should have working filter by associations for associations with block with model instances" do
4139
- b = lambda{|ds| ds.where(:name=>'A')}
4140
- @Bar.many_to_one :foo, :clone=>:foo, &b
4141
- @Foo.one_to_many :bars, :clone=>:bars, &b
4142
- @Foo.one_to_one :bar, :clone=>:bars
4143
- @Foo.many_to_many :mtmbars, :clone=>:mtmbars, &b
4144
- @Bar.many_to_many :mtmfoos, :clone=>:mtmfoos, &b
4145
-
4146
- @Bar.where(:foo=>@foo).sql.should == "SELECT * FROM bars WHERE (bars.object_ids[0] IN (SELECT foos.object_ids[0] FROM foos WHERE ((name = 'A') AND (foos.object_ids[0] IS NOT NULL) AND (foos.id = 1))))"
4147
- @Foo.where(:bars=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars.object_ids[0] FROM bars WHERE ((name = 'A') AND (bars.object_ids[0] IS NOT NULL) AND (bars.id = 1))))"
4148
- @Foo.where(:bar=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars.object_ids[0] FROM bars WHERE ((name = 'A') AND (bars.object_ids[0] IS NOT NULL) AND (bars.id = 1))))"
4149
- @Foo.where(:mtmbars=>@bar).sql.should == "SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars_foos.foo_ids[0] FROM bars INNER JOIN bars_foos ON (bars_foos.bar_ids[0] = bars.object_ids[0]) WHERE ((name = 'A') AND (bars_foos.foo_ids[0] IS NOT NULL) AND (bars.id = 1))))"
4150
- @Bar.where(:mtmfoos=>@foo).sql.should == "SELECT * FROM bars WHERE (bars.object_ids[0] IN (SELECT bars_foos.bar_ids[0] FROM foos INNER JOIN bars_foos ON (bars_foos.foo_ids[0] = foos.object_ids[0]) WHERE ((name = 'A') AND (bars_foos.bar_ids[0] IS NOT NULL) AND (foos.id = 1))))"
4151
- end
4152
-
4153
- it "should have working filter by associations with model datasets" do
4154
- @Bar.first(:foo=>@Foo.where(:id=>@foo.id)).should == @bar
4155
- @db.sqls.should == ["SELECT * FROM bars WHERE (bars.object_ids[0] IN (SELECT foos.object_ids[0] FROM foos WHERE ((id = 1) AND (foos.object_ids[0] IS NOT NULL)))) LIMIT 1"]
4156
- @Foo.first(:bars=>@Bar.where(:id=>@bar.id)).should == @foo
4157
- @db.sqls.should == ["SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars.object_ids[0] FROM bars WHERE ((id = 1) AND (bars.object_ids[0] IS NOT NULL)))) LIMIT 1"]
4158
- @Foo.first(:bar=>@Bar.where(:id=>@bar.id)).should == @foo
4159
- @db.sqls.should == ["SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars.object_ids[0] FROM bars WHERE ((id = 1) AND (bars.object_ids[0] IS NOT NULL)))) LIMIT 1"]
4160
- @Foo.first(:mtmbars=>@Bar.where(:id=>@bar.id)).should == @foo
4161
- @db.sqls.should == ["SELECT * FROM foos WHERE (foos.object_ids[0] IN (SELECT bars_foos.foo_ids[0] FROM bars_foos WHERE ((bars_foos.bar_ids[0] IN (SELECT bars.object_ids[0] FROM bars WHERE ((id = 1) AND (bars.object_ids[0] IS NOT NULL)))) AND (bars_foos.foo_ids[0] IS NOT NULL)))) LIMIT 1"]
4162
- @Bar.first(:mtmfoos=>@Foo.where(:id=>@foo.id)).should == @bar
4163
- @db.sqls.should == ["SELECT * FROM bars WHERE (bars.object_ids[0] IN (SELECT bars_foos.bar_ids[0] FROM bars_foos WHERE ((bars_foos.foo_ids[0] IN (SELECT foos.object_ids[0] FROM foos WHERE ((id = 1) AND (foos.object_ids[0] IS NOT NULL)))) AND (bars_foos.bar_ids[0] IS NOT NULL)))) LIMIT 1"]
4164
- end
4165
- end
4166
-
4167
- describe Sequel::Model, "#refresh" do
4168
- before do
4169
- @c = Class.new(Sequel::Model(:items)) do
4170
- unrestrict_primary_key
4171
- columns :id, :x
4172
- end
4173
- DB.reset
4174
- end
4175
-
4176
- specify "should remove cached associations" do
4177
- @c.many_to_one :node, :class=>@c
4178
- @m = @c.new(:id => 555)
4179
- @m.associations[:node] = 15
4180
- @m.reload
4181
- @m.associations.should == {}
4182
- end
4183
- end
4184
-
4185
- describe "Model#freeze" do
4186
- before do
4187
- class ::Album < Sequel::Model
4188
- columns :id
4189
- class B < Sequel::Model
4190
- columns :id, :album_id
4191
- many_to_one :album, :class=>Album
4192
- end
4193
- one_to_one :b, :key=>:album_id, :class=>B
4194
- end
4195
- @o = Album.load(:id=>1).freeze
4196
- DB.sqls
4197
- end
4198
- after do
4199
- Object.send(:remove_const, :Album)
4200
- end
4201
-
4202
- it "should freeze the object's associations" do
4203
- @o.associations.frozen?.should == true
4204
- end
4205
-
4206
- it "should not break associations getters" do
4207
- Album::B.dataset._fetch = {:album_id=>1, :id=>2}
4208
- @o.b.should == Album::B.load(:id=>2, :album_id=>1)
4209
- @o.associations[:b].should be_nil
4210
- end
4211
-
4212
- it "should not break reciprocal associations" do
4213
- b = Album::B.load(:id=>2, :album_id=>nil)
4214
- b.album = @o
4215
- @o.associations[:b].should be_nil
4216
- end
4217
- end
4218
-
4219
- describe "association autoreloading" do
4220
- before do
4221
- @c = Class.new(Sequel::Model)
4222
- @Artist = Class.new(@c).set_dataset(:artists)
4223
- @Artist.dataset._fetch = {:id=>2, :name=>'Ar'}
4224
- @Album = Class.new(@c).set_dataset(:albums)
4225
- @Artist.columns :id, :name
4226
- @Album.columns :id, :name, :artist_id
4227
- @Album.db_schema[:artist_id][:type] = :integer
4228
- @Album.many_to_one :artist, :class=>@Artist
4229
- DB.reset
4230
- end
4231
-
4232
- specify "should reload many_to_one association when foreign key is modified" do
4233
- album = @Album.load(:id => 1, :name=>'Al', :artist_id=>2)
4234
- album.artist
4235
- DB.sqls.should == ['SELECT * FROM artists WHERE id = 2']
4236
-
4237
- album.artist_id = 1
4238
- album.artist
4239
- DB.sqls.should == ['SELECT * FROM artists WHERE id = 1']
4240
- end
4241
-
4242
- specify "should handle multiple many_to_one association with the same foreign key" do
4243
- @Album.many_to_one :artist2, :key=>:artist_id, :class=>@Artist
4244
- album = @Album.load(:id => 1, :name=>'Al', :artist_id=>2)
4245
- album.artist
4246
- album.artist2
4247
- DB.sqls.should == ['SELECT * FROM artists WHERE id = 2'] * 2
4248
-
4249
- album.artist
4250
- album.artist2
4251
- DB.sqls.should == []
4252
-
4253
- album.artist_id = 1
4254
- album.artist
4255
- album.artist2
4256
- DB.sqls.should == ['SELECT * FROM artists WHERE id = 1'] * 2
4257
- end
4258
-
4259
- specify "should not reload when value has not changed" do
4260
- album = @Album.load(:id => 1, :name=>'Al', :artist_id=>2)
4261
- album.artist
4262
- DB.sqls.should == ['SELECT * FROM artists WHERE id = 2']
4263
-
4264
- album.artist_id = 2
4265
- album.artist
4266
- DB.sqls.should == []
4267
-
4268
- album.artist_id = "2"
4269
- album.artist
4270
- DB.sqls.should == []
4271
- end
4272
-
4273
- specify "should reload all associations which use the foreign key" do
4274
- @Album.many_to_one :other_artist, :key => :artist_id, :foreign_key => :id, :class => @Artist
4275
- album = @Album.load(:id => 1, :name=>'Al', :artist_id=>2)
4276
- album.artist
4277
- album.other_artist
4278
- DB.reset
4279
-
4280
- album.artist_id = 1
4281
- album.artist
4282
- DB.sqls.should == ['SELECT * FROM artists WHERE id = 1']
4283
-
4284
- album.other_artist
4285
- DB.sqls.should == ['SELECT * FROM artists WHERE id = 1']
4286
- end
4287
-
4288
- specify "should work with composite keys" do
4289
- @Album.many_to_one :composite_artist, :key => [:artist_id, :name], :primary_key => [:id, :name], :class => @Artist
4290
- album = @Album.load(:id => 1, :name=>'Al', :artist_id=>2)
4291
- album.composite_artist
4292
- DB.reset
4293
-
4294
- album.artist_id = 1
4295
- album.composite_artist
4296
- DB.sqls.should == ["SELECT * FROM artists WHERE ((artists.id = 1) AND (artists.name = 'Al')) LIMIT 1"]
4297
-
4298
- album.name = 'Al2'
4299
- album.composite_artist
4300
- DB.sqls.should == ["SELECT * FROM artists WHERE ((artists.id = 1) AND (artists.name = 'Al2')) LIMIT 1"]
4301
- end
4302
-
4303
- specify "should work with subclasses" do
4304
- salbum = Class.new(@Album)
4305
- oartist = Class.new(@c).set_dataset(:oartist)
4306
- oartist.columns :id, :name
4307
- salbum.many_to_one :artist2, :class=>oartist, :key=>:artist_id
4308
- album = salbum.load(:id => 1, :name=>'Al', :artist_id=>2)
4309
- album.artist
4310
- DB.sqls.should == ['SELECT * FROM artists WHERE id = 2']
4311
-
4312
- album.artist_id = 1
4313
- album.artist
4314
- DB.sqls.should == ['SELECT * FROM artists WHERE id = 1']
4315
- end
4316
- end