3mix-castronaut 0.5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (904) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.textile +75 -0
  3. data/Rakefile +105 -0
  4. data/app/config.rb +15 -0
  5. data/app/config.ru +24 -0
  6. data/app/controllers/application.rb +47 -0
  7. data/app/public/javascripts/application.js +3 -0
  8. data/app/public/javascripts/jquery.js +32 -0
  9. data/app/public/stylesheets/screen.css +122 -0
  10. data/app/views/layout.erb +27 -0
  11. data/app/views/login.erb +31 -0
  12. data/app/views/logout.erb +13 -0
  13. data/app/views/proxy_validate.erb +25 -0
  14. data/app/views/service_validate.erb +18 -0
  15. data/bin/castronaut +48 -0
  16. data/castronaut.rb +7 -0
  17. data/config/castronaut.example.yml +47 -0
  18. data/config/nginx_vhost.conf +24 -0
  19. data/config/thin_config.yml +13 -0
  20. data/lib/castronaut/adapters/active_record_adapter.rb +20 -0
  21. data/lib/castronaut/adapters/development/adapter.rb +13 -0
  22. data/lib/castronaut/adapters/development/user.rb +25 -0
  23. data/lib/castronaut/adapters/ldap/adapter.rb +15 -0
  24. data/lib/castronaut/adapters/ldap/user.rb +40 -0
  25. data/lib/castronaut/adapters/restful_authentication/adapter.rb +21 -0
  26. data/lib/castronaut/adapters/restful_authentication/user.rb +50 -0
  27. data/lib/castronaut/adapters.rb +17 -0
  28. data/lib/castronaut/authentication_result.rb +27 -0
  29. data/lib/castronaut/configuration.rb +95 -0
  30. data/lib/castronaut/db/001_create_cas_database.rb +47 -0
  31. data/lib/castronaut/db/002_change_username_to_identifier.rb +11 -0
  32. data/lib/castronaut/db/003_add_extra_info.rb +11 -0
  33. data/lib/castronaut/models/consumeable.rb +18 -0
  34. data/lib/castronaut/models/dispenser.rb +14 -0
  35. data/lib/castronaut/models/login_ticket.rb +53 -0
  36. data/lib/castronaut/models/proxy_granting_ticket.rb +69 -0
  37. data/lib/castronaut/models/proxy_ticket.rb +43 -0
  38. data/lib/castronaut/models/service_ticket.rb +100 -0
  39. data/lib/castronaut/models/ticket_granting_ticket.rb +70 -0
  40. data/lib/castronaut/presenters/base.rb +32 -0
  41. data/lib/castronaut/presenters/login.rb +60 -0
  42. data/lib/castronaut/presenters/logout.rb +40 -0
  43. data/lib/castronaut/presenters/process_login.rb +127 -0
  44. data/lib/castronaut/presenters/proxy_validate.rb +49 -0
  45. data/lib/castronaut/presenters/service_validate.rb +43 -0
  46. data/lib/castronaut/ticket_result.rb +27 -0
  47. data/lib/castronaut/utilities/random_string.rb +24 -0
  48. data/lib/castronaut.rb +34 -0
  49. data/lib/version.rb +5 -0
  50. data/spec/app/controllers/application_spec.rb +89 -0
  51. data/spec/castronaut/adapters/development/adapter_spec.rb +14 -0
  52. data/spec/castronaut/adapters/development/user_spec.rb +55 -0
  53. data/spec/castronaut/adapters/ldap/adapter_spec.rb +14 -0
  54. data/spec/castronaut/adapters/ldap/user_spec.rb +25 -0
  55. data/spec/castronaut/adapters/restful_authentication/adapter_spec.rb +14 -0
  56. data/spec/castronaut/adapters/restful_authentication/user_spec.rb +108 -0
  57. data/spec/castronaut/adapters_spec.rb +13 -0
  58. data/spec/castronaut/authentication_result_spec.rb +20 -0
  59. data/spec/castronaut/configuration_spec.rb +172 -0
  60. data/spec/castronaut/models/consumeable_spec.rb +39 -0
  61. data/spec/castronaut/models/dispenser_spec.rb +30 -0
  62. data/spec/castronaut/models/login_ticket_spec.rb +107 -0
  63. data/spec/castronaut/models/proxy_granting_ticket_spec.rb +302 -0
  64. data/spec/castronaut/models/proxy_ticket_spec.rb +109 -0
  65. data/spec/castronaut/models/service_ticket_spec.rb +269 -0
  66. data/spec/castronaut/models/ticket_granting_ticket_spec.rb +89 -0
  67. data/spec/castronaut/presenters/login_spec.rb +152 -0
  68. data/spec/castronaut/presenters/logout_spec.rb +85 -0
  69. data/spec/castronaut/presenters/process_login_spec.rb +300 -0
  70. data/spec/castronaut/presenters/proxy_validate_spec.rb +103 -0
  71. data/spec/castronaut/presenters/service_validate_spec.rb +86 -0
  72. data/spec/castronaut/ticket_result_spec.rb +42 -0
  73. data/spec/castronaut/utilities/random_string_spec.rb +14 -0
  74. data/spec/castronaut_spec.rb +26 -0
  75. data/spec/spec.opts +2 -0
  76. data/spec/spec_controller_helper.rb +17 -0
  77. data/spec/spec_helper.rb +49 -0
  78. data/spec/spec_rails_mocks.rb +132 -0
  79. data/vendor/activerecord/CHANGELOG +5753 -0
  80. data/vendor/activerecord/README +351 -0
  81. data/vendor/activerecord/RUNNING_UNIT_TESTS +36 -0
  82. data/vendor/activerecord/Rakefile +248 -0
  83. data/vendor/activerecord/examples/associations.png +0 -0
  84. data/vendor/activerecord/install.rb +30 -0
  85. data/vendor/activerecord/lib/active_record/aggregations.rb +189 -0
  86. data/vendor/activerecord/lib/active_record/association_preload.rb +282 -0
  87. data/vendor/activerecord/lib/active_record/associations/association_collection.rb +368 -0
  88. data/vendor/activerecord/lib/active_record/associations/association_proxy.rb +220 -0
  89. data/vendor/activerecord/lib/active_record/associations/belongs_to_association.rb +58 -0
  90. data/vendor/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +49 -0
  91. data/vendor/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +111 -0
  92. data/vendor/activerecord/lib/active_record/associations/has_many_association.rb +121 -0
  93. data/vendor/activerecord/lib/active_record/associations/has_many_through_association.rb +254 -0
  94. data/vendor/activerecord/lib/active_record/associations/has_one_association.rb +98 -0
  95. data/vendor/activerecord/lib/active_record/associations/has_one_through_association.rb +32 -0
  96. data/vendor/activerecord/lib/active_record/associations.rb +2012 -0
  97. data/vendor/activerecord/lib/active_record/attribute_methods.rb +379 -0
  98. data/vendor/activerecord/lib/active_record/base.rb +2744 -0
  99. data/vendor/activerecord/lib/active_record/calculations.rb +288 -0
  100. data/vendor/activerecord/lib/active_record/callbacks.rb +312 -0
  101. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +309 -0
  102. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +176 -0
  103. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +93 -0
  104. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
  105. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +664 -0
  106. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +428 -0
  107. data/vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +169 -0
  108. data/vendor/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +559 -0
  109. data/vendor/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +994 -0
  110. data/vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
  111. data/vendor/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +418 -0
  112. data/vendor/activerecord/lib/active_record/dirty.rb +165 -0
  113. data/vendor/activerecord/lib/active_record/fixtures.rb +997 -0
  114. data/vendor/activerecord/lib/active_record/locking/optimistic.rb +148 -0
  115. data/vendor/activerecord/lib/active_record/locking/pessimistic.rb +77 -0
  116. data/vendor/activerecord/lib/active_record/migration.rb +523 -0
  117. data/vendor/activerecord/lib/active_record/named_scope.rb +168 -0
  118. data/vendor/activerecord/lib/active_record/observer.rb +197 -0
  119. data/vendor/activerecord/lib/active_record/query_cache.rb +21 -0
  120. data/vendor/activerecord/lib/active_record/reflection.rb +239 -0
  121. data/vendor/activerecord/lib/active_record/schema.rb +51 -0
  122. data/vendor/activerecord/lib/active_record/schema_dumper.rb +171 -0
  123. data/vendor/activerecord/lib/active_record/serialization.rb +98 -0
  124. data/vendor/activerecord/lib/active_record/serializers/json_serializer.rb +80 -0
  125. data/vendor/activerecord/lib/active_record/serializers/xml_serializer.rb +338 -0
  126. data/vendor/activerecord/lib/active_record/test_case.rb +47 -0
  127. data/vendor/activerecord/lib/active_record/timestamp.rb +41 -0
  128. data/vendor/activerecord/lib/active_record/transactions.rb +130 -0
  129. data/vendor/activerecord/lib/active_record/validations.rb +971 -0
  130. data/vendor/activerecord/lib/active_record/vendor/mysql.rb +1214 -0
  131. data/vendor/activerecord/lib/active_record/version.rb +9 -0
  132. data/vendor/activerecord/lib/active_record.rb +80 -0
  133. data/vendor/activerecord/lib/activerecord.rb +1 -0
  134. data/vendor/activerecord/test/assets/example.log +1 -0
  135. data/vendor/activerecord/test/assets/flowers.jpg +0 -0
  136. data/vendor/activerecord/test/cases/aaa_create_tables_test.rb +24 -0
  137. data/vendor/activerecord/test/cases/active_schema_test_mysql.rb +95 -0
  138. data/vendor/activerecord/test/cases/active_schema_test_postgresql.rb +24 -0
  139. data/vendor/activerecord/test/cases/adapter_test.rb +127 -0
  140. data/vendor/activerecord/test/cases/adapter_test_sqlserver.rb +95 -0
  141. data/vendor/activerecord/test/cases/aggregations_test.rb +128 -0
  142. data/vendor/activerecord/test/cases/ar_schema_test.rb +33 -0
  143. data/vendor/activerecord/test/cases/associations/belongs_to_associations_test.rb +431 -0
  144. data/vendor/activerecord/test/cases/associations/callbacks_test.rb +161 -0
  145. data/vendor/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +123 -0
  146. data/vendor/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
  147. data/vendor/activerecord/test/cases/associations/eager_load_nested_include_test.rb +83 -0
  148. data/vendor/activerecord/test/cases/associations/eager_singularization_test.rb +145 -0
  149. data/vendor/activerecord/test/cases/associations/eager_test.rb +636 -0
  150. data/vendor/activerecord/test/cases/associations/extension_test.rb +47 -0
  151. data/vendor/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +706 -0
  152. data/vendor/activerecord/test/cases/associations/has_many_associations_test.rb +1034 -0
  153. data/vendor/activerecord/test/cases/associations/has_many_through_associations_test.rb +200 -0
  154. data/vendor/activerecord/test/cases/associations/has_one_associations_test.rb +345 -0
  155. data/vendor/activerecord/test/cases/associations/has_one_through_associations_test.rb +113 -0
  156. data/vendor/activerecord/test/cases/associations/inner_join_association_test.rb +88 -0
  157. data/vendor/activerecord/test/cases/associations/join_model_test.rb +714 -0
  158. data/vendor/activerecord/test/cases/associations_test.rb +262 -0
  159. data/vendor/activerecord/test/cases/attribute_methods_test.rb +238 -0
  160. data/vendor/activerecord/test/cases/base_test.rb +1997 -0
  161. data/vendor/activerecord/test/cases/binary_test.rb +34 -0
  162. data/vendor/activerecord/test/cases/calculations_test.rb +323 -0
  163. data/vendor/activerecord/test/cases/callbacks_test.rb +400 -0
  164. data/vendor/activerecord/test/cases/class_inheritable_attributes_test.rb +32 -0
  165. data/vendor/activerecord/test/cases/column_alias_test.rb +17 -0
  166. data/vendor/activerecord/test/cases/column_definition_test.rb +36 -0
  167. data/vendor/activerecord/test/cases/connection_test_firebird.rb +8 -0
  168. data/vendor/activerecord/test/cases/connection_test_mysql.rb +30 -0
  169. data/vendor/activerecord/test/cases/copy_table_test_sqlite.rb +69 -0
  170. data/vendor/activerecord/test/cases/database_statements_test.rb +12 -0
  171. data/vendor/activerecord/test/cases/datatype_test_postgresql.rb +203 -0
  172. data/vendor/activerecord/test/cases/date_time_test.rb +37 -0
  173. data/vendor/activerecord/test/cases/default_test_firebird.rb +16 -0
  174. data/vendor/activerecord/test/cases/defaults_test.rb +69 -0
  175. data/vendor/activerecord/test/cases/deprecated_finder_test.rb +30 -0
  176. data/vendor/activerecord/test/cases/dirty_test.rb +257 -0
  177. data/vendor/activerecord/test/cases/finder_respond_to_test.rb +76 -0
  178. data/vendor/activerecord/test/cases/finder_test.rb +890 -0
  179. data/vendor/activerecord/test/cases/fixtures_test.rb +626 -0
  180. data/vendor/activerecord/test/cases/helper.rb +47 -0
  181. data/vendor/activerecord/test/cases/inheritance_test.rb +262 -0
  182. data/vendor/activerecord/test/cases/invalid_date_test.rb +24 -0
  183. data/vendor/activerecord/test/cases/json_serialization_test.rb +205 -0
  184. data/vendor/activerecord/test/cases/lifecycle_test.rb +193 -0
  185. data/vendor/activerecord/test/cases/locking_test.rb +309 -0
  186. data/vendor/activerecord/test/cases/method_scoping_test.rb +462 -0
  187. data/vendor/activerecord/test/cases/migration_test.rb +1444 -0
  188. data/vendor/activerecord/test/cases/migration_test_firebird.rb +124 -0
  189. data/vendor/activerecord/test/cases/mixin_test.rb +96 -0
  190. data/vendor/activerecord/test/cases/modules_test.rb +39 -0
  191. data/vendor/activerecord/test/cases/multiple_db_test.rb +60 -0
  192. data/vendor/activerecord/test/cases/named_scope_test.rb +206 -0
  193. data/vendor/activerecord/test/cases/pk_test.rb +101 -0
  194. data/vendor/activerecord/test/cases/query_cache_test.rb +127 -0
  195. data/vendor/activerecord/test/cases/readonly_test.rb +107 -0
  196. data/vendor/activerecord/test/cases/reflection_test.rb +176 -0
  197. data/vendor/activerecord/test/cases/reserved_word_test_mysql.rb +176 -0
  198. data/vendor/activerecord/test/cases/schema_authorization_test_postgresql.rb +75 -0
  199. data/vendor/activerecord/test/cases/schema_dumper_test.rb +184 -0
  200. data/vendor/activerecord/test/cases/schema_test_postgresql.rb +102 -0
  201. data/vendor/activerecord/test/cases/serialization_test.rb +47 -0
  202. data/vendor/activerecord/test/cases/synonym_test_oracle.rb +17 -0
  203. data/vendor/activerecord/test/cases/table_name_test_sqlserver.rb +23 -0
  204. data/vendor/activerecord/test/cases/threaded_connections_test.rb +48 -0
  205. data/vendor/activerecord/test/cases/transactions_test.rb +307 -0
  206. data/vendor/activerecord/test/cases/unconnected_test.rb +32 -0
  207. data/vendor/activerecord/test/cases/validations_test.rb +1534 -0
  208. data/vendor/activerecord/test/cases/xml_serialization_test.rb +202 -0
  209. data/vendor/activerecord/test/config.rb +5 -0
  210. data/vendor/activerecord/test/connections/native_db2/connection.rb +25 -0
  211. data/vendor/activerecord/test/connections/native_firebird/connection.rb +26 -0
  212. data/vendor/activerecord/test/connections/native_frontbase/connection.rb +27 -0
  213. data/vendor/activerecord/test/connections/native_mysql/connection.rb +27 -0
  214. data/vendor/activerecord/test/connections/native_openbase/connection.rb +21 -0
  215. data/vendor/activerecord/test/connections/native_oracle/connection.rb +27 -0
  216. data/vendor/activerecord/test/connections/native_postgresql/connection.rb +21 -0
  217. data/vendor/activerecord/test/connections/native_sqlite/connection.rb +25 -0
  218. data/vendor/activerecord/test/connections/native_sqlite3/connection.rb +25 -0
  219. data/vendor/activerecord/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
  220. data/vendor/activerecord/test/connections/native_sybase/connection.rb +23 -0
  221. data/vendor/activerecord/test/debug.log +358 -0
  222. data/vendor/activerecord/test/fixtures/accounts.yml +28 -0
  223. data/vendor/activerecord/test/fixtures/all/developers.yml +0 -0
  224. data/vendor/activerecord/test/fixtures/all/people.csv +0 -0
  225. data/vendor/activerecord/test/fixtures/all/tasks.yml +0 -0
  226. data/vendor/activerecord/test/fixtures/author_addresses.yml +5 -0
  227. data/vendor/activerecord/test/fixtures/author_favorites.yml +4 -0
  228. data/vendor/activerecord/test/fixtures/authors.yml +9 -0
  229. data/vendor/activerecord/test/fixtures/binaries.yml +132 -0
  230. data/vendor/activerecord/test/fixtures/books.yml +7 -0
  231. data/vendor/activerecord/test/fixtures/categories/special_categories.yml +9 -0
  232. data/vendor/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
  233. data/vendor/activerecord/test/fixtures/categories.yml +14 -0
  234. data/vendor/activerecord/test/fixtures/categories_ordered.yml +7 -0
  235. data/vendor/activerecord/test/fixtures/categories_posts.yml +23 -0
  236. data/vendor/activerecord/test/fixtures/categorizations.yml +17 -0
  237. data/vendor/activerecord/test/fixtures/clubs.yml +6 -0
  238. data/vendor/activerecord/test/fixtures/comments.yml +59 -0
  239. data/vendor/activerecord/test/fixtures/companies.yml +55 -0
  240. data/vendor/activerecord/test/fixtures/computers.yml +4 -0
  241. data/vendor/activerecord/test/fixtures/courses.yml +7 -0
  242. data/vendor/activerecord/test/fixtures/customers.yml +17 -0
  243. data/vendor/activerecord/test/fixtures/developers.yml +21 -0
  244. data/vendor/activerecord/test/fixtures/developers_projects.yml +17 -0
  245. data/vendor/activerecord/test/fixtures/edges.yml +6 -0
  246. data/vendor/activerecord/test/fixtures/entrants.yml +14 -0
  247. data/vendor/activerecord/test/fixtures/fixture_database.sqlite3 +0 -0
  248. data/vendor/activerecord/test/fixtures/fixture_database_2.sqlite3 +0 -0
  249. data/vendor/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
  250. data/vendor/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
  251. data/vendor/activerecord/test/fixtures/funny_jokes.yml +10 -0
  252. data/vendor/activerecord/test/fixtures/items.yml +4 -0
  253. data/vendor/activerecord/test/fixtures/jobs.yml +7 -0
  254. data/vendor/activerecord/test/fixtures/legacy_things.yml +3 -0
  255. data/vendor/activerecord/test/fixtures/mateys.yml +4 -0
  256. data/vendor/activerecord/test/fixtures/members.yml +4 -0
  257. data/vendor/activerecord/test/fixtures/memberships.yml +20 -0
  258. data/vendor/activerecord/test/fixtures/minimalistics.yml +2 -0
  259. data/vendor/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
  260. data/vendor/activerecord/test/fixtures/mixins.yml +29 -0
  261. data/vendor/activerecord/test/fixtures/movies.yml +7 -0
  262. data/vendor/activerecord/test/fixtures/naked/csv/accounts.csv +1 -0
  263. data/vendor/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
  264. data/vendor/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
  265. data/vendor/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
  266. data/vendor/activerecord/test/fixtures/owners.yml +7 -0
  267. data/vendor/activerecord/test/fixtures/parrots.yml +27 -0
  268. data/vendor/activerecord/test/fixtures/parrots_pirates.yml +7 -0
  269. data/vendor/activerecord/test/fixtures/people.yml +6 -0
  270. data/vendor/activerecord/test/fixtures/pets.yml +14 -0
  271. data/vendor/activerecord/test/fixtures/pirates.yml +9 -0
  272. data/vendor/activerecord/test/fixtures/posts.yml +49 -0
  273. data/vendor/activerecord/test/fixtures/price_estimates.yml +7 -0
  274. data/vendor/activerecord/test/fixtures/projects.yml +7 -0
  275. data/vendor/activerecord/test/fixtures/readers.yml +9 -0
  276. data/vendor/activerecord/test/fixtures/references.yml +17 -0
  277. data/vendor/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
  278. data/vendor/activerecord/test/fixtures/reserved_words/distincts_selects.yml +11 -0
  279. data/vendor/activerecord/test/fixtures/reserved_words/group.yml +14 -0
  280. data/vendor/activerecord/test/fixtures/reserved_words/select.yml +8 -0
  281. data/vendor/activerecord/test/fixtures/reserved_words/values.yml +7 -0
  282. data/vendor/activerecord/test/fixtures/ships.yml +5 -0
  283. data/vendor/activerecord/test/fixtures/sponsors.yml +9 -0
  284. data/vendor/activerecord/test/fixtures/subscribers.yml +7 -0
  285. data/vendor/activerecord/test/fixtures/subscriptions.yml +12 -0
  286. data/vendor/activerecord/test/fixtures/taggings.yml +28 -0
  287. data/vendor/activerecord/test/fixtures/tags.yml +7 -0
  288. data/vendor/activerecord/test/fixtures/tasks.yml +7 -0
  289. data/vendor/activerecord/test/fixtures/topics.yml +42 -0
  290. data/vendor/activerecord/test/fixtures/treasures.yml +10 -0
  291. data/vendor/activerecord/test/fixtures/vertices.yml +4 -0
  292. data/vendor/activerecord/test/fixtures/warehouse-things.yml +3 -0
  293. data/vendor/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
  294. data/vendor/activerecord/test/migrations/duplicate/1_people_have_last_names.rb +9 -0
  295. data/vendor/activerecord/test/migrations/duplicate/2_we_need_reminders.rb +12 -0
  296. data/vendor/activerecord/test/migrations/duplicate/3_foo.rb +7 -0
  297. data/vendor/activerecord/test/migrations/duplicate/3_innocent_jointable.rb +12 -0
  298. data/vendor/activerecord/test/migrations/duplicate_names/20080507052938_chunky.rb +7 -0
  299. data/vendor/activerecord/test/migrations/duplicate_names/20080507053028_chunky.rb +7 -0
  300. data/vendor/activerecord/test/migrations/interleaved/pass_1/3_innocent_jointable.rb +12 -0
  301. data/vendor/activerecord/test/migrations/interleaved/pass_2/1_people_have_last_names.rb +9 -0
  302. data/vendor/activerecord/test/migrations/interleaved/pass_2/3_innocent_jointable.rb +12 -0
  303. data/vendor/activerecord/test/migrations/interleaved/pass_3/1_people_have_last_names.rb +9 -0
  304. data/vendor/activerecord/test/migrations/interleaved/pass_3/2_i_raise_on_down.rb +8 -0
  305. data/vendor/activerecord/test/migrations/interleaved/pass_3/3_innocent_jointable.rb +12 -0
  306. data/vendor/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
  307. data/vendor/activerecord/test/migrations/missing/1_people_have_last_names.rb +9 -0
  308. data/vendor/activerecord/test/migrations/missing/3_we_need_reminders.rb +12 -0
  309. data/vendor/activerecord/test/migrations/missing/4_innocent_jointable.rb +12 -0
  310. data/vendor/activerecord/test/migrations/valid/1_people_have_last_names.rb +9 -0
  311. data/vendor/activerecord/test/migrations/valid/2_we_need_reminders.rb +12 -0
  312. data/vendor/activerecord/test/migrations/valid/3_innocent_jointable.rb +12 -0
  313. data/vendor/activerecord/test/models/author.rb +137 -0
  314. data/vendor/activerecord/test/models/auto_id.rb +4 -0
  315. data/vendor/activerecord/test/models/binary.rb +2 -0
  316. data/vendor/activerecord/test/models/book.rb +4 -0
  317. data/vendor/activerecord/test/models/categorization.rb +5 -0
  318. data/vendor/activerecord/test/models/category.rb +30 -0
  319. data/vendor/activerecord/test/models/citation.rb +6 -0
  320. data/vendor/activerecord/test/models/club.rb +7 -0
  321. data/vendor/activerecord/test/models/column_name.rb +3 -0
  322. data/vendor/activerecord/test/models/comment.rb +25 -0
  323. data/vendor/activerecord/test/models/company.rb +132 -0
  324. data/vendor/activerecord/test/models/company_in_module.rb +61 -0
  325. data/vendor/activerecord/test/models/computer.rb +3 -0
  326. data/vendor/activerecord/test/models/contact.rb +16 -0
  327. data/vendor/activerecord/test/models/course.rb +3 -0
  328. data/vendor/activerecord/test/models/customer.rb +55 -0
  329. data/vendor/activerecord/test/models/default.rb +2 -0
  330. data/vendor/activerecord/test/models/developer.rb +79 -0
  331. data/vendor/activerecord/test/models/edge.rb +5 -0
  332. data/vendor/activerecord/test/models/entrant.rb +3 -0
  333. data/vendor/activerecord/test/models/guid.rb +2 -0
  334. data/vendor/activerecord/test/models/item.rb +7 -0
  335. data/vendor/activerecord/test/models/job.rb +5 -0
  336. data/vendor/activerecord/test/models/joke.rb +3 -0
  337. data/vendor/activerecord/test/models/keyboard.rb +3 -0
  338. data/vendor/activerecord/test/models/legacy_thing.rb +3 -0
  339. data/vendor/activerecord/test/models/matey.rb +4 -0
  340. data/vendor/activerecord/test/models/member.rb +9 -0
  341. data/vendor/activerecord/test/models/membership.rb +9 -0
  342. data/vendor/activerecord/test/models/minimalistic.rb +2 -0
  343. data/vendor/activerecord/test/models/mixed_case_monkey.rb +3 -0
  344. data/vendor/activerecord/test/models/movie.rb +5 -0
  345. data/vendor/activerecord/test/models/order.rb +4 -0
  346. data/vendor/activerecord/test/models/owner.rb +4 -0
  347. data/vendor/activerecord/test/models/parrot.rb +13 -0
  348. data/vendor/activerecord/test/models/person.rb +10 -0
  349. data/vendor/activerecord/test/models/pet.rb +4 -0
  350. data/vendor/activerecord/test/models/pirate.rb +9 -0
  351. data/vendor/activerecord/test/models/post.rb +85 -0
  352. data/vendor/activerecord/test/models/price_estimate.rb +3 -0
  353. data/vendor/activerecord/test/models/project.rb +29 -0
  354. data/vendor/activerecord/test/models/reader.rb +4 -0
  355. data/vendor/activerecord/test/models/reference.rb +4 -0
  356. data/vendor/activerecord/test/models/reply.rb +39 -0
  357. data/vendor/activerecord/test/models/ship.rb +3 -0
  358. data/vendor/activerecord/test/models/sponsor.rb +4 -0
  359. data/vendor/activerecord/test/models/subject.rb +4 -0
  360. data/vendor/activerecord/test/models/subscriber.rb +8 -0
  361. data/vendor/activerecord/test/models/subscription.rb +4 -0
  362. data/vendor/activerecord/test/models/tag.rb +7 -0
  363. data/vendor/activerecord/test/models/tagging.rb +10 -0
  364. data/vendor/activerecord/test/models/task.rb +3 -0
  365. data/vendor/activerecord/test/models/topic.rb +66 -0
  366. data/vendor/activerecord/test/models/treasure.rb +6 -0
  367. data/vendor/activerecord/test/models/vertex.rb +9 -0
  368. data/vendor/activerecord/test/models/warehouse_thing.rb +5 -0
  369. data/vendor/activerecord/test/schema/mysql_specific_schema.rb +12 -0
  370. data/vendor/activerecord/test/schema/postgresql_specific_schema.rb +103 -0
  371. data/vendor/activerecord/test/schema/schema.rb +429 -0
  372. data/vendor/activerecord/test/schema/schema2.rb +6 -0
  373. data/vendor/activerecord/test/schema/sqlite_specific_schema.rb +25 -0
  374. data/vendor/activerecord/test/schema/sqlserver_specific_schema.rb +5 -0
  375. data/vendor/activesupport/CHANGELOG +1193 -0
  376. data/vendor/activesupport/README +43 -0
  377. data/vendor/activesupport/lib/active_support/base64.rb +22 -0
  378. data/vendor/activesupport/lib/active_support/basic_object.rb +24 -0
  379. data/vendor/activesupport/lib/active_support/buffered_logger.rb +121 -0
  380. data/vendor/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb +15 -0
  381. data/vendor/activesupport/lib/active_support/cache/drb_store.rb +15 -0
  382. data/vendor/activesupport/lib/active_support/cache/file_store.rb +70 -0
  383. data/vendor/activesupport/lib/active_support/cache/mem_cache_store.rb +100 -0
  384. data/vendor/activesupport/lib/active_support/cache/memory_store.rb +38 -0
  385. data/vendor/activesupport/lib/active_support/cache.rb +147 -0
  386. data/vendor/activesupport/lib/active_support/callbacks.rb +275 -0
  387. data/vendor/activesupport/lib/active_support/clean_logger.rb +127 -0
  388. data/vendor/activesupport/lib/active_support/core_ext/array/access.rb +26 -0
  389. data/vendor/activesupport/lib/active_support/core_ext/array/conversions.rb +178 -0
  390. data/vendor/activesupport/lib/active_support/core_ext/array/extract_options.rb +20 -0
  391. data/vendor/activesupport/lib/active_support/core_ext/array/grouping.rb +63 -0
  392. data/vendor/activesupport/lib/active_support/core_ext/array/random_access.rb +12 -0
  393. data/vendor/activesupport/lib/active_support/core_ext/array.rb +13 -0
  394. data/vendor/activesupport/lib/active_support/core_ext/base64/encoding.rb +13 -0
  395. data/vendor/activesupport/lib/active_support/core_ext/base64.rb +4 -0
  396. data/vendor/activesupport/lib/active_support/core_ext/benchmark.rb +12 -0
  397. data/vendor/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb +41 -0
  398. data/vendor/activesupport/lib/active_support/core_ext/bigdecimal.rb +6 -0
  399. data/vendor/activesupport/lib/active_support/core_ext/blank.rb +53 -0
  400. data/vendor/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +14 -0
  401. data/vendor/activesupport/lib/active_support/core_ext/cgi.rb +5 -0
  402. data/vendor/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +54 -0
  403. data/vendor/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +46 -0
  404. data/vendor/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +140 -0
  405. data/vendor/activesupport/lib/active_support/core_ext/class/removal.rb +50 -0
  406. data/vendor/activesupport/lib/active_support/core_ext/class.rb +4 -0
  407. data/vendor/activesupport/lib/active_support/core_ext/date/behavior.rb +39 -0
  408. data/vendor/activesupport/lib/active_support/core_ext/date/calculations.rb +215 -0
  409. data/vendor/activesupport/lib/active_support/core_ext/date/conversions.rb +107 -0
  410. data/vendor/activesupport/lib/active_support/core_ext/date.rb +10 -0
  411. data/vendor/activesupport/lib/active_support/core_ext/date_time/calculations.rb +112 -0
  412. data/vendor/activesupport/lib/active_support/core_ext/date_time/conversions.rb +96 -0
  413. data/vendor/activesupport/lib/active_support/core_ext/date_time.rb +12 -0
  414. data/vendor/activesupport/lib/active_support/core_ext/duplicable.rb +37 -0
  415. data/vendor/activesupport/lib/active_support/core_ext/enumerable.rb +69 -0
  416. data/vendor/activesupport/lib/active_support/core_ext/exception.rb +41 -0
  417. data/vendor/activesupport/lib/active_support/core_ext/file.rb +21 -0
  418. data/vendor/activesupport/lib/active_support/core_ext/float/rounding.rb +24 -0
  419. data/vendor/activesupport/lib/active_support/core_ext/float.rb +5 -0
  420. data/vendor/activesupport/lib/active_support/core_ext/hash/conversions.rb +259 -0
  421. data/vendor/activesupport/lib/active_support/core_ext/hash/diff.rb +19 -0
  422. data/vendor/activesupport/lib/active_support/core_ext/hash/except.rb +25 -0
  423. data/vendor/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +137 -0
  424. data/vendor/activesupport/lib/active_support/core_ext/hash/keys.rb +52 -0
  425. data/vendor/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +28 -0
  426. data/vendor/activesupport/lib/active_support/core_ext/hash/slice.rb +30 -0
  427. data/vendor/activesupport/lib/active_support/core_ext/hash.rb +13 -0
  428. data/vendor/activesupport/lib/active_support/core_ext/integer/even_odd.rb +29 -0
  429. data/vendor/activesupport/lib/active_support/core_ext/integer/inflections.rb +20 -0
  430. data/vendor/activesupport/lib/active_support/core_ext/integer.rb +7 -0
  431. data/vendor/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
  432. data/vendor/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb +7 -0
  433. data/vendor/activesupport/lib/active_support/core_ext/kernel/debugger.rb +13 -0
  434. data/vendor/activesupport/lib/active_support/core_ext/kernel/reporting.rb +59 -0
  435. data/vendor/activesupport/lib/active_support/core_ext/kernel/requires.rb +24 -0
  436. data/vendor/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
  437. data/vendor/activesupport/lib/active_support/core_ext/load_error.rb +38 -0
  438. data/vendor/activesupport/lib/active_support/core_ext/logger.rb +16 -0
  439. data/vendor/activesupport/lib/active_support/core_ext/module/aliasing.rb +70 -0
  440. data/vendor/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
  441. data/vendor/activesupport/lib/active_support/core_ext/module/attr_internal.rb +32 -0
  442. data/vendor/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +58 -0
  443. data/vendor/activesupport/lib/active_support/core_ext/module/delegation.rb +64 -0
  444. data/vendor/activesupport/lib/active_support/core_ext/module/inclusion.rb +30 -0
  445. data/vendor/activesupport/lib/active_support/core_ext/module/introspection.rb +75 -0
  446. data/vendor/activesupport/lib/active_support/core_ext/module/loading.rb +23 -0
  447. data/vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb +22 -0
  448. data/vendor/activesupport/lib/active_support/core_ext/module.rb +13 -0
  449. data/vendor/activesupport/lib/active_support/core_ext/name_error.rb +17 -0
  450. data/vendor/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
  451. data/vendor/activesupport/lib/active_support/core_ext/numeric/conversions.rb +19 -0
  452. data/vendor/activesupport/lib/active_support/core_ext/numeric/time.rb +91 -0
  453. data/vendor/activesupport/lib/active_support/core_ext/numeric.rb +9 -0
  454. data/vendor/activesupport/lib/active_support/core_ext/object/conversions.rb +14 -0
  455. data/vendor/activesupport/lib/active_support/core_ext/object/extending.rb +59 -0
  456. data/vendor/activesupport/lib/active_support/core_ext/object/instance_variables.rb +74 -0
  457. data/vendor/activesupport/lib/active_support/core_ext/object/misc.rb +59 -0
  458. data/vendor/activesupport/lib/active_support/core_ext/object.rb +4 -0
  459. data/vendor/activesupport/lib/active_support/core_ext/pathname/clean_within.rb +14 -0
  460. data/vendor/activesupport/lib/active_support/core_ext/pathname.rb +7 -0
  461. data/vendor/activesupport/lib/active_support/core_ext/proc.rb +12 -0
  462. data/vendor/activesupport/lib/active_support/core_ext/process/daemon.rb +25 -0
  463. data/vendor/activesupport/lib/active_support/core_ext/process.rb +1 -0
  464. data/vendor/activesupport/lib/active_support/core_ext/range/blockless_step.rb +32 -0
  465. data/vendor/activesupport/lib/active_support/core_ext/range/conversions.rb +27 -0
  466. data/vendor/activesupport/lib/active_support/core_ext/range/include_range.rb +30 -0
  467. data/vendor/activesupport/lib/active_support/core_ext/range/overlaps.rb +15 -0
  468. data/vendor/activesupport/lib/active_support/core_ext/range.rb +11 -0
  469. data/vendor/activesupport/lib/active_support/core_ext/rexml.rb +35 -0
  470. data/vendor/activesupport/lib/active_support/core_ext/string/access.rb +82 -0
  471. data/vendor/activesupport/lib/active_support/core_ext/string/conversions.rb +28 -0
  472. data/vendor/activesupport/lib/active_support/core_ext/string/filters.rb +26 -0
  473. data/vendor/activesupport/lib/active_support/core_ext/string/inflections.rb +148 -0
  474. data/vendor/activesupport/lib/active_support/core_ext/string/iterators.rb +21 -0
  475. data/vendor/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +35 -0
  476. data/vendor/activesupport/lib/active_support/core_ext/string/unicode.rb +66 -0
  477. data/vendor/activesupport/lib/active_support/core_ext/string/xchar.rb +11 -0
  478. data/vendor/activesupport/lib/active_support/core_ext/string.rb +18 -0
  479. data/vendor/activesupport/lib/active_support/core_ext/symbol.rb +14 -0
  480. data/vendor/activesupport/lib/active_support/core_ext/test/unit/assertions.rb +64 -0
  481. data/vendor/activesupport/lib/active_support/core_ext/test.rb +1 -0
  482. data/vendor/activesupport/lib/active_support/core_ext/time/behavior.rb +13 -0
  483. data/vendor/activesupport/lib/active_support/core_ext/time/calculations.rb +276 -0
  484. data/vendor/activesupport/lib/active_support/core_ext/time/conversions.rb +89 -0
  485. data/vendor/activesupport/lib/active_support/core_ext/time/zones.rb +86 -0
  486. data/vendor/activesupport/lib/active_support/core_ext/time.rb +42 -0
  487. data/vendor/activesupport/lib/active_support/core_ext.rb +4 -0
  488. data/vendor/activesupport/lib/active_support/dependencies.rb +553 -0
  489. data/vendor/activesupport/lib/active_support/deprecation.rb +223 -0
  490. data/vendor/activesupport/lib/active_support/duration.rb +96 -0
  491. data/vendor/activesupport/lib/active_support/gzip.rb +25 -0
  492. data/vendor/activesupport/lib/active_support/inflections.rb +55 -0
  493. data/vendor/activesupport/lib/active_support/inflector.rb +313 -0
  494. data/vendor/activesupport/lib/active_support/json/decoding.rb +63 -0
  495. data/vendor/activesupport/lib/active_support/json/encoders/date.rb +14 -0
  496. data/vendor/activesupport/lib/active_support/json/encoders/date_time.rb +14 -0
  497. data/vendor/activesupport/lib/active_support/json/encoders/enumerable.rb +12 -0
  498. data/vendor/activesupport/lib/active_support/json/encoders/false_class.rb +5 -0
  499. data/vendor/activesupport/lib/active_support/json/encoders/hash.rb +47 -0
  500. data/vendor/activesupport/lib/active_support/json/encoders/nil_class.rb +5 -0
  501. data/vendor/activesupport/lib/active_support/json/encoders/numeric.rb +5 -0
  502. data/vendor/activesupport/lib/active_support/json/encoders/object.rb +6 -0
  503. data/vendor/activesupport/lib/active_support/json/encoders/regexp.rb +5 -0
  504. data/vendor/activesupport/lib/active_support/json/encoders/string.rb +36 -0
  505. data/vendor/activesupport/lib/active_support/json/encoders/symbol.rb +5 -0
  506. data/vendor/activesupport/lib/active_support/json/encoders/time.rb +14 -0
  507. data/vendor/activesupport/lib/active_support/json/encoders/true_class.rb +5 -0
  508. data/vendor/activesupport/lib/active_support/json/encoding.rb +37 -0
  509. data/vendor/activesupport/lib/active_support/json/variable.rb +10 -0
  510. data/vendor/activesupport/lib/active_support/json.rb +23 -0
  511. data/vendor/activesupport/lib/active_support/multibyte/chars.rb +137 -0
  512. data/vendor/activesupport/lib/active_support/multibyte/generators/generate_tables.rb +149 -0
  513. data/vendor/activesupport/lib/active_support/multibyte/handlers/passthru_handler.rb +9 -0
  514. data/vendor/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb +564 -0
  515. data/vendor/activesupport/lib/active_support/multibyte/handlers/utf8_handler_proc.rb +43 -0
  516. data/vendor/activesupport/lib/active_support/multibyte.rb +9 -0
  517. data/vendor/activesupport/lib/active_support/option_merger.rb +25 -0
  518. data/vendor/activesupport/lib/active_support/ordered_hash.rb +43 -0
  519. data/vendor/activesupport/lib/active_support/ordered_options.rb +19 -0
  520. data/vendor/activesupport/lib/active_support/string_inquirer.rb +11 -0
  521. data/vendor/activesupport/lib/active_support/test_case.rb +13 -0
  522. data/vendor/activesupport/lib/active_support/testing/default.rb +9 -0
  523. data/vendor/activesupport/lib/active_support/testing/setup_and_teardown.rb +93 -0
  524. data/vendor/activesupport/lib/active_support/time_with_zone.rb +304 -0
  525. data/vendor/activesupport/lib/active_support/values/time_zone.rb +396 -0
  526. data/vendor/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
  527. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb +113 -0
  528. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +20 -0
  529. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/css.rb +250 -0
  530. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +115 -0
  531. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +139 -0
  532. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +63 -0
  533. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +328 -0
  534. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder.rb +13 -0
  535. data/vendor/activesupport/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb +849 -0
  536. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone.rb +47 -0
  537. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone_info.rb +228 -0
  538. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Africa/Algiers.rb +55 -0
  539. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Africa/Cairo.rb +219 -0
  540. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Africa/Casablanca.rb +40 -0
  541. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Africa/Harare.rb +18 -0
  542. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
  543. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Africa/Monrovia.rb +22 -0
  544. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Africa/Nairobi.rb +23 -0
  545. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
  546. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Argentina/San_Juan.rb +170 -0
  547. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Bogota.rb +23 -0
  548. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Caracas.rb +23 -0
  549. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Chicago.rb +283 -0
  550. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Chihuahua.rb +136 -0
  551. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Denver.rb +204 -0
  552. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Godthab.rb +161 -0
  553. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Guatemala.rb +27 -0
  554. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Halifax.rb +274 -0
  555. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
  556. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Juneau.rb +194 -0
  557. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/La_Paz.rb +22 -0
  558. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Lima.rb +35 -0
  559. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Los_Angeles.rb +232 -0
  560. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Mazatlan.rb +139 -0
  561. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Mexico_City.rb +144 -0
  562. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Monterrey.rb +131 -0
  563. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/New_York.rb +282 -0
  564. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Phoenix.rb +30 -0
  565. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Regina.rb +74 -0
  566. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Santiago.rb +205 -0
  567. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/St_Johns.rb +288 -0
  568. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/America/Tijuana.rb +196 -0
  569. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Almaty.rb +67 -0
  570. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Baghdad.rb +73 -0
  571. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Baku.rb +161 -0
  572. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Bangkok.rb +20 -0
  573. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Chongqing.rb +33 -0
  574. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Dhaka.rb +27 -0
  575. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
  576. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
  577. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Jakarta.rb +30 -0
  578. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
  579. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Kabul.rb +20 -0
  580. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
  581. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Karachi.rb +30 -0
  582. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Katmandu.rb +20 -0
  583. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Kolkata.rb +25 -0
  584. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
  585. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
  586. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Kuwait.rb +18 -0
  587. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Magadan.rb +163 -0
  588. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Muscat.rb +18 -0
  589. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
  590. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Rangoon.rb +24 -0
  591. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Riyadh.rb +18 -0
  592. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Seoul.rb +34 -0
  593. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Shanghai.rb +35 -0
  594. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Singapore.rb +33 -0
  595. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Taipei.rb +59 -0
  596. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Tashkent.rb +47 -0
  597. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
  598. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Tehran.rb +121 -0
  599. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Tokyo.rb +30 -0
  600. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
  601. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Urumqi.rb +33 -0
  602. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
  603. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
  604. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
  605. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Asia/Yerevan.rb +165 -0
  606. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Atlantic/Azores.rb +270 -0
  607. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
  608. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
  609. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Australia/Adelaide.rb +187 -0
  610. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Australia/Brisbane.rb +35 -0
  611. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Australia/Darwin.rb +29 -0
  612. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Australia/Hobart.rb +193 -0
  613. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Australia/Melbourne.rb +185 -0
  614. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Australia/Perth.rb +37 -0
  615. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Australia/Sydney.rb +185 -0
  616. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Etc/UTC.rb +16 -0
  617. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
  618. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Athens.rb +185 -0
  619. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Belgrade.rb +163 -0
  620. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Berlin.rb +188 -0
  621. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Bratislava.rb +13 -0
  622. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Brussels.rb +232 -0
  623. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Bucharest.rb +181 -0
  624. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Budapest.rb +197 -0
  625. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
  626. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Dublin.rb +276 -0
  627. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Helsinki.rb +163 -0
  628. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Istanbul.rb +218 -0
  629. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Kiev.rb +168 -0
  630. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Lisbon.rb +268 -0
  631. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
  632. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/London.rb +288 -0
  633. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Madrid.rb +211 -0
  634. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Minsk.rb +170 -0
  635. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Moscow.rb +181 -0
  636. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Paris.rb +232 -0
  637. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Prague.rb +187 -0
  638. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Riga.rb +176 -0
  639. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Rome.rb +215 -0
  640. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
  641. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Skopje.rb +13 -0
  642. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Sofia.rb +173 -0
  643. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Stockholm.rb +165 -0
  644. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Tallinn.rb +172 -0
  645. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Vienna.rb +183 -0
  646. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Vilnius.rb +170 -0
  647. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Warsaw.rb +212 -0
  648. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Europe/Zagreb.rb +13 -0
  649. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Auckland.rb +202 -0
  650. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Fiji.rb +23 -0
  651. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Guam.rb +22 -0
  652. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
  653. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Majuro.rb +20 -0
  654. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Midway.rb +25 -0
  655. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Noumea.rb +25 -0
  656. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
  657. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
  658. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
  659. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/info_timezone.rb +52 -0
  660. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/linked_timezone.rb +51 -0
  661. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/linked_timezone_info.rb +44 -0
  662. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/offset_rationals.rb +95 -0
  663. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/time_or_datetime.rb +292 -0
  664. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone.rb +508 -0
  665. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_definition.rb +56 -0
  666. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_info.rb +40 -0
  667. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_offset_info.rb +94 -0
  668. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_period.rb +198 -0
  669. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_transition_info.rb +138 -0
  670. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo.rb +33 -0
  671. data/vendor/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +1021 -0
  672. data/vendor/activesupport/lib/active_support/vendor.rb +26 -0
  673. data/vendor/activesupport/lib/active_support/version.rb +9 -0
  674. data/vendor/activesupport/lib/active_support/whiny_nil.rb +58 -0
  675. data/vendor/activesupport/lib/active_support.rb +61 -0
  676. data/vendor/activesupport/lib/activesupport.rb +1 -0
  677. data/vendor/isaac/LICENSE +26 -0
  678. data/vendor/isaac/README +78 -0
  679. data/vendor/isaac/TODO +3 -0
  680. data/vendor/isaac/VERSIONS +3 -0
  681. data/vendor/isaac/crypt/ISAAC.rb +171 -0
  682. data/vendor/isaac/isaac.gemspec +39 -0
  683. data/vendor/isaac/setup.rb +596 -0
  684. data/vendor/isaac/test/TC_ISAAC.rb +76 -0
  685. data/vendor/json/CHANGES +93 -0
  686. data/vendor/json/GPL +340 -0
  687. data/vendor/json/README +78 -0
  688. data/vendor/json/RUBY +58 -0
  689. data/vendor/json/Rakefile +309 -0
  690. data/vendor/json/TODO +1 -0
  691. data/vendor/json/VERSION +1 -0
  692. data/vendor/json/benchmarks/benchmark.txt +133 -0
  693. data/vendor/json/benchmarks/benchmark_generator.rb +48 -0
  694. data/vendor/json/benchmarks/benchmark_parser.rb +26 -0
  695. data/vendor/json/benchmarks/benchmark_rails.rb +26 -0
  696. data/vendor/json/bin/edit_json.rb +10 -0
  697. data/vendor/json/bin/prettify_json.rb +76 -0
  698. data/vendor/json/data/example.json +1 -0
  699. data/vendor/json/data/index.html +38 -0
  700. data/vendor/json/data/prototype.js +4184 -0
  701. data/vendor/json/ext/json/ext/generator/extconf.rb +9 -0
  702. data/vendor/json/ext/json/ext/generator/generator.c +875 -0
  703. data/vendor/json/ext/json/ext/generator/unicode.c +182 -0
  704. data/vendor/json/ext/json/ext/generator/unicode.h +53 -0
  705. data/vendor/json/ext/json/ext/parser/extconf.rb +9 -0
  706. data/vendor/json/ext/json/ext/parser/parser.c +1758 -0
  707. data/vendor/json/ext/json/ext/parser/parser.rl +638 -0
  708. data/vendor/json/ext/json/ext/parser/unicode.c +154 -0
  709. data/vendor/json/ext/json/ext/parser/unicode.h +58 -0
  710. data/vendor/json/install.rb +26 -0
  711. data/vendor/json/lib/json/Array.xpm +21 -0
  712. data/vendor/json/lib/json/FalseClass.xpm +21 -0
  713. data/vendor/json/lib/json/Hash.xpm +21 -0
  714. data/vendor/json/lib/json/Key.xpm +73 -0
  715. data/vendor/json/lib/json/NilClass.xpm +21 -0
  716. data/vendor/json/lib/json/Numeric.xpm +28 -0
  717. data/vendor/json/lib/json/String.xpm +96 -0
  718. data/vendor/json/lib/json/TrueClass.xpm +21 -0
  719. data/vendor/json/lib/json/add/core.rb +135 -0
  720. data/vendor/json/lib/json/add/rails.rb +58 -0
  721. data/vendor/json/lib/json/common.rb +354 -0
  722. data/vendor/json/lib/json/editor.rb +1362 -0
  723. data/vendor/json/lib/json/ext.rb +13 -0
  724. data/vendor/json/lib/json/json.xpm +1499 -0
  725. data/vendor/json/lib/json/pure/generator.rb +394 -0
  726. data/vendor/json/lib/json/pure/parser.rb +259 -0
  727. data/vendor/json/lib/json/pure.rb +75 -0
  728. data/vendor/json/lib/json/version.rb +9 -0
  729. data/vendor/json/lib/json.rb +235 -0
  730. data/vendor/json/tests/fixtures/fail1.json +1 -0
  731. data/vendor/json/tests/fixtures/fail10.json +1 -0
  732. data/vendor/json/tests/fixtures/fail11.json +1 -0
  733. data/vendor/json/tests/fixtures/fail12.json +1 -0
  734. data/vendor/json/tests/fixtures/fail13.json +1 -0
  735. data/vendor/json/tests/fixtures/fail14.json +1 -0
  736. data/vendor/json/tests/fixtures/fail18.json +1 -0
  737. data/vendor/json/tests/fixtures/fail19.json +1 -0
  738. data/vendor/json/tests/fixtures/fail2.json +1 -0
  739. data/vendor/json/tests/fixtures/fail20.json +1 -0
  740. data/vendor/json/tests/fixtures/fail21.json +1 -0
  741. data/vendor/json/tests/fixtures/fail22.json +1 -0
  742. data/vendor/json/tests/fixtures/fail23.json +1 -0
  743. data/vendor/json/tests/fixtures/fail24.json +1 -0
  744. data/vendor/json/tests/fixtures/fail25.json +1 -0
  745. data/vendor/json/tests/fixtures/fail27.json +2 -0
  746. data/vendor/json/tests/fixtures/fail28.json +2 -0
  747. data/vendor/json/tests/fixtures/fail3.json +1 -0
  748. data/vendor/json/tests/fixtures/fail4.json +1 -0
  749. data/vendor/json/tests/fixtures/fail5.json +1 -0
  750. data/vendor/json/tests/fixtures/fail6.json +1 -0
  751. data/vendor/json/tests/fixtures/fail7.json +1 -0
  752. data/vendor/json/tests/fixtures/fail8.json +1 -0
  753. data/vendor/json/tests/fixtures/fail9.json +1 -0
  754. data/vendor/json/tests/fixtures/pass1.json +56 -0
  755. data/vendor/json/tests/fixtures/pass15.json +1 -0
  756. data/vendor/json/tests/fixtures/pass16.json +1 -0
  757. data/vendor/json/tests/fixtures/pass17.json +1 -0
  758. data/vendor/json/tests/fixtures/pass2.json +1 -0
  759. data/vendor/json/tests/fixtures/pass26.json +1 -0
  760. data/vendor/json/tests/fixtures/pass3.json +6 -0
  761. data/vendor/json/tests/runner.rb +25 -0
  762. data/vendor/json/tests/test_json.rb +293 -0
  763. data/vendor/json/tests/test_json_addition.rb +161 -0
  764. data/vendor/json/tests/test_json_fixtures.rb +30 -0
  765. data/vendor/json/tests/test_json_generate.rb +100 -0
  766. data/vendor/json/tests/test_json_rails.rb +118 -0
  767. data/vendor/json/tests/test_json_unicode.rb +61 -0
  768. data/vendor/json/tools/fuzz.rb +140 -0
  769. data/vendor/json/tools/server.rb +62 -0
  770. data/vendor/rack/AUTHORS +8 -0
  771. data/vendor/rack/COPYING +18 -0
  772. data/vendor/rack/KNOWN-ISSUES +18 -0
  773. data/vendor/rack/RDOX +265 -0
  774. data/vendor/rack/README +287 -0
  775. data/vendor/rack/Rakefile +179 -0
  776. data/vendor/rack/SPEC +126 -0
  777. data/vendor/rack/bin/rackup +172 -0
  778. data/vendor/rack/contrib/rack_logo.svg +111 -0
  779. data/vendor/rack/example/lobster.ru +4 -0
  780. data/vendor/rack/example/protectedlobster.rb +14 -0
  781. data/vendor/rack/example/protectedlobster.ru +8 -0
  782. data/vendor/rack/lib/rack/adapter/camping.rb +22 -0
  783. data/vendor/rack/lib/rack/auth/abstract/handler.rb +28 -0
  784. data/vendor/rack/lib/rack/auth/abstract/request.rb +37 -0
  785. data/vendor/rack/lib/rack/auth/basic.rb +58 -0
  786. data/vendor/rack/lib/rack/auth/digest/md5.rb +124 -0
  787. data/vendor/rack/lib/rack/auth/digest/nonce.rb +51 -0
  788. data/vendor/rack/lib/rack/auth/digest/params.rb +55 -0
  789. data/vendor/rack/lib/rack/auth/digest/request.rb +40 -0
  790. data/vendor/rack/lib/rack/auth/openid.rb +437 -0
  791. data/vendor/rack/lib/rack/builder.rb +56 -0
  792. data/vendor/rack/lib/rack/cascade.rb +36 -0
  793. data/vendor/rack/lib/rack/commonlogger.rb +61 -0
  794. data/vendor/rack/lib/rack/deflater.rb +63 -0
  795. data/vendor/rack/lib/rack/directory.rb +158 -0
  796. data/vendor/rack/lib/rack/file.rb +116 -0
  797. data/vendor/rack/lib/rack/handler/cgi.rb +57 -0
  798. data/vendor/rack/lib/rack/handler/evented_mongrel.rb +8 -0
  799. data/vendor/rack/lib/rack/handler/fastcgi.rb +84 -0
  800. data/vendor/rack/lib/rack/handler/lsws.rb +52 -0
  801. data/vendor/rack/lib/rack/handler/mongrel.rb +78 -0
  802. data/vendor/rack/lib/rack/handler/scgi.rb +57 -0
  803. data/vendor/rack/lib/rack/handler/webrick.rb +57 -0
  804. data/vendor/rack/lib/rack/handler.rb +44 -0
  805. data/vendor/rack/lib/rack/lint.rb +401 -0
  806. data/vendor/rack/lib/rack/lobster.rb +65 -0
  807. data/vendor/rack/lib/rack/mock.rb +160 -0
  808. data/vendor/rack/lib/rack/recursive.rb +57 -0
  809. data/vendor/rack/lib/rack/reloader.rb +64 -0
  810. data/vendor/rack/lib/rack/request.rb +209 -0
  811. data/vendor/rack/lib/rack/response.rb +166 -0
  812. data/vendor/rack/lib/rack/session/abstract/id.rb +140 -0
  813. data/vendor/rack/lib/rack/session/cookie.rb +71 -0
  814. data/vendor/rack/lib/rack/session/memcache.rb +97 -0
  815. data/vendor/rack/lib/rack/session/pool.rb +73 -0
  816. data/vendor/rack/lib/rack/showexceptions.rb +344 -0
  817. data/vendor/rack/lib/rack/showstatus.rb +105 -0
  818. data/vendor/rack/lib/rack/static.rb +38 -0
  819. data/vendor/rack/lib/rack/urlmap.rb +48 -0
  820. data/vendor/rack/lib/rack/utils.rb +318 -0
  821. data/vendor/rack/lib/rack.rb +81 -0
  822. data/vendor/rack/test/cgi/lighttpd.conf +20 -0
  823. data/vendor/rack/test/cgi/test +9 -0
  824. data/vendor/rack/test/cgi/test.fcgi +8 -0
  825. data/vendor/rack/test/cgi/test.ru +7 -0
  826. data/vendor/rack/test/spec_rack_auth_basic.rb +69 -0
  827. data/vendor/rack/test/spec_rack_auth_digest.rb +169 -0
  828. data/vendor/rack/test/spec_rack_auth_openid.rb +137 -0
  829. data/vendor/rack/test/spec_rack_builder.rb +50 -0
  830. data/vendor/rack/test/spec_rack_camping.rb +51 -0
  831. data/vendor/rack/test/spec_rack_cascade.rb +50 -0
  832. data/vendor/rack/test/spec_rack_cgi.rb +89 -0
  833. data/vendor/rack/test/spec_rack_commonlogger.rb +32 -0
  834. data/vendor/rack/test/spec_rack_deflater.rb +70 -0
  835. data/vendor/rack/test/spec_rack_directory.rb +56 -0
  836. data/vendor/rack/test/spec_rack_fastcgi.rb +89 -0
  837. data/vendor/rack/test/spec_rack_file.rb +50 -0
  838. data/vendor/rack/test/spec_rack_handler.rb +24 -0
  839. data/vendor/rack/test/spec_rack_lint.rb +303 -0
  840. data/vendor/rack/test/spec_rack_lobster.rb +45 -0
  841. data/vendor/rack/test/spec_rack_mock.rb +152 -0
  842. data/vendor/rack/test/spec_rack_mongrel.rb +170 -0
  843. data/vendor/rack/test/spec_rack_recursive.rb +77 -0
  844. data/vendor/rack/test/spec_rack_request.rb +401 -0
  845. data/vendor/rack/test/spec_rack_response.rb +167 -0
  846. data/vendor/rack/test/spec_rack_session_cookie.rb +49 -0
  847. data/vendor/rack/test/spec_rack_session_memcache.rb +132 -0
  848. data/vendor/rack/test/spec_rack_session_pool.rb +84 -0
  849. data/vendor/rack/test/spec_rack_showexceptions.rb +21 -0
  850. data/vendor/rack/test/spec_rack_showstatus.rb +72 -0
  851. data/vendor/rack/test/spec_rack_static.rb +37 -0
  852. data/vendor/rack/test/spec_rack_urlmap.rb +175 -0
  853. data/vendor/rack/test/spec_rack_utils.rb +174 -0
  854. data/vendor/rack/test/spec_rack_webrick.rb +106 -0
  855. data/vendor/rack/test/testrequest.rb +45 -0
  856. data/vendor/sinatra/CHANGELOG +64 -0
  857. data/vendor/sinatra/LICENSE +22 -0
  858. data/vendor/sinatra/README.rdoc +533 -0
  859. data/vendor/sinatra/Rakefile +111 -0
  860. data/vendor/sinatra/images/404.png +0 -0
  861. data/vendor/sinatra/images/500.png +0 -0
  862. data/vendor/sinatra/lib/sinatra/rack/handler/mongrel.rb +85 -0
  863. data/vendor/sinatra/lib/sinatra/test/methods.rb +76 -0
  864. data/vendor/sinatra/lib/sinatra/test/rspec.rb +10 -0
  865. data/vendor/sinatra/lib/sinatra/test/spec.rb +10 -0
  866. data/vendor/sinatra/lib/sinatra/test/unit.rb +13 -0
  867. data/vendor/sinatra/lib/sinatra.rb +1477 -0
  868. data/vendor/sinatra/sinatra.gemspec +78 -0
  869. data/vendor/sinatra/test/app_test.rb +299 -0
  870. data/vendor/sinatra/test/application_test.rb +318 -0
  871. data/vendor/sinatra/test/builder_test.rb +101 -0
  872. data/vendor/sinatra/test/custom_error_test.rb +62 -0
  873. data/vendor/sinatra/test/erb_test.rb +136 -0
  874. data/vendor/sinatra/test/event_context_test.rb +15 -0
  875. data/vendor/sinatra/test/events_test.rb +47 -0
  876. data/vendor/sinatra/test/filter_test.rb +30 -0
  877. data/vendor/sinatra/test/haml_test.rb +233 -0
  878. data/vendor/sinatra/test/helper.rb +7 -0
  879. data/vendor/sinatra/test/mapped_error_test.rb +72 -0
  880. data/vendor/sinatra/test/pipeline_test.rb +66 -0
  881. data/vendor/sinatra/test/public/foo.xml +1 -0
  882. data/vendor/sinatra/test/sass_test.rb +57 -0
  883. data/vendor/sinatra/test/sessions_test.rb +39 -0
  884. data/vendor/sinatra/test/streaming_test.rb +118 -0
  885. data/vendor/sinatra/test/sym_params_test.rb +19 -0
  886. data/vendor/sinatra/test/template_test.rb +30 -0
  887. data/vendor/sinatra/test/use_in_file_templates_test.rb +47 -0
  888. data/vendor/sinatra/test/views/foo.builder +1 -0
  889. data/vendor/sinatra/test/views/foo.erb +1 -0
  890. data/vendor/sinatra/test/views/foo.haml +1 -0
  891. data/vendor/sinatra/test/views/foo.sass +2 -0
  892. data/vendor/sinatra/test/views/foo_layout.erb +2 -0
  893. data/vendor/sinatra/test/views/foo_layout.haml +2 -0
  894. data/vendor/sinatra/test/views/layout_test/foo.builder +1 -0
  895. data/vendor/sinatra/test/views/layout_test/foo.erb +1 -0
  896. data/vendor/sinatra/test/views/layout_test/foo.haml +1 -0
  897. data/vendor/sinatra/test/views/layout_test/foo.sass +2 -0
  898. data/vendor/sinatra/test/views/layout_test/layout.builder +3 -0
  899. data/vendor/sinatra/test/views/layout_test/layout.erb +1 -0
  900. data/vendor/sinatra/test/views/layout_test/layout.haml +1 -0
  901. data/vendor/sinatra/test/views/layout_test/layout.sass +2 -0
  902. data/vendor/sinatra/test/views/no_layout/no_layout.builder +1 -0
  903. data/vendor/sinatra/test/views/no_layout/no_layout.haml +1 -0
  904. metadata +1121 -0
@@ -0,0 +1,1444 @@
1
+ require "cases/helper"
2
+ require 'bigdecimal/util'
3
+
4
+ require 'models/person'
5
+ require 'models/topic'
6
+ require 'models/developer'
7
+
8
+ require MIGRATIONS_ROOT + "/valid/1_people_have_last_names"
9
+ require MIGRATIONS_ROOT + "/valid/2_we_need_reminders"
10
+ require MIGRATIONS_ROOT + "/decimal/1_give_me_big_numbers"
11
+ require MIGRATIONS_ROOT + "/interleaved/pass_3/2_i_raise_on_down"
12
+
13
+ if ActiveRecord::Base.connection.supports_migrations?
14
+ class BigNumber < ActiveRecord::Base; end
15
+
16
+ class Reminder < ActiveRecord::Base; end
17
+
18
+ class ActiveRecord::Migration
19
+ class <<self
20
+ attr_accessor :message_count
21
+ def puts(text="")
22
+ self.message_count ||= 0
23
+ self.message_count += 1
24
+ end
25
+ end
26
+ end
27
+
28
+ class MigrationTest < ActiveRecord::TestCase
29
+ self.use_transactional_fixtures = false
30
+
31
+ fixtures :people
32
+
33
+ def setup
34
+ ActiveRecord::Migration.verbose = true
35
+ PeopleHaveLastNames.message_count = 0
36
+ end
37
+
38
+ def teardown
39
+ ActiveRecord::Base.connection.initialize_schema_migrations_table
40
+ ActiveRecord::Base.connection.execute "DELETE FROM #{ActiveRecord::Migrator.schema_migrations_table_name}"
41
+
42
+ %w(reminders people_reminders prefix_reminders_suffix).each do |table|
43
+ Reminder.connection.drop_table(table) rescue nil
44
+ end
45
+ Reminder.reset_column_information
46
+
47
+ %w(last_name key bio age height wealth birthday favorite_day
48
+ moment_of_truth male administrator funny).each do |column|
49
+ Person.connection.remove_column('people', column) rescue nil
50
+ end
51
+ Person.connection.remove_column("people", "first_name") rescue nil
52
+ Person.connection.remove_column("people", "middle_name") rescue nil
53
+ Person.connection.add_column("people", "first_name", :string, :limit => 40)
54
+ Person.reset_column_information
55
+ end
56
+
57
+ def test_add_index
58
+ # Limit size of last_name and key columns to support Firebird index limitations
59
+ Person.connection.add_column "people", "last_name", :string, :limit => 100
60
+ Person.connection.add_column "people", "key", :string, :limit => 100
61
+ Person.connection.add_column "people", "administrator", :boolean
62
+
63
+ assert_nothing_raised { Person.connection.add_index("people", "last_name") }
64
+ assert_nothing_raised { Person.connection.remove_index("people", "last_name") }
65
+
66
+ # Orcl nds shrt indx nms. Sybs 2.
67
+ # OpenBase does not have named indexes. You must specify a single column name
68
+ unless current_adapter?(:OracleAdapter, :SybaseAdapter, :OpenBaseAdapter)
69
+ assert_nothing_raised { Person.connection.add_index("people", ["last_name", "first_name"]) }
70
+ assert_nothing_raised { Person.connection.remove_index("people", :column => ["last_name", "first_name"]) }
71
+ assert_nothing_raised { Person.connection.add_index("people", ["last_name", "first_name"]) }
72
+ assert_nothing_raised { Person.connection.remove_index("people", :name => "index_people_on_last_name_and_first_name") }
73
+ assert_nothing_raised { Person.connection.add_index("people", ["last_name", "first_name"]) }
74
+ assert_nothing_raised { Person.connection.remove_index("people", "last_name_and_first_name") }
75
+ assert_nothing_raised { Person.connection.add_index("people", ["last_name", "first_name"]) }
76
+ assert_nothing_raised { Person.connection.remove_index("people", ["last_name", "first_name"]) }
77
+ end
78
+
79
+ # quoting
80
+ # Note: changed index name from "key" to "key_idx" since "key" is a Firebird reserved word
81
+ # OpenBase does not have named indexes. You must specify a single column name
82
+ unless current_adapter?(:OpenBaseAdapter)
83
+ Person.update_all "#{Person.connection.quote_column_name 'key'}=#{Person.connection.quote_column_name 'id'}" #some databases (including sqlite2 won't add a unique index if existing data non unique)
84
+ assert_nothing_raised { Person.connection.add_index("people", ["key"], :name => "key_idx", :unique => true) }
85
+ assert_nothing_raised { Person.connection.remove_index("people", :name => "key_idx", :unique => true) }
86
+ end
87
+
88
+ # Sybase adapter does not support indexes on :boolean columns
89
+ # OpenBase does not have named indexes. You must specify a single column
90
+ unless current_adapter?(:SybaseAdapter, :OpenBaseAdapter)
91
+ assert_nothing_raised { Person.connection.add_index("people", %w(last_name first_name administrator), :name => "named_admin") }
92
+ assert_nothing_raised { Person.connection.remove_index("people", :name => "named_admin") }
93
+ end
94
+ end
95
+
96
+ def test_create_table_adds_id
97
+ Person.connection.create_table :testings do |t|
98
+ t.column :foo, :string
99
+ end
100
+
101
+ assert_equal %w(foo id),
102
+ Person.connection.columns(:testings).map { |c| c.name }.sort
103
+ ensure
104
+ Person.connection.drop_table :testings rescue nil
105
+ end
106
+
107
+ def test_create_table_with_not_null_column
108
+ assert_nothing_raised do
109
+ Person.connection.create_table :testings do |t|
110
+ t.column :foo, :string, :null => false
111
+ end
112
+ end
113
+
114
+ assert_raises(ActiveRecord::StatementInvalid) do
115
+ Person.connection.execute "insert into testings (foo) values (NULL)"
116
+ end
117
+ ensure
118
+ Person.connection.drop_table :testings rescue nil
119
+ end
120
+
121
+ def test_create_table_with_defaults
122
+ # MySQL doesn't allow defaults on TEXT or BLOB columns.
123
+ mysql = current_adapter?(:MysqlAdapter)
124
+
125
+ Person.connection.create_table :testings do |t|
126
+ t.column :one, :string, :default => "hello"
127
+ t.column :two, :boolean, :default => true
128
+ t.column :three, :boolean, :default => false
129
+ t.column :four, :integer, :default => 1
130
+ t.column :five, :text, :default => "hello" unless mysql
131
+ end
132
+
133
+ columns = Person.connection.columns(:testings)
134
+ one = columns.detect { |c| c.name == "one" }
135
+ two = columns.detect { |c| c.name == "two" }
136
+ three = columns.detect { |c| c.name == "three" }
137
+ four = columns.detect { |c| c.name == "four" }
138
+ five = columns.detect { |c| c.name == "five" } unless mysql
139
+
140
+ assert_equal "hello", one.default
141
+ assert_equal true, two.default
142
+ assert_equal false, three.default
143
+ assert_equal 1, four.default
144
+ assert_equal "hello", five.default unless mysql
145
+
146
+ ensure
147
+ Person.connection.drop_table :testings rescue nil
148
+ end
149
+
150
+ def test_create_table_with_limits
151
+ assert_nothing_raised do
152
+ Person.connection.create_table :testings do |t|
153
+ t.column :foo, :string, :limit => 255
154
+
155
+ t.column :default_int, :integer
156
+
157
+ t.column :one_int, :integer, :limit => 1
158
+ t.column :four_int, :integer, :limit => 4
159
+ t.column :eight_int, :integer, :limit => 8
160
+ t.column :eleven_int, :integer, :limit => 11
161
+ end
162
+ end
163
+
164
+ columns = Person.connection.columns(:testings)
165
+ foo = columns.detect { |c| c.name == "foo" }
166
+ assert_equal 255, foo.limit
167
+
168
+ default = columns.detect { |c| c.name == "default_int" }
169
+ one = columns.detect { |c| c.name == "one_int" }
170
+ four = columns.detect { |c| c.name == "four_int" }
171
+ eight = columns.detect { |c| c.name == "eight_int" }
172
+ eleven = columns.detect { |c| c.name == "eleven_int" }
173
+
174
+ if current_adapter?(:PostgreSQLAdapter)
175
+ assert_equal 'integer', default.sql_type
176
+ assert_equal 'smallint', one.sql_type
177
+ assert_equal 'integer', four.sql_type
178
+ assert_equal 'bigint', eight.sql_type
179
+ assert_equal 'integer', eleven.sql_type
180
+ elsif current_adapter?(:MysqlAdapter)
181
+ assert_match 'int(11)', default.sql_type
182
+ assert_match 'tinyint', one.sql_type
183
+ assert_match 'int', four.sql_type
184
+ assert_match 'bigint', eight.sql_type
185
+ assert_match 'int(11)', eleven.sql_type
186
+ elsif current_adapter?(:OracleAdapter)
187
+ assert_equal 'NUMBER(38)', default.sql_type
188
+ assert_equal 'NUMBER(1)', one.sql_type
189
+ assert_equal 'NUMBER(4)', four.sql_type
190
+ assert_equal 'NUMBER(8)', eight.sql_type
191
+ end
192
+ ensure
193
+ Person.connection.drop_table :testings rescue nil
194
+ end
195
+
196
+ def test_create_table_with_primary_key_prefix_as_table_name_with_underscore
197
+ ActiveRecord::Base.primary_key_prefix_type = :table_name_with_underscore
198
+
199
+ Person.connection.create_table :testings do |t|
200
+ t.column :foo, :string
201
+ end
202
+
203
+ assert_equal %w(foo testings_id), Person.connection.columns(:testings).map { |c| c.name }.sort
204
+ ensure
205
+ Person.connection.drop_table :testings rescue nil
206
+ ActiveRecord::Base.primary_key_prefix_type = nil
207
+ end
208
+
209
+ def test_create_table_with_primary_key_prefix_as_table_name
210
+ ActiveRecord::Base.primary_key_prefix_type = :table_name
211
+
212
+ Person.connection.create_table :testings do |t|
213
+ t.column :foo, :string
214
+ end
215
+
216
+ assert_equal %w(foo testingsid), Person.connection.columns(:testings).map { |c| c.name }.sort
217
+ ensure
218
+ Person.connection.drop_table :testings rescue nil
219
+ ActiveRecord::Base.primary_key_prefix_type = nil
220
+ end
221
+
222
+ uses_mocha('test_create_table_with_force_true_does_not_drop_nonexisting_table') do
223
+ def test_create_table_with_force_true_does_not_drop_nonexisting_table
224
+ if Person.connection.table_exists?(:testings2)
225
+ Person.connection.drop_table :testings2
226
+ end
227
+
228
+ # using a copy as we need the drop_table method to
229
+ # continue to work for the ensure block of the test
230
+ temp_conn = Person.connection.dup
231
+ temp_conn.expects(:drop_table).never
232
+ temp_conn.create_table :testings2, :force => true do |t|
233
+ t.column :foo, :string
234
+ end
235
+ ensure
236
+ Person.connection.drop_table :testings2 rescue nil
237
+ end
238
+ end
239
+
240
+ def test_create_table_with_timestamps_should_create_datetime_columns
241
+ table_name = :testings
242
+
243
+ Person.connection.create_table table_name do |t|
244
+ t.timestamps
245
+ end
246
+ created_columns = Person.connection.columns(table_name)
247
+
248
+ created_at_column = created_columns.detect {|c| c.name == 'created_at' }
249
+ updated_at_column = created_columns.detect {|c| c.name == 'updated_at' }
250
+
251
+ assert created_at_column.null
252
+ assert updated_at_column.null
253
+ ensure
254
+ Person.connection.drop_table table_name rescue nil
255
+ end
256
+
257
+ def test_create_table_with_timestamps_should_create_datetime_columns_with_options
258
+ table_name = :testings
259
+
260
+ Person.connection.create_table table_name do |t|
261
+ t.timestamps :null => false
262
+ end
263
+ created_columns = Person.connection.columns(table_name)
264
+
265
+ created_at_column = created_columns.detect {|c| c.name == 'created_at' }
266
+ updated_at_column = created_columns.detect {|c| c.name == 'updated_at' }
267
+
268
+ assert !created_at_column.null
269
+ assert !updated_at_column.null
270
+ ensure
271
+ Person.connection.drop_table table_name rescue nil
272
+ end
273
+
274
+ # SQL Server, Sybase, and SQLite3 will not allow you to add a NOT NULL
275
+ # column to a table without a default value.
276
+ unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :SQLiteAdapter)
277
+ def test_add_column_not_null_without_default
278
+ Person.connection.create_table :testings do |t|
279
+ t.column :foo, :string
280
+ end
281
+ Person.connection.add_column :testings, :bar, :string, :null => false
282
+
283
+ assert_raises(ActiveRecord::StatementInvalid) do
284
+ Person.connection.execute "insert into testings (foo, bar) values ('hello', NULL)"
285
+ end
286
+ ensure
287
+ Person.connection.drop_table :testings rescue nil
288
+ end
289
+ end
290
+
291
+ def test_add_column_not_null_with_default
292
+ Person.connection.create_table :testings do |t|
293
+ t.column :foo, :string
294
+ end
295
+
296
+ con = Person.connection
297
+ Person.connection.enable_identity_insert("testings", true) if current_adapter?(:SybaseAdapter)
298
+ Person.connection.execute "insert into testings (#{con.quote_column_name('id')}, #{con.quote_column_name('foo')}) values (1, 'hello')"
299
+ Person.connection.enable_identity_insert("testings", false) if current_adapter?(:SybaseAdapter)
300
+ assert_nothing_raised {Person.connection.add_column :testings, :bar, :string, :null => false, :default => "default" }
301
+
302
+ assert_raises(ActiveRecord::StatementInvalid) do
303
+ unless current_adapter?(:OpenBaseAdapter)
304
+ Person.connection.execute "insert into testings (#{con.quote_column_name('id')}, #{con.quote_column_name('foo')}, #{con.quote_column_name('bar')}) values (2, 'hello', NULL)"
305
+ else
306
+ Person.connection.insert("INSERT INTO testings (#{con.quote_column_name('id')}, #{con.quote_column_name('foo')}, #{con.quote_column_name('bar')}) VALUES (2, 'hello', NULL)",
307
+ "Testing Insert","id",2)
308
+ end
309
+ end
310
+ ensure
311
+ Person.connection.drop_table :testings rescue nil
312
+ end
313
+
314
+ # We specifically do a manual INSERT here, and then test only the SELECT
315
+ # functionality. This allows us to more easily catch INSERT being broken,
316
+ # but SELECT actually working fine.
317
+ def test_native_decimal_insert_manual_vs_automatic
318
+ correct_value = '0012345678901234567890.0123456789'.to_d
319
+
320
+ Person.delete_all
321
+ Person.connection.add_column "people", "wealth", :decimal, :precision => '30', :scale => '10'
322
+ Person.reset_column_information
323
+
324
+ # Do a manual insertion
325
+ if current_adapter?(:OracleAdapter)
326
+ Person.connection.execute "insert into people (id, wealth) values (people_seq.nextval, 12345678901234567890.0123456789)"
327
+ elsif current_adapter?(:OpenBaseAdapter) || (current_adapter?(:MysqlAdapter) && Mysql.client_version < 50003) #before mysql 5.0.3 decimals stored as strings
328
+ Person.connection.execute "insert into people (wealth) values ('12345678901234567890.0123456789')"
329
+ else
330
+ Person.connection.execute "insert into people (wealth) values (12345678901234567890.0123456789)"
331
+ end
332
+
333
+ # SELECT
334
+ row = Person.find(:first)
335
+ assert_kind_of BigDecimal, row.wealth
336
+
337
+ # If this assert fails, that means the SELECT is broken!
338
+ unless current_adapter?(:SQLite3Adapter)
339
+ assert_equal correct_value, row.wealth
340
+ end
341
+
342
+ # Reset to old state
343
+ Person.delete_all
344
+
345
+ # Now use the Rails insertion
346
+ assert_nothing_raised { Person.create :wealth => BigDecimal.new("12345678901234567890.0123456789") }
347
+
348
+ # SELECT
349
+ row = Person.find(:first)
350
+ assert_kind_of BigDecimal, row.wealth
351
+
352
+ # If these asserts fail, that means the INSERT (create function, or cast to SQL) is broken!
353
+ unless current_adapter?(:SQLite3Adapter)
354
+ assert_equal correct_value, row.wealth
355
+ end
356
+
357
+ # Reset to old state
358
+ Person.connection.del_column "people", "wealth" rescue nil
359
+ Person.reset_column_information
360
+ end
361
+
362
+ def test_add_column_with_precision_and_scale
363
+ Person.connection.add_column 'people', 'wealth', :decimal, :precision => 9, :scale => 7
364
+ Person.reset_column_information
365
+
366
+ wealth_column = Person.columns_hash['wealth']
367
+ assert_equal 9, wealth_column.precision
368
+ assert_equal 7, wealth_column.scale
369
+ end
370
+
371
+ def test_native_types
372
+ Person.delete_all
373
+ Person.connection.add_column "people", "last_name", :string
374
+ Person.connection.add_column "people", "bio", :text
375
+ Person.connection.add_column "people", "age", :integer
376
+ Person.connection.add_column "people", "height", :float
377
+ Person.connection.add_column "people", "wealth", :decimal, :precision => '30', :scale => '10'
378
+ Person.connection.add_column "people", "birthday", :datetime
379
+ Person.connection.add_column "people", "favorite_day", :date
380
+ Person.connection.add_column "people", "moment_of_truth", :datetime
381
+ Person.connection.add_column "people", "male", :boolean
382
+ Person.reset_column_information
383
+
384
+ assert_nothing_raised do
385
+ Person.create :first_name => 'bob', :last_name => 'bobsen',
386
+ :bio => "I was born ....", :age => 18, :height => 1.78,
387
+ :wealth => BigDecimal.new("12345678901234567890.0123456789"),
388
+ :birthday => 18.years.ago, :favorite_day => 10.days.ago,
389
+ :moment_of_truth => "1782-10-10 21:40:18", :male => true
390
+ end
391
+
392
+ bob = Person.find(:first)
393
+ assert_equal 'bob', bob.first_name
394
+ assert_equal 'bobsen', bob.last_name
395
+ assert_equal "I was born ....", bob.bio
396
+ assert_equal 18, bob.age
397
+
398
+ # Test for 30 significent digits (beyond the 16 of float), 10 of them
399
+ # after the decimal place.
400
+
401
+ unless current_adapter?(:SQLite3Adapter)
402
+ assert_equal BigDecimal.new("0012345678901234567890.0123456789"), bob.wealth
403
+ end
404
+
405
+ assert_equal true, bob.male?
406
+
407
+ assert_equal String, bob.first_name.class
408
+ assert_equal String, bob.last_name.class
409
+ assert_equal String, bob.bio.class
410
+ assert_equal Fixnum, bob.age.class
411
+ assert_equal Time, bob.birthday.class
412
+
413
+ if current_adapter?(:SQLServerAdapter, :OracleAdapter, :SybaseAdapter)
414
+ # Sybase, and Oracle don't differentiate between date/time
415
+ assert_equal Time, bob.favorite_day.class
416
+ else
417
+ assert_equal Date, bob.favorite_day.class
418
+ end
419
+
420
+ # Test DateTime column and defaults, including timezone.
421
+ # FIXME: moment of truth may be Time on 64-bit platforms.
422
+ if bob.moment_of_truth.is_a?(DateTime)
423
+
424
+ with_env_tz 'US/Eastern' do
425
+ assert_equal DateTime.local_offset, bob.moment_of_truth.offset
426
+ assert_not_equal 0, bob.moment_of_truth.offset
427
+ assert_not_equal "Z", bob.moment_of_truth.zone
428
+ # US/Eastern is -5 hours from GMT
429
+ assert_equal Rational(-5, 24), bob.moment_of_truth.offset
430
+ assert_match /\A-05:?00\Z/, bob.moment_of_truth.zone #ruby 1.8.6 uses HH:MM, prior versions use HHMM
431
+ assert_equal DateTime::ITALY, bob.moment_of_truth.start
432
+ end
433
+ end
434
+
435
+ assert_equal TrueClass, bob.male?.class
436
+ assert_kind_of BigDecimal, bob.wealth
437
+ end
438
+
439
+ if current_adapter?(:MysqlAdapter)
440
+ def test_unabstracted_database_dependent_types
441
+ Person.delete_all
442
+
443
+ ActiveRecord::Migration.add_column :people, :intelligence_quotient, :tinyint
444
+ Person.reset_column_information
445
+ assert_match /tinyint/, Person.columns_hash['intelligence_quotient'].sql_type
446
+ ensure
447
+ ActiveRecord::Migration.remove_column :people, :intelligence_quotient rescue nil
448
+ end
449
+ end
450
+
451
+ def test_add_remove_single_field_using_string_arguments
452
+ assert !Person.column_methods_hash.include?(:last_name)
453
+
454
+ ActiveRecord::Migration.add_column 'people', 'last_name', :string
455
+
456
+ Person.reset_column_information
457
+ assert Person.column_methods_hash.include?(:last_name)
458
+
459
+ ActiveRecord::Migration.remove_column 'people', 'last_name'
460
+
461
+ Person.reset_column_information
462
+ assert !Person.column_methods_hash.include?(:last_name)
463
+ end
464
+
465
+ def test_add_remove_single_field_using_symbol_arguments
466
+ assert !Person.column_methods_hash.include?(:last_name)
467
+
468
+ ActiveRecord::Migration.add_column :people, :last_name, :string
469
+
470
+ Person.reset_column_information
471
+ assert Person.column_methods_hash.include?(:last_name)
472
+
473
+ ActiveRecord::Migration.remove_column :people, :last_name
474
+
475
+ Person.reset_column_information
476
+ assert !Person.column_methods_hash.include?(:last_name)
477
+ end
478
+
479
+ def test_add_rename
480
+ Person.delete_all
481
+
482
+ begin
483
+ Person.connection.add_column "people", "girlfriend", :string
484
+ Person.reset_column_information
485
+ Person.create :girlfriend => 'bobette'
486
+
487
+ Person.connection.rename_column "people", "girlfriend", "exgirlfriend"
488
+
489
+ Person.reset_column_information
490
+ bob = Person.find(:first)
491
+
492
+ assert_equal "bobette", bob.exgirlfriend
493
+ ensure
494
+ Person.connection.remove_column("people", "girlfriend") rescue nil
495
+ Person.connection.remove_column("people", "exgirlfriend") rescue nil
496
+ end
497
+
498
+ end
499
+
500
+ def test_rename_column_using_symbol_arguments
501
+ begin
502
+ names_before = Person.find(:all).map(&:first_name)
503
+ Person.connection.rename_column :people, :first_name, :nick_name
504
+ Person.reset_column_information
505
+ assert Person.column_names.include?("nick_name")
506
+ assert_equal names_before, Person.find(:all).map(&:nick_name)
507
+ ensure
508
+ Person.connection.remove_column("people","nick_name")
509
+ Person.connection.add_column("people","first_name", :string)
510
+ end
511
+ end
512
+
513
+ def test_rename_column
514
+ begin
515
+ names_before = Person.find(:all).map(&:first_name)
516
+ Person.connection.rename_column "people", "first_name", "nick_name"
517
+ Person.reset_column_information
518
+ assert Person.column_names.include?("nick_name")
519
+ assert_equal names_before, Person.find(:all).map(&:nick_name)
520
+ ensure
521
+ Person.connection.remove_column("people","nick_name")
522
+ Person.connection.add_column("people","first_name", :string)
523
+ end
524
+ end
525
+
526
+ def test_rename_column_preserves_default_value_not_null
527
+ begin
528
+ default_before = Developer.connection.columns("developers").find { |c| c.name == "salary" }.default
529
+ assert_equal 70000, default_before
530
+ Developer.connection.rename_column "developers", "salary", "anual_salary"
531
+ Developer.reset_column_information
532
+ assert Developer.column_names.include?("anual_salary")
533
+ default_after = Developer.connection.columns("developers").find { |c| c.name == "anual_salary" }.default
534
+ assert_equal 70000, default_after
535
+ ensure
536
+ Developer.connection.rename_column "developers", "anual_salary", "salary"
537
+ Developer.reset_column_information
538
+ end
539
+ end
540
+
541
+ def test_rename_nonexistent_column
542
+ ActiveRecord::Base.connection.create_table(:hats) do |table|
543
+ table.column :hat_name, :string, :default => nil
544
+ end
545
+ exception = if current_adapter?(:PostgreSQLAdapter)
546
+ ActiveRecord::StatementInvalid
547
+ else
548
+ ActiveRecord::ActiveRecordError
549
+ end
550
+ assert_raises(exception) do
551
+ Person.connection.rename_column "hats", "nonexistent", "should_fail"
552
+ end
553
+ ensure
554
+ ActiveRecord::Base.connection.drop_table(:hats)
555
+ end
556
+
557
+ def test_rename_column_with_sql_reserved_word
558
+ begin
559
+ assert_nothing_raised { Person.connection.rename_column "people", "first_name", "group" }
560
+ Person.reset_column_information
561
+ assert Person.column_names.include?("group")
562
+ ensure
563
+ Person.connection.remove_column("people", "group") rescue nil
564
+ Person.connection.add_column("people", "first_name", :string) rescue nil
565
+ end
566
+ end
567
+
568
+ def test_rename_column_with_an_index
569
+ ActiveRecord::Base.connection.create_table(:hats) do |table|
570
+ table.column :hat_name, :string, :limit => 100
571
+ table.column :hat_size, :integer
572
+ end
573
+ Person.connection.add_index :hats, :hat_name
574
+ assert_nothing_raised do
575
+ Person.connection.rename_column "hats", "hat_name", "name"
576
+ end
577
+ ensure
578
+ ActiveRecord::Base.connection.drop_table(:hats)
579
+ end
580
+
581
+ def test_remove_column_with_index
582
+ ActiveRecord::Base.connection.create_table(:hats) do |table|
583
+ table.column :hat_name, :string, :limit => 100
584
+ table.column :hat_size, :integer
585
+ end
586
+ ActiveRecord::Base.connection.add_index "hats", "hat_size"
587
+
588
+ assert_nothing_raised { Person.connection.remove_column("hats", "hat_size") }
589
+ ensure
590
+ ActiveRecord::Base.connection.drop_table(:hats)
591
+ end
592
+
593
+ def test_remove_column_with_multi_column_index
594
+ ActiveRecord::Base.connection.create_table(:hats) do |table|
595
+ table.column :hat_name, :string, :limit => 100
596
+ table.column :hat_size, :integer
597
+ table.column :hat_style, :string, :limit => 100
598
+ end
599
+ ActiveRecord::Base.connection.add_index "hats", ["hat_style", "hat_size"], :unique => true
600
+
601
+ assert_nothing_raised { Person.connection.remove_column("hats", "hat_size") }
602
+ ensure
603
+ ActiveRecord::Base.connection.drop_table(:hats)
604
+ end
605
+
606
+ def test_change_type_of_not_null_column
607
+ assert_nothing_raised do
608
+ Topic.connection.change_column "topics", "written_on", :datetime, :null => false
609
+ Topic.reset_column_information
610
+
611
+ Topic.connection.change_column "topics", "written_on", :datetime, :null => false
612
+ Topic.reset_column_information
613
+ end
614
+ end
615
+
616
+ def test_rename_table
617
+ begin
618
+ ActiveRecord::Base.connection.create_table :octopuses do |t|
619
+ t.column :url, :string
620
+ end
621
+ ActiveRecord::Base.connection.rename_table :octopuses, :octopi
622
+
623
+ # Using explicit id in insert for compatibility across all databases
624
+ con = ActiveRecord::Base.connection
625
+ con.enable_identity_insert("octopi", true) if current_adapter?(:SybaseAdapter)
626
+ assert_nothing_raised { con.execute "INSERT INTO octopi (#{con.quote_column_name('id')}, #{con.quote_column_name('url')}) VALUES (1, 'http://www.foreverflying.com/octopus-black7.jpg')" }
627
+ con.enable_identity_insert("octopi", false) if current_adapter?(:SybaseAdapter)
628
+
629
+ assert_equal 'http://www.foreverflying.com/octopus-black7.jpg', ActiveRecord::Base.connection.select_value("SELECT url FROM octopi WHERE id=1")
630
+
631
+ ensure
632
+ ActiveRecord::Base.connection.drop_table :octopuses rescue nil
633
+ ActiveRecord::Base.connection.drop_table :octopi rescue nil
634
+ end
635
+ end
636
+
637
+ def test_change_column_nullability
638
+ Person.delete_all
639
+ Person.connection.add_column "people", "funny", :boolean
640
+ Person.reset_column_information
641
+ assert Person.columns_hash["funny"].null, "Column 'funny' must initially allow nulls"
642
+ Person.connection.change_column "people", "funny", :boolean, :null => false, :default => true
643
+ Person.reset_column_information
644
+ assert !Person.columns_hash["funny"].null, "Column 'funny' must *not* allow nulls at this point"
645
+ Person.connection.change_column "people", "funny", :boolean, :null => true
646
+ Person.reset_column_information
647
+ assert Person.columns_hash["funny"].null, "Column 'funny' must allow nulls again at this point"
648
+ end
649
+
650
+ def test_rename_table_with_an_index
651
+ begin
652
+ ActiveRecord::Base.connection.create_table :octopuses do |t|
653
+ t.column :url, :string
654
+ end
655
+ ActiveRecord::Base.connection.add_index :octopuses, :url
656
+
657
+ ActiveRecord::Base.connection.rename_table :octopuses, :octopi
658
+
659
+ # Using explicit id in insert for compatibility across all databases
660
+ con = ActiveRecord::Base.connection
661
+ con.enable_identity_insert("octopi", true) if current_adapter?(:SybaseAdapter)
662
+ assert_nothing_raised { con.execute "INSERT INTO octopi (#{con.quote_column_name('id')}, #{con.quote_column_name('url')}) VALUES (1, 'http://www.foreverflying.com/octopus-black7.jpg')" }
663
+ con.enable_identity_insert("octopi", false) if current_adapter?(:SybaseAdapter)
664
+
665
+ assert_equal 'http://www.foreverflying.com/octopus-black7.jpg', ActiveRecord::Base.connection.select_value("SELECT url FROM octopi WHERE id=1")
666
+ assert ActiveRecord::Base.connection.indexes(:octopi).first.columns.include?("url")
667
+ ensure
668
+ ActiveRecord::Base.connection.drop_table :octopuses rescue nil
669
+ ActiveRecord::Base.connection.drop_table :octopi rescue nil
670
+ end
671
+ end
672
+
673
+ def test_change_column
674
+ Person.connection.add_column 'people', 'age', :integer
675
+ old_columns = Person.connection.columns(Person.table_name, "#{name} Columns")
676
+ assert old_columns.find { |c| c.name == 'age' and c.type == :integer }
677
+
678
+ assert_nothing_raised { Person.connection.change_column "people", "age", :string }
679
+
680
+ new_columns = Person.connection.columns(Person.table_name, "#{name} Columns")
681
+ assert_nil new_columns.find { |c| c.name == 'age' and c.type == :integer }
682
+ assert new_columns.find { |c| c.name == 'age' and c.type == :string }
683
+
684
+ old_columns = Topic.connection.columns(Topic.table_name, "#{name} Columns")
685
+ assert old_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == true }
686
+ assert_nothing_raised { Topic.connection.change_column :topics, :approved, :boolean, :default => false }
687
+ new_columns = Topic.connection.columns(Topic.table_name, "#{name} Columns")
688
+ assert_nil new_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == true }
689
+ assert new_columns.find { |c| c.name == 'approved' and c.type == :boolean and c.default == false }
690
+ assert_nothing_raised { Topic.connection.change_column :topics, :approved, :boolean, :default => true }
691
+ end
692
+
693
+ def test_change_column_with_nil_default
694
+ Person.connection.add_column "people", "contributor", :boolean, :default => true
695
+ Person.reset_column_information
696
+ assert Person.new.contributor?
697
+
698
+ assert_nothing_raised { Person.connection.change_column "people", "contributor", :boolean, :default => nil }
699
+ Person.reset_column_information
700
+ assert !Person.new.contributor?
701
+ assert_nil Person.new.contributor
702
+ ensure
703
+ Person.connection.remove_column("people", "contributor") rescue nil
704
+ end
705
+
706
+ def test_change_column_with_new_default
707
+ Person.connection.add_column "people", "administrator", :boolean, :default => true
708
+ Person.reset_column_information
709
+ assert Person.new.administrator?
710
+
711
+ assert_nothing_raised { Person.connection.change_column "people", "administrator", :boolean, :default => false }
712
+ Person.reset_column_information
713
+ assert !Person.new.administrator?
714
+ ensure
715
+ Person.connection.remove_column("people", "administrator") rescue nil
716
+ end
717
+
718
+ def test_change_column_default
719
+ Person.connection.change_column_default "people", "first_name", "Tester"
720
+ Person.reset_column_information
721
+ assert_equal "Tester", Person.new.first_name
722
+ end
723
+
724
+ def test_change_column_quotes_column_names
725
+ Person.connection.create_table :testings do |t|
726
+ t.column :select, :string
727
+ end
728
+
729
+ assert_nothing_raised { Person.connection.change_column :testings, :select, :string, :limit => 10 }
730
+
731
+ assert_nothing_raised { Person.connection.execute "insert into testings (#{Person.connection.quote_column_name('select')}) values ('7 chars')" }
732
+ ensure
733
+ Person.connection.drop_table :testings rescue nil
734
+ end
735
+
736
+ def test_keeping_default_and_notnull_constaint_on_change
737
+ Person.connection.create_table :testings do |t|
738
+ t.column :title, :string
739
+ end
740
+ person_klass = Class.new(Person)
741
+ person_klass.set_table_name 'testings'
742
+
743
+ person_klass.connection.add_column "testings", "wealth", :integer, :null => false, :default => 99
744
+ person_klass.reset_column_information
745
+ assert_equal 99, person_klass.columns_hash["wealth"].default
746
+ assert_equal false, person_klass.columns_hash["wealth"].null
747
+ assert_nothing_raised {person_klass.connection.execute("insert into testings (title) values ('tester')")}
748
+
749
+ # change column default to see that column doesn't lose its not null definition
750
+ person_klass.connection.change_column_default "testings", "wealth", 100
751
+ person_klass.reset_column_information
752
+ assert_equal 100, person_klass.columns_hash["wealth"].default
753
+ assert_equal false, person_klass.columns_hash["wealth"].null
754
+
755
+ # rename column to see that column doesn't lose its not null and/or default definition
756
+ person_klass.connection.rename_column "testings", "wealth", "money"
757
+ person_klass.reset_column_information
758
+ assert_nil person_klass.columns_hash["wealth"]
759
+ assert_equal 100, person_klass.columns_hash["money"].default
760
+ assert_equal false, person_klass.columns_hash["money"].null
761
+
762
+ # change column
763
+ person_klass.connection.change_column "testings", "money", :integer, :null => false, :default => 1000
764
+ person_klass.reset_column_information
765
+ assert_equal 1000, person_klass.columns_hash["money"].default
766
+ assert_equal false, person_klass.columns_hash["money"].null
767
+
768
+ # change column, make it nullable and clear default
769
+ person_klass.connection.change_column "testings", "money", :integer, :null => true, :default => nil
770
+ person_klass.reset_column_information
771
+ assert_nil person_klass.columns_hash["money"].default
772
+ assert_equal true, person_klass.columns_hash["money"].null
773
+
774
+ # change_column_null, make it not nullable and set null values to a default value
775
+ person_klass.connection.execute('UPDATE testings SET money = NULL')
776
+ person_klass.connection.change_column_null "testings", "money", false, 2000
777
+ person_klass.reset_column_information
778
+ assert_nil person_klass.columns_hash["money"].default
779
+ assert_equal false, person_klass.columns_hash["money"].null
780
+ assert_equal [2000], Person.connection.select_values("SELECT money FROM testings").map { |s| s.to_i }.sort
781
+ ensure
782
+ Person.connection.drop_table :testings rescue nil
783
+ end
784
+
785
+ def test_change_column_default_to_null
786
+ Person.connection.change_column_default "people", "first_name", nil
787
+ Person.reset_column_information
788
+ assert_nil Person.new.first_name
789
+ end
790
+
791
+ def test_add_table
792
+ assert !Reminder.table_exists?
793
+
794
+ WeNeedReminders.up
795
+
796
+ assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
797
+ assert_equal "hello world", Reminder.find(:first).content
798
+
799
+ WeNeedReminders.down
800
+ assert_raises(ActiveRecord::StatementInvalid) { Reminder.find(:first) }
801
+ end
802
+
803
+ def test_add_table_with_decimals
804
+ Person.connection.drop_table :big_numbers rescue nil
805
+
806
+ assert !BigNumber.table_exists?
807
+ GiveMeBigNumbers.up
808
+
809
+ assert BigNumber.create(
810
+ :bank_balance => 1586.43,
811
+ :big_bank_balance => BigDecimal("1000234000567.95"),
812
+ :world_population => 6000000000,
813
+ :my_house_population => 3,
814
+ :value_of_e => BigDecimal("2.7182818284590452353602875")
815
+ )
816
+
817
+ b = BigNumber.find(:first)
818
+ assert_not_nil b
819
+
820
+ assert_not_nil b.bank_balance
821
+ assert_not_nil b.big_bank_balance
822
+ assert_not_nil b.world_population
823
+ assert_not_nil b.my_house_population
824
+ assert_not_nil b.value_of_e
825
+
826
+ # TODO: set world_population >= 2**62 to cover 64-bit platforms and test
827
+ # is_a?(Bignum)
828
+ assert_kind_of Integer, b.world_population
829
+ assert_equal 6000000000, b.world_population
830
+ assert_kind_of Fixnum, b.my_house_population
831
+ assert_equal 3, b.my_house_population
832
+ assert_kind_of BigDecimal, b.bank_balance
833
+ assert_equal BigDecimal("1586.43"), b.bank_balance
834
+ assert_kind_of BigDecimal, b.big_bank_balance
835
+ assert_equal BigDecimal("1000234000567.95"), b.big_bank_balance
836
+
837
+ # This one is fun. The 'value_of_e' field is defined as 'DECIMAL' with
838
+ # precision/scale explicitly left out. By the SQL standard, numbers
839
+ # assigned to this field should be truncated but that's seldom respected.
840
+ if current_adapter?(:PostgreSQLAdapter, :SQLite2Adapter)
841
+ # - PostgreSQL changes the SQL spec on columns declared simply as
842
+ # "decimal" to something more useful: instead of being given a scale
843
+ # of 0, they take on the compile-time limit for precision and scale,
844
+ # so the following should succeed unless you have used really wacky
845
+ # compilation options
846
+ # - SQLite2 has the default behavior of preserving all data sent in,
847
+ # so this happens there too
848
+ assert_kind_of BigDecimal, b.value_of_e
849
+ assert_equal BigDecimal("2.7182818284590452353602875"), b.value_of_e
850
+ elsif current_adapter?(:SQLiteAdapter)
851
+ # - SQLite3 stores a float, in violation of SQL
852
+ assert_kind_of BigDecimal, b.value_of_e
853
+ assert_equal BigDecimal("2.71828182845905"), b.value_of_e
854
+ elsif current_adapter?(:SQLServer)
855
+ # - SQL Server rounds instead of truncating
856
+ assert_kind_of Fixnum, b.value_of_e
857
+ assert_equal 3, b.value_of_e
858
+ else
859
+ # - SQL standard is an integer
860
+ assert_kind_of Fixnum, b.value_of_e
861
+ assert_equal 2, b.value_of_e
862
+ end
863
+
864
+ GiveMeBigNumbers.down
865
+ assert_raises(ActiveRecord::StatementInvalid) { BigNumber.find(:first) }
866
+ end
867
+
868
+ def test_migrator
869
+ assert !Person.column_methods_hash.include?(:last_name)
870
+ assert !Reminder.table_exists?
871
+
872
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid")
873
+
874
+ assert_equal 3, ActiveRecord::Migrator.current_version
875
+ Person.reset_column_information
876
+ assert Person.column_methods_hash.include?(:last_name)
877
+ assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
878
+ assert_equal "hello world", Reminder.find(:first).content
879
+
880
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid")
881
+
882
+ assert_equal 0, ActiveRecord::Migrator.current_version
883
+ Person.reset_column_information
884
+ assert !Person.column_methods_hash.include?(:last_name)
885
+ assert_raises(ActiveRecord::StatementInvalid) { Reminder.find(:first) }
886
+ end
887
+
888
+ def test_migrator_one_up
889
+ assert !Person.column_methods_hash.include?(:last_name)
890
+ assert !Reminder.table_exists?
891
+
892
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
893
+
894
+ Person.reset_column_information
895
+ assert Person.column_methods_hash.include?(:last_name)
896
+ assert !Reminder.table_exists?
897
+
898
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 2)
899
+
900
+ assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
901
+ assert_equal "hello world", Reminder.find(:first).content
902
+ end
903
+
904
+ def test_migrator_one_down
905
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid")
906
+
907
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 1)
908
+
909
+ Person.reset_column_information
910
+ assert Person.column_methods_hash.include?(:last_name)
911
+ assert !Reminder.table_exists?
912
+ end
913
+
914
+ def test_migrator_one_up_one_down
915
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
916
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 0)
917
+
918
+ assert !Person.column_methods_hash.include?(:last_name)
919
+ assert !Reminder.table_exists?
920
+ end
921
+
922
+ def test_migrator_double_up
923
+ assert_equal(0, ActiveRecord::Migrator.current_version)
924
+ ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + "/valid", 1)
925
+ assert_nothing_raised { ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + "/valid", 1) }
926
+ assert_equal(1, ActiveRecord::Migrator.current_version)
927
+ end
928
+
929
+ def test_migrator_double_down
930
+ assert_equal(0, ActiveRecord::Migrator.current_version)
931
+ ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + "/valid", 1)
932
+ ActiveRecord::Migrator.run(:down, MIGRATIONS_ROOT + "/valid", 1)
933
+ assert_nothing_raised { ActiveRecord::Migrator.run(:down, MIGRATIONS_ROOT + "/valid", 1) }
934
+ assert_equal(0, ActiveRecord::Migrator.current_version)
935
+ end
936
+
937
+ def test_finds_migrations
938
+ migrations = ActiveRecord::Migrator.new(:up, MIGRATIONS_ROOT + "/valid").migrations
939
+ [['1', 'people_have_last_names'],
940
+ ['2', 'we_need_reminders'],
941
+ ['3', 'innocent_jointable']].each_with_index do |pair, i|
942
+ migrations[i].version == pair.first
943
+ migrations[1].name == pair.last
944
+ end
945
+ end
946
+
947
+ def test_finds_pending_migrations
948
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/interleaved/pass_2", 1)
949
+ migrations = ActiveRecord::Migrator.new(:up, MIGRATIONS_ROOT + "/interleaved/pass_2").pending_migrations
950
+ assert_equal 1, migrations.size
951
+ migrations[0].version == '3'
952
+ migrations[0].name == 'innocent_jointable'
953
+ end
954
+
955
+ def test_migrator_interleaved_migrations
956
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/interleaved/pass_1")
957
+
958
+ assert_nothing_raised do
959
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/interleaved/pass_2")
960
+ end
961
+
962
+ Person.reset_column_information
963
+ assert Person.column_methods_hash.include?(:last_name)
964
+
965
+ assert_nothing_raised do
966
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/interleaved/pass_3")
967
+ end
968
+ end
969
+
970
+ def test_migrator_db_has_no_schema_migrations_table
971
+ ActiveRecord::Base.connection.execute("DROP TABLE schema_migrations;")
972
+ assert_nothing_raised do
973
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 1)
974
+ end
975
+ end
976
+
977
+ def test_migrator_verbosity
978
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
979
+ assert PeopleHaveLastNames.message_count > 0
980
+ PeopleHaveLastNames.message_count = 0
981
+
982
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 0)
983
+ assert PeopleHaveLastNames.message_count > 0
984
+ PeopleHaveLastNames.message_count = 0
985
+ end
986
+
987
+ def test_migrator_verbosity_off
988
+ PeopleHaveLastNames.verbose = false
989
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
990
+ assert PeopleHaveLastNames.message_count.zero?
991
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 0)
992
+ assert PeopleHaveLastNames.message_count.zero?
993
+ end
994
+
995
+ def test_migrator_going_down_due_to_version_target
996
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
997
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 0)
998
+
999
+ assert !Person.column_methods_hash.include?(:last_name)
1000
+ assert !Reminder.table_exists?
1001
+
1002
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid")
1003
+
1004
+ Person.reset_column_information
1005
+ assert Person.column_methods_hash.include?(:last_name)
1006
+ assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
1007
+ assert_equal "hello world", Reminder.find(:first).content
1008
+ end
1009
+
1010
+ def test_migrator_rollback
1011
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid")
1012
+ assert_equal(3, ActiveRecord::Migrator.current_version)
1013
+
1014
+ ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
1015
+ assert_equal(2, ActiveRecord::Migrator.current_version)
1016
+
1017
+ ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
1018
+ assert_equal(1, ActiveRecord::Migrator.current_version)
1019
+
1020
+ ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
1021
+ assert_equal(0, ActiveRecord::Migrator.current_version)
1022
+
1023
+ ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
1024
+ assert_equal(0, ActiveRecord::Migrator.current_version)
1025
+ end
1026
+
1027
+ def test_schema_migrations_table_name
1028
+ ActiveRecord::Base.table_name_prefix = "prefix_"
1029
+ ActiveRecord::Base.table_name_suffix = "_suffix"
1030
+ Reminder.reset_table_name
1031
+ assert_equal "prefix_schema_migrations_suffix", ActiveRecord::Migrator.schema_migrations_table_name
1032
+ ActiveRecord::Base.table_name_prefix = ""
1033
+ ActiveRecord::Base.table_name_suffix = ""
1034
+ Reminder.reset_table_name
1035
+ assert_equal "schema_migrations", ActiveRecord::Migrator.schema_migrations_table_name
1036
+ ensure
1037
+ ActiveRecord::Base.table_name_prefix = ""
1038
+ ActiveRecord::Base.table_name_suffix = ""
1039
+ end
1040
+
1041
+ def test_proper_table_name
1042
+ assert_equal "table", ActiveRecord::Migrator.proper_table_name('table')
1043
+ assert_equal "table", ActiveRecord::Migrator.proper_table_name(:table)
1044
+ assert_equal "reminders", ActiveRecord::Migrator.proper_table_name(Reminder)
1045
+ Reminder.reset_table_name
1046
+ assert_equal Reminder.table_name, ActiveRecord::Migrator.proper_table_name(Reminder)
1047
+
1048
+ # Use the model's own prefix/suffix if a model is given
1049
+ ActiveRecord::Base.table_name_prefix = "ARprefix_"
1050
+ ActiveRecord::Base.table_name_suffix = "_ARsuffix"
1051
+ Reminder.table_name_prefix = 'prefix_'
1052
+ Reminder.table_name_suffix = '_suffix'
1053
+ Reminder.reset_table_name
1054
+ assert_equal "prefix_reminders_suffix", ActiveRecord::Migrator.proper_table_name(Reminder)
1055
+ Reminder.table_name_prefix = ''
1056
+ Reminder.table_name_suffix = ''
1057
+ Reminder.reset_table_name
1058
+
1059
+ # Use AR::Base's prefix/suffix if string or symbol is given
1060
+ ActiveRecord::Base.table_name_prefix = "prefix_"
1061
+ ActiveRecord::Base.table_name_suffix = "_suffix"
1062
+ Reminder.reset_table_name
1063
+ assert_equal "prefix_table_suffix", ActiveRecord::Migrator.proper_table_name('table')
1064
+ assert_equal "prefix_table_suffix", ActiveRecord::Migrator.proper_table_name(:table)
1065
+ ActiveRecord::Base.table_name_prefix = ""
1066
+ ActiveRecord::Base.table_name_suffix = ""
1067
+ Reminder.reset_table_name
1068
+ end
1069
+
1070
+ def test_add_drop_table_with_prefix_and_suffix
1071
+ assert !Reminder.table_exists?
1072
+ ActiveRecord::Base.table_name_prefix = 'prefix_'
1073
+ ActiveRecord::Base.table_name_suffix = '_suffix'
1074
+ Reminder.reset_table_name
1075
+ Reminder.reset_sequence_name
1076
+ WeNeedReminders.up
1077
+ assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
1078
+ assert_equal "hello world", Reminder.find(:first).content
1079
+
1080
+ WeNeedReminders.down
1081
+ assert_raises(ActiveRecord::StatementInvalid) { Reminder.find(:first) }
1082
+ ensure
1083
+ ActiveRecord::Base.table_name_prefix = ''
1084
+ ActiveRecord::Base.table_name_suffix = ''
1085
+ Reminder.reset_table_name
1086
+ Reminder.reset_sequence_name
1087
+ end
1088
+
1089
+ def test_create_table_with_binary_column
1090
+ Person.connection.drop_table :binary_testings rescue nil
1091
+
1092
+ assert_nothing_raised {
1093
+ Person.connection.create_table :binary_testings do |t|
1094
+ t.column "data", :binary, :null => false
1095
+ end
1096
+ }
1097
+
1098
+ columns = Person.connection.columns(:binary_testings)
1099
+ data_column = columns.detect { |c| c.name == "data" }
1100
+
1101
+ assert_nil data_column.default
1102
+
1103
+ Person.connection.drop_table :binary_testings rescue nil
1104
+ end
1105
+
1106
+ def test_migrator_with_duplicates
1107
+ assert_raises(ActiveRecord::DuplicateMigrationVersionError) do
1108
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/duplicate", nil)
1109
+ end
1110
+ end
1111
+
1112
+ def test_migrator_with_duplicate_names
1113
+ assert_raises(ActiveRecord::DuplicateMigrationNameError, "Multiple migrations have the name Chunky") do
1114
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/duplicate_names", nil)
1115
+ end
1116
+ end
1117
+
1118
+ def test_migrator_with_missing_version_numbers
1119
+ assert_raise(ActiveRecord::UnknownMigrationVersionError) do
1120
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/missing", 500)
1121
+ end
1122
+ end
1123
+
1124
+ def test_create_table_with_custom_sequence_name
1125
+ return unless current_adapter? :OracleAdapter
1126
+
1127
+ # table name is 29 chars, the standard sequence name will
1128
+ # be 33 chars and fail
1129
+ assert_raises(ActiveRecord::StatementInvalid) do
1130
+ begin
1131
+ Person.connection.create_table :table_with_name_thats_just_ok do |t|
1132
+ t.column :foo, :string, :null => false
1133
+ end
1134
+ ensure
1135
+ Person.connection.drop_table :table_with_name_thats_just_ok rescue nil
1136
+ end
1137
+ end
1138
+
1139
+ # should be all good w/ a custom sequence name
1140
+ assert_nothing_raised do
1141
+ begin
1142
+ Person.connection.create_table :table_with_name_thats_just_ok,
1143
+ :sequence_name => 'suitably_short_seq' do |t|
1144
+ t.column :foo, :string, :null => false
1145
+ end
1146
+
1147
+ Person.connection.execute("select suitably_short_seq.nextval from dual")
1148
+
1149
+ ensure
1150
+ Person.connection.drop_table :table_with_name_thats_just_ok,
1151
+ :sequence_name => 'suitably_short_seq' rescue nil
1152
+ end
1153
+ end
1154
+
1155
+ # confirm the custom sequence got dropped
1156
+ assert_raises(ActiveRecord::StatementInvalid) do
1157
+ Person.connection.execute("select suitably_short_seq.nextval from dual")
1158
+ end
1159
+ end
1160
+
1161
+ protected
1162
+ def with_env_tz(new_tz = 'US/Eastern')
1163
+ old_tz, ENV['TZ'] = ENV['TZ'], new_tz
1164
+ yield
1165
+ ensure
1166
+ old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ')
1167
+ end
1168
+
1169
+ end
1170
+
1171
+ uses_mocha 'Sexy migration tests' do
1172
+ class SexyMigrationsTest < ActiveRecord::TestCase
1173
+ def test_references_column_type_adds_id
1174
+ with_new_table do |t|
1175
+ t.expects(:column).with('customer_id', :integer, {})
1176
+ t.references :customer
1177
+ end
1178
+ end
1179
+
1180
+ def test_references_column_type_with_polymorphic_adds_type
1181
+ with_new_table do |t|
1182
+ t.expects(:column).with('taggable_type', :string, {})
1183
+ t.expects(:column).with('taggable_id', :integer, {})
1184
+ t.references :taggable, :polymorphic => true
1185
+ end
1186
+ end
1187
+
1188
+ def test_references_column_type_with_polymorphic_and_options_null_is_false_adds_table_flag
1189
+ with_new_table do |t|
1190
+ t.expects(:column).with('taggable_type', :string, {:null => false})
1191
+ t.expects(:column).with('taggable_id', :integer, {:null => false})
1192
+ t.references :taggable, :polymorphic => true, :null => false
1193
+ end
1194
+ end
1195
+
1196
+ def test_belongs_to_works_like_references
1197
+ with_new_table do |t|
1198
+ t.expects(:column).with('customer_id', :integer, {})
1199
+ t.belongs_to :customer
1200
+ end
1201
+ end
1202
+
1203
+ def test_timestamps_creates_updated_at_and_created_at
1204
+ with_new_table do |t|
1205
+ t.expects(:column).with(:created_at, :datetime, kind_of(Hash))
1206
+ t.expects(:column).with(:updated_at, :datetime, kind_of(Hash))
1207
+ t.timestamps
1208
+ end
1209
+ end
1210
+
1211
+ def test_integer_creates_integer_column
1212
+ with_new_table do |t|
1213
+ t.expects(:column).with(:foo, 'integer', {})
1214
+ t.expects(:column).with(:bar, 'integer', {})
1215
+ t.integer :foo, :bar
1216
+ end
1217
+ end
1218
+
1219
+ def test_string_creates_string_column
1220
+ with_new_table do |t|
1221
+ t.expects(:column).with(:foo, 'string', {})
1222
+ t.expects(:column).with(:bar, 'string', {})
1223
+ t.string :foo, :bar
1224
+ end
1225
+ end
1226
+
1227
+ protected
1228
+ def with_new_table
1229
+ Person.connection.create_table :delete_me, :force => true do |t|
1230
+ yield t
1231
+ end
1232
+ ensure
1233
+ Person.connection.drop_table :delete_me rescue nil
1234
+ end
1235
+
1236
+ end # SexyMigrationsTest
1237
+ end # uses_mocha
1238
+
1239
+ uses_mocha 'ChangeTable migration tests' do
1240
+ class ChangeTableMigrationsTest < ActiveRecord::TestCase
1241
+ def setup
1242
+ @connection = Person.connection
1243
+ @connection.create_table :delete_me, :force => true do |t|
1244
+ end
1245
+ end
1246
+
1247
+ def teardown
1248
+ Person.connection.drop_table :delete_me rescue nil
1249
+ end
1250
+
1251
+ def test_references_column_type_adds_id
1252
+ with_change_table do |t|
1253
+ @connection.expects(:add_column).with(:delete_me, 'customer_id', :integer, {})
1254
+ t.references :customer
1255
+ end
1256
+ end
1257
+
1258
+ def test_remove_references_column_type_removes_id
1259
+ with_change_table do |t|
1260
+ @connection.expects(:remove_column).with(:delete_me, 'customer_id')
1261
+ t.remove_references :customer
1262
+ end
1263
+ end
1264
+
1265
+ def test_add_belongs_to_works_like_add_references
1266
+ with_change_table do |t|
1267
+ @connection.expects(:add_column).with(:delete_me, 'customer_id', :integer, {})
1268
+ t.belongs_to :customer
1269
+ end
1270
+ end
1271
+
1272
+ def test_remove_belongs_to_works_like_remove_references
1273
+ with_change_table do |t|
1274
+ @connection.expects(:remove_column).with(:delete_me, 'customer_id')
1275
+ t.remove_belongs_to :customer
1276
+ end
1277
+ end
1278
+
1279
+ def test_references_column_type_with_polymorphic_adds_type
1280
+ with_change_table do |t|
1281
+ @connection.expects(:add_column).with(:delete_me, 'taggable_type', :string, {})
1282
+ @connection.expects(:add_column).with(:delete_me, 'taggable_id', :integer, {})
1283
+ t.references :taggable, :polymorphic => true
1284
+ end
1285
+ end
1286
+
1287
+ def test_remove_references_column_type_with_polymorphic_removes_type
1288
+ with_change_table do |t|
1289
+ @connection.expects(:remove_column).with(:delete_me, 'taggable_type')
1290
+ @connection.expects(:remove_column).with(:delete_me, 'taggable_id')
1291
+ t.remove_references :taggable, :polymorphic => true
1292
+ end
1293
+ end
1294
+
1295
+ def test_references_column_type_with_polymorphic_and_options_null_is_false_adds_table_flag
1296
+ with_change_table do |t|
1297
+ @connection.expects(:add_column).with(:delete_me, 'taggable_type', :string, {:null => false})
1298
+ @connection.expects(:add_column).with(:delete_me, 'taggable_id', :integer, {:null => false})
1299
+ t.references :taggable, :polymorphic => true, :null => false
1300
+ end
1301
+ end
1302
+
1303
+ def test_remove_references_column_type_with_polymorphic_and_options_null_is_false_removes_table_flag
1304
+ with_change_table do |t|
1305
+ @connection.expects(:remove_column).with(:delete_me, 'taggable_type')
1306
+ @connection.expects(:remove_column).with(:delete_me, 'taggable_id')
1307
+ t.remove_references :taggable, :polymorphic => true, :null => false
1308
+ end
1309
+ end
1310
+
1311
+ def test_timestamps_creates_updated_at_and_created_at
1312
+ with_change_table do |t|
1313
+ @connection.expects(:add_timestamps).with(:delete_me)
1314
+ t.timestamps
1315
+ end
1316
+ end
1317
+
1318
+ def test_remove_timestamps_creates_updated_at_and_created_at
1319
+ with_change_table do |t|
1320
+ @connection.expects(:remove_timestamps).with(:delete_me)
1321
+ t.remove_timestamps
1322
+ end
1323
+ end
1324
+
1325
+ def string_column
1326
+ if current_adapter?(:PostgreSQLAdapter)
1327
+ "character varying(255)"
1328
+ else
1329
+ 'varchar(255)'
1330
+ end
1331
+ end
1332
+
1333
+ def integer_column
1334
+ if current_adapter?(:MysqlAdapter)
1335
+ 'int(11)'
1336
+ else
1337
+ 'integer'
1338
+ end
1339
+ end
1340
+
1341
+ def test_integer_creates_integer_column
1342
+ with_change_table do |t|
1343
+ @connection.expects(:add_column).with(:delete_me, :foo, integer_column, {})
1344
+ @connection.expects(:add_column).with(:delete_me, :bar, integer_column, {})
1345
+ t.integer :foo, :bar
1346
+ end
1347
+ end
1348
+
1349
+ def test_string_creates_string_column
1350
+ with_change_table do |t|
1351
+ @connection.expects(:add_column).with(:delete_me, :foo, string_column, {})
1352
+ @connection.expects(:add_column).with(:delete_me, :bar, string_column, {})
1353
+ t.string :foo, :bar
1354
+ end
1355
+ end
1356
+
1357
+ def test_column_creates_column
1358
+ with_change_table do |t|
1359
+ @connection.expects(:add_column).with(:delete_me, :bar, :integer, {})
1360
+ t.column :bar, :integer
1361
+ end
1362
+ end
1363
+
1364
+ def test_column_creates_column_with_options
1365
+ with_change_table do |t|
1366
+ @connection.expects(:add_column).with(:delete_me, :bar, :integer, {:null => false})
1367
+ t.column :bar, :integer, :null => false
1368
+ end
1369
+ end
1370
+
1371
+ def test_index_creates_index
1372
+ with_change_table do |t|
1373
+ @connection.expects(:add_index).with(:delete_me, :bar, {})
1374
+ t.index :bar
1375
+ end
1376
+ end
1377
+
1378
+ def test_index_creates_index_with_options
1379
+ with_change_table do |t|
1380
+ @connection.expects(:add_index).with(:delete_me, :bar, {:unique => true})
1381
+ t.index :bar, :unique => true
1382
+ end
1383
+ end
1384
+
1385
+ def test_change_changes_column
1386
+ with_change_table do |t|
1387
+ @connection.expects(:change_column).with(:delete_me, :bar, :string, {})
1388
+ t.change :bar, :string
1389
+ end
1390
+ end
1391
+
1392
+ def test_change_changes_column_with_options
1393
+ with_change_table do |t|
1394
+ @connection.expects(:change_column).with(:delete_me, :bar, :string, {:null => true})
1395
+ t.change :bar, :string, :null => true
1396
+ end
1397
+ end
1398
+
1399
+ def test_change_default_changes_column
1400
+ with_change_table do |t|
1401
+ @connection.expects(:change_column_default).with(:delete_me, :bar, :string)
1402
+ t.change_default :bar, :string
1403
+ end
1404
+ end
1405
+
1406
+ def test_remove_drops_single_column
1407
+ with_change_table do |t|
1408
+ @connection.expects(:remove_column).with(:delete_me, [:bar])
1409
+ t.remove :bar
1410
+ end
1411
+ end
1412
+
1413
+ def test_remove_drops_multiple_columns
1414
+ with_change_table do |t|
1415
+ @connection.expects(:remove_column).with(:delete_me, [:bar, :baz])
1416
+ t.remove :bar, :baz
1417
+ end
1418
+ end
1419
+
1420
+ def test_remove_index_removes_index_with_options
1421
+ with_change_table do |t|
1422
+ @connection.expects(:remove_index).with(:delete_me, {:unique => true})
1423
+ t.remove_index :unique => true
1424
+ end
1425
+ end
1426
+
1427
+ def test_rename_renames_column
1428
+ with_change_table do |t|
1429
+ @connection.expects(:rename_column).with(:delete_me, :bar, :baz)
1430
+ t.rename :bar, :baz
1431
+ end
1432
+ end
1433
+
1434
+ protected
1435
+ def with_change_table
1436
+ Person.connection.change_table :delete_me do |t|
1437
+ yield t
1438
+ end
1439
+ end
1440
+
1441
+ end # ChangeTable test
1442
+ end # uses_mocha
1443
+
1444
+ end