factorylabs-castronaut 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (789) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.textile +67 -0
  3. data/Rakefile +78 -0
  4. data/bin/castronaut +75 -0
  5. data/config/castronaut.example.yml +41 -0
  6. data/config/castronaut.sample.yml +40 -0
  7. data/config/castronaut.yml +40 -0
  8. data/config/nginx_vhost.conf +17 -0
  9. data/config/thin_config.yml +13 -0
  10. data/lib/castronaut.rb +50 -0
  11. data/lib/castronaut/adapters.rb +13 -0
  12. data/lib/castronaut/adapters/development/adapter.rb +13 -0
  13. data/lib/castronaut/adapters/development/user.rb +25 -0
  14. data/lib/castronaut/adapters/ldap/adapter.rb +15 -0
  15. data/lib/castronaut/adapters/ldap/user.rb +40 -0
  16. data/lib/castronaut/adapters/restful_authentication/adapter.rb +15 -0
  17. data/lib/castronaut/adapters/restful_authentication/user.rb +50 -0
  18. data/lib/castronaut/application.rb +1 -0
  19. data/lib/castronaut/application/application.rb +70 -0
  20. data/lib/castronaut/application/public/javascripts/application.js +3 -0
  21. data/lib/castronaut/application/public/javascripts/jquery.js +32 -0
  22. data/lib/castronaut/application/public/stylesheets/screen.css +122 -0
  23. data/lib/castronaut/application/views/layout.erb +27 -0
  24. data/lib/castronaut/application/views/login.erb +31 -0
  25. data/lib/castronaut/application/views/logout.erb +13 -0
  26. data/lib/castronaut/application/views/proxy_validate.erb +21 -0
  27. data/lib/castronaut/application/views/service_validate.erb +14 -0
  28. data/lib/castronaut/authentication_result.rb +24 -0
  29. data/lib/castronaut/configuration.rb +110 -0
  30. data/lib/castronaut/db/001_create_cas_database.rb +47 -0
  31. data/lib/castronaut/models/consumeable.rb +18 -0
  32. data/lib/castronaut/models/dispenser.rb +14 -0
  33. data/lib/castronaut/models/login_ticket.rb +53 -0
  34. data/lib/castronaut/models/proxy_granting_ticket.rb +70 -0
  35. data/lib/castronaut/models/proxy_ticket.rb +43 -0
  36. data/lib/castronaut/models/service_ticket.rb +91 -0
  37. data/lib/castronaut/models/ticket_granting_ticket.rb +52 -0
  38. data/lib/castronaut/presenters/login.rb +84 -0
  39. data/lib/castronaut/presenters/logout.rb +56 -0
  40. data/lib/castronaut/presenters/process_login.rb +149 -0
  41. data/lib/castronaut/presenters/proxy_validate.rb +67 -0
  42. data/lib/castronaut/presenters/service_validate.rb +68 -0
  43. data/lib/castronaut/support/sample.rb +21 -0
  44. data/lib/castronaut/ticket_result.rb +27 -0
  45. data/lib/castronaut/utilities/random_string.rb +24 -0
  46. data/spec/app/controllers/application_spec.rb +86 -0
  47. data/spec/castronaut/adapters/development/adapter_spec.rb +14 -0
  48. data/spec/castronaut/adapters/development/user_spec.rb +55 -0
  49. data/spec/castronaut/adapters/ldap/adapter_spec.rb +14 -0
  50. data/spec/castronaut/adapters/ldap/user_spec.rb +25 -0
  51. data/spec/castronaut/adapters/restful_authentication/adapter_spec.rb +14 -0
  52. data/spec/castronaut/adapters/restful_authentication/user_spec.rb +108 -0
  53. data/spec/castronaut/adapters_spec.rb +13 -0
  54. data/spec/castronaut/authentication_result_spec.rb +20 -0
  55. data/spec/castronaut/configuration_spec.rb +172 -0
  56. data/spec/castronaut/models/consumeable_spec.rb +39 -0
  57. data/spec/castronaut/models/dispenser_spec.rb +30 -0
  58. data/spec/castronaut/models/login_ticket_spec.rb +107 -0
  59. data/spec/castronaut/models/proxy_granting_ticket_spec.rb +302 -0
  60. data/spec/castronaut/models/proxy_ticket_spec.rb +109 -0
  61. data/spec/castronaut/models/service_ticket_spec.rb +269 -0
  62. data/spec/castronaut/models/ticket_granting_ticket_spec.rb +89 -0
  63. data/spec/castronaut/presenters/login_spec.rb +152 -0
  64. data/spec/castronaut/presenters/logout_spec.rb +85 -0
  65. data/spec/castronaut/presenters/process_login_spec.rb +300 -0
  66. data/spec/castronaut/presenters/proxy_validate_spec.rb +103 -0
  67. data/spec/castronaut/presenters/service_validate_spec.rb +86 -0
  68. data/spec/castronaut/ticket_result_spec.rb +42 -0
  69. data/spec/castronaut/utilities/random_string_spec.rb +14 -0
  70. data/spec/castronaut_spec.rb +26 -0
  71. data/spec/spec_controller_helper.rb +17 -0
  72. data/spec/spec_helper.rb +39 -0
  73. data/spec/spec_rails_mocks.rb +132 -0
  74. data/vendor/activerecord/CHANGELOG +5786 -0
  75. data/vendor/activerecord/README +351 -0
  76. data/vendor/activerecord/RUNNING_UNIT_TESTS +36 -0
  77. data/vendor/activerecord/Rakefile +247 -0
  78. data/vendor/activerecord/examples/associations.png +0 -0
  79. data/vendor/activerecord/install.rb +30 -0
  80. data/vendor/activerecord/lib/active_record.rb +81 -0
  81. data/vendor/activerecord/lib/active_record/aggregations.rb +261 -0
  82. data/vendor/activerecord/lib/active_record/association_preload.rb +374 -0
  83. data/vendor/activerecord/lib/active_record/associations.rb +2227 -0
  84. data/vendor/activerecord/lib/active_record/associations/association_collection.rb +453 -0
  85. data/vendor/activerecord/lib/active_record/associations/association_proxy.rb +272 -0
  86. data/vendor/activerecord/lib/active_record/associations/belongs_to_association.rb +58 -0
  87. data/vendor/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +49 -0
  88. data/vendor/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +121 -0
  89. data/vendor/activerecord/lib/active_record/associations/has_many_association.rb +121 -0
  90. data/vendor/activerecord/lib/active_record/associations/has_many_through_association.rb +256 -0
  91. data/vendor/activerecord/lib/active_record/associations/has_one_association.rb +115 -0
  92. data/vendor/activerecord/lib/active_record/associations/has_one_through_association.rb +31 -0
  93. data/vendor/activerecord/lib/active_record/attribute_methods.rb +387 -0
  94. data/vendor/activerecord/lib/active_record/base.rb +2967 -0
  95. data/vendor/activerecord/lib/active_record/calculations.rb +299 -0
  96. data/vendor/activerecord/lib/active_record/callbacks.rb +331 -0
  97. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +355 -0
  98. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +136 -0
  99. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +201 -0
  100. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +94 -0
  101. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
  102. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +705 -0
  103. data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +434 -0
  104. data/vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +210 -0
  105. data/vendor/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +585 -0
  106. data/vendor/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +1065 -0
  107. data/vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
  108. data/vendor/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +418 -0
  109. data/vendor/activerecord/lib/active_record/dirty.rb +183 -0
  110. data/vendor/activerecord/lib/active_record/dynamic_finder_match.rb +41 -0
  111. data/vendor/activerecord/lib/active_record/fixtures.rb +998 -0
  112. data/vendor/activerecord/lib/active_record/i18n_interpolation_deprecation.rb +26 -0
  113. data/vendor/activerecord/lib/active_record/locale/en.yml +54 -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 +560 -0
  117. data/vendor/activerecord/lib/active_record/named_scope.rb +181 -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 +307 -0
  121. data/vendor/activerecord/lib/active_record/schema.rb +51 -0
  122. data/vendor/activerecord/lib/active_record/schema_dumper.rb +177 -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 +60 -0
  127. data/vendor/activerecord/lib/active_record/timestamp.rb +41 -0
  128. data/vendor/activerecord/lib/active_record/transactions.rb +185 -0
  129. data/vendor/activerecord/lib/active_record/validations.rb +1061 -0
  130. data/vendor/activerecord/lib/active_record/version.rb +9 -0
  131. data/vendor/activerecord/lib/activerecord.rb +1 -0
  132. data/vendor/activerecord/test/assets/example.log +1 -0
  133. data/vendor/activerecord/test/assets/flowers.jpg +0 -0
  134. data/vendor/activerecord/test/cases/aaa_create_tables_test.rb +24 -0
  135. data/vendor/activerecord/test/cases/active_schema_test_mysql.rb +100 -0
  136. data/vendor/activerecord/test/cases/active_schema_test_postgresql.rb +24 -0
  137. data/vendor/activerecord/test/cases/adapter_test.rb +133 -0
  138. data/vendor/activerecord/test/cases/aggregations_test.rb +167 -0
  139. data/vendor/activerecord/test/cases/ar_schema_test.rb +33 -0
  140. data/vendor/activerecord/test/cases/associations/belongs_to_associations_test.rb +441 -0
  141. data/vendor/activerecord/test/cases/associations/callbacks_test.rb +161 -0
  142. data/vendor/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +123 -0
  143. data/vendor/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
  144. data/vendor/activerecord/test/cases/associations/eager_load_nested_include_test.rb +101 -0
  145. data/vendor/activerecord/test/cases/associations/eager_singularization_test.rb +145 -0
  146. data/vendor/activerecord/test/cases/associations/eager_test.rb +692 -0
  147. data/vendor/activerecord/test/cases/associations/extension_test.rb +62 -0
  148. data/vendor/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +773 -0
  149. data/vendor/activerecord/test/cases/associations/has_many_associations_test.rb +1101 -0
  150. data/vendor/activerecord/test/cases/associations/has_many_through_associations_test.rb +247 -0
  151. data/vendor/activerecord/test/cases/associations/has_one_associations_test.rb +362 -0
  152. data/vendor/activerecord/test/cases/associations/has_one_through_associations_test.rb +161 -0
  153. data/vendor/activerecord/test/cases/associations/inner_join_association_test.rb +88 -0
  154. data/vendor/activerecord/test/cases/associations/join_model_test.rb +714 -0
  155. data/vendor/activerecord/test/cases/associations_test.rb +262 -0
  156. data/vendor/activerecord/test/cases/attribute_methods_test.rb +293 -0
  157. data/vendor/activerecord/test/cases/base_test.rb +2087 -0
  158. data/vendor/activerecord/test/cases/binary_test.rb +30 -0
  159. data/vendor/activerecord/test/cases/calculations_test.rb +328 -0
  160. data/vendor/activerecord/test/cases/callbacks_observers_test.rb +38 -0
  161. data/vendor/activerecord/test/cases/callbacks_test.rb +400 -0
  162. data/vendor/activerecord/test/cases/class_inheritable_attributes_test.rb +32 -0
  163. data/vendor/activerecord/test/cases/column_alias_test.rb +17 -0
  164. data/vendor/activerecord/test/cases/column_definition_test.rb +36 -0
  165. data/vendor/activerecord/test/cases/connection_test_firebird.rb +8 -0
  166. data/vendor/activerecord/test/cases/connection_test_mysql.rb +30 -0
  167. data/vendor/activerecord/test/cases/copy_table_test_sqlite.rb +69 -0
  168. data/vendor/activerecord/test/cases/database_statements_test.rb +12 -0
  169. data/vendor/activerecord/test/cases/datatype_test_postgresql.rb +203 -0
  170. data/vendor/activerecord/test/cases/date_time_test.rb +37 -0
  171. data/vendor/activerecord/test/cases/default_test_firebird.rb +16 -0
  172. data/vendor/activerecord/test/cases/defaults_test.rb +100 -0
  173. data/vendor/activerecord/test/cases/deprecated_finder_test.rb +30 -0
  174. data/vendor/activerecord/test/cases/dirty_test.rb +270 -0
  175. data/vendor/activerecord/test/cases/finder_respond_to_test.rb +76 -0
  176. data/vendor/activerecord/test/cases/finder_test.rb +1048 -0
  177. data/vendor/activerecord/test/cases/fixtures_test.rb +655 -0
  178. data/vendor/activerecord/test/cases/helper.rb +62 -0
  179. data/vendor/activerecord/test/cases/i18n_test.rb +41 -0
  180. data/vendor/activerecord/test/cases/inheritance_test.rb +262 -0
  181. data/vendor/activerecord/test/cases/invalid_date_test.rb +24 -0
  182. data/vendor/activerecord/test/cases/json_serialization_test.rb +205 -0
  183. data/vendor/activerecord/test/cases/lifecycle_test.rb +193 -0
  184. data/vendor/activerecord/test/cases/locking_test.rb +304 -0
  185. data/vendor/activerecord/test/cases/method_scoping_test.rb +569 -0
  186. data/vendor/activerecord/test/cases/migration_test.rb +1479 -0
  187. data/vendor/activerecord/test/cases/migration_test_firebird.rb +124 -0
  188. data/vendor/activerecord/test/cases/mixin_test.rb +96 -0
  189. data/vendor/activerecord/test/cases/modules_test.rb +39 -0
  190. data/vendor/activerecord/test/cases/multiple_db_test.rb +85 -0
  191. data/vendor/activerecord/test/cases/named_scope_test.rb +280 -0
  192. data/vendor/activerecord/test/cases/pk_test.rb +101 -0
  193. data/vendor/activerecord/test/cases/pooled_connections_test.rb +103 -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 +184 -0
  197. data/vendor/activerecord/test/cases/reload_models_test.rb +20 -0
  198. data/vendor/activerecord/test/cases/reserved_word_test_mysql.rb +176 -0
  199. data/vendor/activerecord/test/cases/sanitize_test.rb +25 -0
  200. data/vendor/activerecord/test/cases/schema_authorization_test_postgresql.rb +75 -0
  201. data/vendor/activerecord/test/cases/schema_dumper_test.rb +184 -0
  202. data/vendor/activerecord/test/cases/schema_test_postgresql.rb +102 -0
  203. data/vendor/activerecord/test/cases/serialization_test.rb +47 -0
  204. data/vendor/activerecord/test/cases/synonym_test_oracle.rb +17 -0
  205. data/vendor/activerecord/test/cases/transactions_test.rb +357 -0
  206. data/vendor/activerecord/test/cases/unconnected_test.rb +32 -0
  207. data/vendor/activerecord/test/cases/validations_i18n_test.rb +921 -0
  208. data/vendor/activerecord/test/cases/validations_test.rb +1552 -0
  209. data/vendor/activerecord/test/cases/xml_serialization_test.rb +202 -0
  210. data/vendor/activerecord/test/config.rb +5 -0
  211. data/vendor/activerecord/test/connections/native_db2/connection.rb +25 -0
  212. data/vendor/activerecord/test/connections/native_firebird/connection.rb +26 -0
  213. data/vendor/activerecord/test/connections/native_frontbase/connection.rb +27 -0
  214. data/vendor/activerecord/test/connections/native_mysql/connection.rb +25 -0
  215. data/vendor/activerecord/test/connections/native_openbase/connection.rb +21 -0
  216. data/vendor/activerecord/test/connections/native_oracle/connection.rb +27 -0
  217. data/vendor/activerecord/test/connections/native_postgresql/connection.rb +21 -0
  218. data/vendor/activerecord/test/connections/native_sqlite/connection.rb +25 -0
  219. data/vendor/activerecord/test/connections/native_sqlite3/connection.rb +25 -0
  220. data/vendor/activerecord/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
  221. data/vendor/activerecord/test/connections/native_sybase/connection.rb +23 -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.yml +14 -0
  232. data/vendor/activerecord/test/fixtures/categories/special_categories.yml +9 -0
  233. data/vendor/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -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 +56 -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 +26 -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/organizations.yml +5 -0
  267. data/vendor/activerecord/test/fixtures/owners.yml +7 -0
  268. data/vendor/activerecord/test/fixtures/parrots.yml +27 -0
  269. data/vendor/activerecord/test/fixtures/parrots_pirates.yml +7 -0
  270. data/vendor/activerecord/test/fixtures/people.yml +6 -0
  271. data/vendor/activerecord/test/fixtures/pets.yml +14 -0
  272. data/vendor/activerecord/test/fixtures/pirates.yml +9 -0
  273. data/vendor/activerecord/test/fixtures/posts.yml +49 -0
  274. data/vendor/activerecord/test/fixtures/price_estimates.yml +7 -0
  275. data/vendor/activerecord/test/fixtures/projects.yml +7 -0
  276. data/vendor/activerecord/test/fixtures/readers.yml +9 -0
  277. data/vendor/activerecord/test/fixtures/references.yml +17 -0
  278. data/vendor/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
  279. data/vendor/activerecord/test/fixtures/reserved_words/distincts_selects.yml +11 -0
  280. data/vendor/activerecord/test/fixtures/reserved_words/group.yml +14 -0
  281. data/vendor/activerecord/test/fixtures/reserved_words/select.yml +8 -0
  282. data/vendor/activerecord/test/fixtures/reserved_words/values.yml +7 -0
  283. data/vendor/activerecord/test/fixtures/ships.yml +5 -0
  284. data/vendor/activerecord/test/fixtures/sponsors.yml +9 -0
  285. data/vendor/activerecord/test/fixtures/subscribers.yml +7 -0
  286. data/vendor/activerecord/test/fixtures/subscriptions.yml +12 -0
  287. data/vendor/activerecord/test/fixtures/taggings.yml +28 -0
  288. data/vendor/activerecord/test/fixtures/tags.yml +7 -0
  289. data/vendor/activerecord/test/fixtures/tasks.yml +7 -0
  290. data/vendor/activerecord/test/fixtures/topics.yml +42 -0
  291. data/vendor/activerecord/test/fixtures/treasures.yml +10 -0
  292. data/vendor/activerecord/test/fixtures/vertices.yml +4 -0
  293. data/vendor/activerecord/test/fixtures/warehouse-things.yml +3 -0
  294. data/vendor/activerecord/test/migrations/broken/100_migration_that_raises_exception.rb +10 -0
  295. data/vendor/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
  296. data/vendor/activerecord/test/migrations/duplicate/1_people_have_last_names.rb +9 -0
  297. data/vendor/activerecord/test/migrations/duplicate/2_we_need_reminders.rb +12 -0
  298. data/vendor/activerecord/test/migrations/duplicate/3_foo.rb +7 -0
  299. data/vendor/activerecord/test/migrations/duplicate/3_innocent_jointable.rb +12 -0
  300. data/vendor/activerecord/test/migrations/duplicate_names/20080507052938_chunky.rb +7 -0
  301. data/vendor/activerecord/test/migrations/duplicate_names/20080507053028_chunky.rb +7 -0
  302. data/vendor/activerecord/test/migrations/interleaved/pass_1/3_innocent_jointable.rb +12 -0
  303. data/vendor/activerecord/test/migrations/interleaved/pass_2/1_people_have_last_names.rb +9 -0
  304. data/vendor/activerecord/test/migrations/interleaved/pass_2/3_innocent_jointable.rb +12 -0
  305. data/vendor/activerecord/test/migrations/interleaved/pass_3/1_people_have_last_names.rb +9 -0
  306. data/vendor/activerecord/test/migrations/interleaved/pass_3/2_i_raise_on_down.rb +8 -0
  307. data/vendor/activerecord/test/migrations/interleaved/pass_3/3_innocent_jointable.rb +12 -0
  308. data/vendor/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
  309. data/vendor/activerecord/test/migrations/missing/1_people_have_last_names.rb +9 -0
  310. data/vendor/activerecord/test/migrations/missing/3_we_need_reminders.rb +12 -0
  311. data/vendor/activerecord/test/migrations/missing/4_innocent_jointable.rb +12 -0
  312. data/vendor/activerecord/test/migrations/valid/1_people_have_last_names.rb +9 -0
  313. data/vendor/activerecord/test/migrations/valid/2_we_need_reminders.rb +12 -0
  314. data/vendor/activerecord/test/migrations/valid/3_innocent_jointable.rb +12 -0
  315. data/vendor/activerecord/test/models/author.rb +140 -0
  316. data/vendor/activerecord/test/models/auto_id.rb +4 -0
  317. data/vendor/activerecord/test/models/binary.rb +2 -0
  318. data/vendor/activerecord/test/models/book.rb +4 -0
  319. data/vendor/activerecord/test/models/categorization.rb +5 -0
  320. data/vendor/activerecord/test/models/category.rb +33 -0
  321. data/vendor/activerecord/test/models/citation.rb +6 -0
  322. data/vendor/activerecord/test/models/club.rb +13 -0
  323. data/vendor/activerecord/test/models/column_name.rb +3 -0
  324. data/vendor/activerecord/test/models/comment.rb +25 -0
  325. data/vendor/activerecord/test/models/company.rb +156 -0
  326. data/vendor/activerecord/test/models/company_in_module.rb +61 -0
  327. data/vendor/activerecord/test/models/computer.rb +3 -0
  328. data/vendor/activerecord/test/models/contact.rb +16 -0
  329. data/vendor/activerecord/test/models/course.rb +3 -0
  330. data/vendor/activerecord/test/models/customer.rb +73 -0
  331. data/vendor/activerecord/test/models/default.rb +2 -0
  332. data/vendor/activerecord/test/models/developer.rb +79 -0
  333. data/vendor/activerecord/test/models/edge.rb +5 -0
  334. data/vendor/activerecord/test/models/entrant.rb +3 -0
  335. data/vendor/activerecord/test/models/guid.rb +2 -0
  336. data/vendor/activerecord/test/models/item.rb +7 -0
  337. data/vendor/activerecord/test/models/job.rb +5 -0
  338. data/vendor/activerecord/test/models/joke.rb +3 -0
  339. data/vendor/activerecord/test/models/keyboard.rb +3 -0
  340. data/vendor/activerecord/test/models/legacy_thing.rb +3 -0
  341. data/vendor/activerecord/test/models/matey.rb +4 -0
  342. data/vendor/activerecord/test/models/member.rb +11 -0
  343. data/vendor/activerecord/test/models/member_detail.rb +4 -0
  344. data/vendor/activerecord/test/models/membership.rb +9 -0
  345. data/vendor/activerecord/test/models/minimalistic.rb +2 -0
  346. data/vendor/activerecord/test/models/mixed_case_monkey.rb +3 -0
  347. data/vendor/activerecord/test/models/movie.rb +5 -0
  348. data/vendor/activerecord/test/models/order.rb +4 -0
  349. data/vendor/activerecord/test/models/organization.rb +4 -0
  350. data/vendor/activerecord/test/models/owner.rb +4 -0
  351. data/vendor/activerecord/test/models/parrot.rb +14 -0
  352. data/vendor/activerecord/test/models/person.rb +10 -0
  353. data/vendor/activerecord/test/models/pet.rb +4 -0
  354. data/vendor/activerecord/test/models/pirate.rb +9 -0
  355. data/vendor/activerecord/test/models/post.rb +88 -0
  356. data/vendor/activerecord/test/models/price_estimate.rb +3 -0
  357. data/vendor/activerecord/test/models/project.rb +29 -0
  358. data/vendor/activerecord/test/models/reader.rb +4 -0
  359. data/vendor/activerecord/test/models/reference.rb +4 -0
  360. data/vendor/activerecord/test/models/reply.rb +39 -0
  361. data/vendor/activerecord/test/models/ship.rb +3 -0
  362. data/vendor/activerecord/test/models/sponsor.rb +4 -0
  363. data/vendor/activerecord/test/models/subject.rb +4 -0
  364. data/vendor/activerecord/test/models/subscriber.rb +8 -0
  365. data/vendor/activerecord/test/models/subscription.rb +4 -0
  366. data/vendor/activerecord/test/models/tag.rb +7 -0
  367. data/vendor/activerecord/test/models/tagging.rb +10 -0
  368. data/vendor/activerecord/test/models/task.rb +3 -0
  369. data/vendor/activerecord/test/models/topic.rb +69 -0
  370. data/vendor/activerecord/test/models/treasure.rb +6 -0
  371. data/vendor/activerecord/test/models/vertex.rb +9 -0
  372. data/vendor/activerecord/test/models/warehouse_thing.rb +5 -0
  373. data/vendor/activerecord/test/schema/mysql_specific_schema.rb +12 -0
  374. data/vendor/activerecord/test/schema/postgresql_specific_schema.rb +103 -0
  375. data/vendor/activerecord/test/schema/schema.rb +440 -0
  376. data/vendor/activerecord/test/schema/schema2.rb +6 -0
  377. data/vendor/activerecord/test/schema/sqlite_specific_schema.rb +25 -0
  378. data/vendor/activesupport/CHANGELOG +1257 -0
  379. data/vendor/activesupport/README +43 -0
  380. data/vendor/activesupport/lib/active_support.rb +61 -0
  381. data/vendor/activesupport/lib/active_support/base64.rb +33 -0
  382. data/vendor/activesupport/lib/active_support/basic_object.rb +24 -0
  383. data/vendor/activesupport/lib/active_support/buffered_logger.rb +122 -0
  384. data/vendor/activesupport/lib/active_support/cache.rb +223 -0
  385. data/vendor/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb +20 -0
  386. data/vendor/activesupport/lib/active_support/cache/drb_store.rb +15 -0
  387. data/vendor/activesupport/lib/active_support/cache/file_store.rb +72 -0
  388. data/vendor/activesupport/lib/active_support/cache/mem_cache_store.rb +127 -0
  389. data/vendor/activesupport/lib/active_support/cache/memory_store.rb +52 -0
  390. data/vendor/activesupport/lib/active_support/cache/synchronized_memory_store.rb +47 -0
  391. data/vendor/activesupport/lib/active_support/callbacks.rb +280 -0
  392. data/vendor/activesupport/lib/active_support/core_ext.rb +4 -0
  393. data/vendor/activesupport/lib/active_support/core_ext/array.rb +13 -0
  394. data/vendor/activesupport/lib/active_support/core_ext/array/access.rb +53 -0
  395. data/vendor/activesupport/lib/active_support/core_ext/array/conversions.rb +183 -0
  396. data/vendor/activesupport/lib/active_support/core_ext/array/extract_options.rb +20 -0
  397. data/vendor/activesupport/lib/active_support/core_ext/array/grouping.rb +106 -0
  398. data/vendor/activesupport/lib/active_support/core_ext/array/random_access.rb +12 -0
  399. data/vendor/activesupport/lib/active_support/core_ext/base64.rb +4 -0
  400. data/vendor/activesupport/lib/active_support/core_ext/base64/encoding.rb +16 -0
  401. data/vendor/activesupport/lib/active_support/core_ext/benchmark.rb +12 -0
  402. data/vendor/activesupport/lib/active_support/core_ext/bigdecimal.rb +6 -0
  403. data/vendor/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb +37 -0
  404. data/vendor/activesupport/lib/active_support/core_ext/blank.rb +58 -0
  405. data/vendor/activesupport/lib/active_support/core_ext/cgi.rb +5 -0
  406. data/vendor/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +14 -0
  407. data/vendor/activesupport/lib/active_support/core_ext/class.rb +4 -0
  408. data/vendor/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +54 -0
  409. data/vendor/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +46 -0
  410. data/vendor/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +140 -0
  411. data/vendor/activesupport/lib/active_support/core_ext/class/removal.rb +50 -0
  412. data/vendor/activesupport/lib/active_support/core_ext/date.rb +10 -0
  413. data/vendor/activesupport/lib/active_support/core_ext/date/behavior.rb +42 -0
  414. data/vendor/activesupport/lib/active_support/core_ext/date/calculations.rb +230 -0
  415. data/vendor/activesupport/lib/active_support/core_ext/date/conversions.rb +107 -0
  416. data/vendor/activesupport/lib/active_support/core_ext/date_time.rb +12 -0
  417. data/vendor/activesupport/lib/active_support/core_ext/date_time/calculations.rb +126 -0
  418. data/vendor/activesupport/lib/active_support/core_ext/date_time/conversions.rb +96 -0
  419. data/vendor/activesupport/lib/active_support/core_ext/duplicable.rb +43 -0
  420. data/vendor/activesupport/lib/active_support/core_ext/enumerable.rb +107 -0
  421. data/vendor/activesupport/lib/active_support/core_ext/exception.rb +41 -0
  422. data/vendor/activesupport/lib/active_support/core_ext/file.rb +5 -0
  423. data/vendor/activesupport/lib/active_support/core_ext/file/atomic.rb +46 -0
  424. data/vendor/activesupport/lib/active_support/core_ext/float.rb +7 -0
  425. data/vendor/activesupport/lib/active_support/core_ext/float/rounding.rb +24 -0
  426. data/vendor/activesupport/lib/active_support/core_ext/float/time.rb +27 -0
  427. data/vendor/activesupport/lib/active_support/core_ext/hash.rb +14 -0
  428. data/vendor/activesupport/lib/active_support/core_ext/hash/conversions.rb +259 -0
  429. data/vendor/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +23 -0
  430. data/vendor/activesupport/lib/active_support/core_ext/hash/diff.rb +19 -0
  431. data/vendor/activesupport/lib/active_support/core_ext/hash/except.rb +25 -0
  432. data/vendor/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +137 -0
  433. data/vendor/activesupport/lib/active_support/core_ext/hash/keys.rb +52 -0
  434. data/vendor/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +35 -0
  435. data/vendor/activesupport/lib/active_support/core_ext/hash/slice.rb +33 -0
  436. data/vendor/activesupport/lib/active_support/core_ext/integer.rb +9 -0
  437. data/vendor/activesupport/lib/active_support/core_ext/integer/even_odd.rb +29 -0
  438. data/vendor/activesupport/lib/active_support/core_ext/integer/inflections.rb +20 -0
  439. data/vendor/activesupport/lib/active_support/core_ext/integer/time.rb +45 -0
  440. data/vendor/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
  441. data/vendor/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
  442. data/vendor/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb +7 -0
  443. data/vendor/activesupport/lib/active_support/core_ext/kernel/debugger.rb +13 -0
  444. data/vendor/activesupport/lib/active_support/core_ext/kernel/reporting.rb +59 -0
  445. data/vendor/activesupport/lib/active_support/core_ext/kernel/requires.rb +24 -0
  446. data/vendor/activesupport/lib/active_support/core_ext/load_error.rb +38 -0
  447. data/vendor/activesupport/lib/active_support/core_ext/logger.rb +143 -0
  448. data/vendor/activesupport/lib/active_support/core_ext/module.rb +23 -0
  449. data/vendor/activesupport/lib/active_support/core_ext/module/aliasing.rb +74 -0
  450. data/vendor/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
  451. data/vendor/activesupport/lib/active_support/core_ext/module/attr_internal.rb +32 -0
  452. data/vendor/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +58 -0
  453. data/vendor/activesupport/lib/active_support/core_ext/module/delegation.rb +95 -0
  454. data/vendor/activesupport/lib/active_support/core_ext/module/inclusion.rb +30 -0
  455. data/vendor/activesupport/lib/active_support/core_ext/module/introspection.rb +90 -0
  456. data/vendor/activesupport/lib/active_support/core_ext/module/loading.rb +23 -0
  457. data/vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb +23 -0
  458. data/vendor/activesupport/lib/active_support/core_ext/module/synchronization.rb +39 -0
  459. data/vendor/activesupport/lib/active_support/core_ext/name_error.rb +17 -0
  460. data/vendor/activesupport/lib/active_support/core_ext/numeric.rb +9 -0
  461. data/vendor/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
  462. data/vendor/activesupport/lib/active_support/core_ext/numeric/conversions.rb +19 -0
  463. data/vendor/activesupport/lib/active_support/core_ext/numeric/time.rb +81 -0
  464. data/vendor/activesupport/lib/active_support/core_ext/object.rb +5 -0
  465. data/vendor/activesupport/lib/active_support/core_ext/object/conversions.rb +14 -0
  466. data/vendor/activesupport/lib/active_support/core_ext/object/extending.rb +80 -0
  467. data/vendor/activesupport/lib/active_support/core_ext/object/instance_variables.rb +74 -0
  468. data/vendor/activesupport/lib/active_support/core_ext/object/metaclass.rb +13 -0
  469. data/vendor/activesupport/lib/active_support/core_ext/object/misc.rb +74 -0
  470. data/vendor/activesupport/lib/active_support/core_ext/pathname.rb +7 -0
  471. data/vendor/activesupport/lib/active_support/core_ext/pathname/clean_within.rb +14 -0
  472. data/vendor/activesupport/lib/active_support/core_ext/proc.rb +12 -0
  473. data/vendor/activesupport/lib/active_support/core_ext/process.rb +1 -0
  474. data/vendor/activesupport/lib/active_support/core_ext/process/daemon.rb +25 -0
  475. data/vendor/activesupport/lib/active_support/core_ext/range.rb +11 -0
  476. data/vendor/activesupport/lib/active_support/core_ext/range/blockless_step.rb +32 -0
  477. data/vendor/activesupport/lib/active_support/core_ext/range/conversions.rb +27 -0
  478. data/vendor/activesupport/lib/active_support/core_ext/range/include_range.rb +30 -0
  479. data/vendor/activesupport/lib/active_support/core_ext/range/overlaps.rb +15 -0
  480. data/vendor/activesupport/lib/active_support/core_ext/rexml.rb +36 -0
  481. data/vendor/activesupport/lib/active_support/core_ext/string.rb +22 -0
  482. data/vendor/activesupport/lib/active_support/core_ext/string/access.rb +82 -0
  483. data/vendor/activesupport/lib/active_support/core_ext/string/behavior.rb +13 -0
  484. data/vendor/activesupport/lib/active_support/core_ext/string/conversions.rb +28 -0
  485. data/vendor/activesupport/lib/active_support/core_ext/string/filters.rb +26 -0
  486. data/vendor/activesupport/lib/active_support/core_ext/string/inflections.rb +167 -0
  487. data/vendor/activesupport/lib/active_support/core_ext/string/iterators.rb +21 -0
  488. data/vendor/activesupport/lib/active_support/core_ext/string/multibyte.rb +81 -0
  489. data/vendor/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +35 -0
  490. data/vendor/activesupport/lib/active_support/core_ext/string/xchar.rb +11 -0
  491. data/vendor/activesupport/lib/active_support/core_ext/symbol.rb +14 -0
  492. data/vendor/activesupport/lib/active_support/core_ext/time.rb +42 -0
  493. data/vendor/activesupport/lib/active_support/core_ext/time/behavior.rb +13 -0
  494. data/vendor/activesupport/lib/active_support/core_ext/time/calculations.rb +303 -0
  495. data/vendor/activesupport/lib/active_support/core_ext/time/conversions.rb +90 -0
  496. data/vendor/activesupport/lib/active_support/core_ext/time/zones.rb +86 -0
  497. data/vendor/activesupport/lib/active_support/dependencies.rb +621 -0
  498. data/vendor/activesupport/lib/active_support/deprecation.rb +243 -0
  499. data/vendor/activesupport/lib/active_support/duration.rb +96 -0
  500. data/vendor/activesupport/lib/active_support/gzip.rb +25 -0
  501. data/vendor/activesupport/lib/active_support/inflections.rb +55 -0
  502. data/vendor/activesupport/lib/active_support/inflector.rb +397 -0
  503. data/vendor/activesupport/lib/active_support/json.rb +23 -0
  504. data/vendor/activesupport/lib/active_support/json/decoding.rb +63 -0
  505. data/vendor/activesupport/lib/active_support/json/encoders/date.rb +21 -0
  506. data/vendor/activesupport/lib/active_support/json/encoders/date_time.rb +21 -0
  507. data/vendor/activesupport/lib/active_support/json/encoders/enumerable.rb +12 -0
  508. data/vendor/activesupport/lib/active_support/json/encoders/false_class.rb +5 -0
  509. data/vendor/activesupport/lib/active_support/json/encoders/hash.rb +47 -0
  510. data/vendor/activesupport/lib/active_support/json/encoders/nil_class.rb +5 -0
  511. data/vendor/activesupport/lib/active_support/json/encoders/numeric.rb +5 -0
  512. data/vendor/activesupport/lib/active_support/json/encoders/object.rb +6 -0
  513. data/vendor/activesupport/lib/active_support/json/encoders/regexp.rb +5 -0
  514. data/vendor/activesupport/lib/active_support/json/encoders/string.rb +36 -0
  515. data/vendor/activesupport/lib/active_support/json/encoders/symbol.rb +5 -0
  516. data/vendor/activesupport/lib/active_support/json/encoders/time.rb +21 -0
  517. data/vendor/activesupport/lib/active_support/json/encoders/true_class.rb +5 -0
  518. data/vendor/activesupport/lib/active_support/json/encoding.rb +37 -0
  519. data/vendor/activesupport/lib/active_support/json/variable.rb +10 -0
  520. data/vendor/activesupport/lib/active_support/locale/en.yml +32 -0
  521. data/vendor/activesupport/lib/active_support/memoizable.rb +82 -0
  522. data/vendor/activesupport/lib/active_support/multibyte.rb +33 -0
  523. data/vendor/activesupport/lib/active_support/multibyte/chars.rb +679 -0
  524. data/vendor/activesupport/lib/active_support/multibyte/exceptions.rb +8 -0
  525. data/vendor/activesupport/lib/active_support/multibyte/unicode_database.rb +71 -0
  526. data/vendor/activesupport/lib/active_support/option_merger.rb +17 -0
  527. data/vendor/activesupport/lib/active_support/ordered_hash.rb +58 -0
  528. data/vendor/activesupport/lib/active_support/ordered_options.rb +19 -0
  529. data/vendor/activesupport/lib/active_support/rescuable.rb +108 -0
  530. data/vendor/activesupport/lib/active_support/secure_random.rb +197 -0
  531. data/vendor/activesupport/lib/active_support/string_inquirer.rb +21 -0
  532. data/vendor/activesupport/lib/active_support/test_case.rb +24 -0
  533. data/vendor/activesupport/lib/active_support/testing/core_ext/test.rb +6 -0
  534. data/vendor/activesupport/lib/active_support/testing/core_ext/test/unit/assertions.rb +72 -0
  535. data/vendor/activesupport/lib/active_support/testing/default.rb +9 -0
  536. data/vendor/activesupport/lib/active_support/testing/performance.rb +452 -0
  537. data/vendor/activesupport/lib/active_support/testing/setup_and_teardown.rb +120 -0
  538. data/vendor/activesupport/lib/active_support/time_with_zone.rb +328 -0
  539. data/vendor/activesupport/lib/active_support/values/time_zone.rb +403 -0
  540. data/vendor/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
  541. data/vendor/activesupport/lib/active_support/vendor.rb +34 -0
  542. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb +113 -0
  543. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder.rb +13 -0
  544. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +20 -0
  545. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/css.rb +250 -0
  546. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +115 -0
  547. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +139 -0
  548. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +63 -0
  549. data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +328 -0
  550. data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb +194 -0
  551. data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +216 -0
  552. data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/exceptions.rb +53 -0
  553. data/vendor/activesupport/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb +849 -0
  554. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb +33 -0
  555. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb +47 -0
  556. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb +228 -0
  557. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb +55 -0
  558. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb +219 -0
  559. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb +40 -0
  560. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb +18 -0
  561. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
  562. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb +22 -0
  563. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb +23 -0
  564. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
  565. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb +86 -0
  566. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb +23 -0
  567. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb +23 -0
  568. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb +283 -0
  569. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb +136 -0
  570. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb +204 -0
  571. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb +161 -0
  572. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb +27 -0
  573. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb +274 -0
  574. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
  575. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb +194 -0
  576. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb +22 -0
  577. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb +35 -0
  578. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb +232 -0
  579. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb +139 -0
  580. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb +144 -0
  581. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb +131 -0
  582. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb +282 -0
  583. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb +30 -0
  584. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb +74 -0
  585. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb +205 -0
  586. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb +171 -0
  587. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb +288 -0
  588. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb +196 -0
  589. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb +67 -0
  590. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb +73 -0
  591. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb +161 -0
  592. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb +20 -0
  593. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb +33 -0
  594. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb +30 -0
  595. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb +27 -0
  596. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
  597. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
  598. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb +30 -0
  599. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
  600. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb +20 -0
  601. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
  602. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb +30 -0
  603. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb +20 -0
  604. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb +25 -0
  605. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
  606. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
  607. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb +18 -0
  608. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb +163 -0
  609. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb +18 -0
  610. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
  611. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb +24 -0
  612. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb +18 -0
  613. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb +34 -0
  614. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb +35 -0
  615. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb +33 -0
  616. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb +59 -0
  617. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb +47 -0
  618. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
  619. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb +121 -0
  620. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb +30 -0
  621. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
  622. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb +33 -0
  623. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
  624. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
  625. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
  626. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb +165 -0
  627. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb +270 -0
  628. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
  629. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
  630. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb +187 -0
  631. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb +35 -0
  632. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb +29 -0
  633. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb +193 -0
  634. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb +185 -0
  635. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb +37 -0
  636. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb +185 -0
  637. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb +16 -0
  638. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
  639. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb +185 -0
  640. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb +163 -0
  641. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb +188 -0
  642. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb +13 -0
  643. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb +232 -0
  644. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb +181 -0
  645. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb +197 -0
  646. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
  647. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb +276 -0
  648. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb +163 -0
  649. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb +218 -0
  650. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb +168 -0
  651. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb +268 -0
  652. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
  653. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb +288 -0
  654. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb +211 -0
  655. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb +170 -0
  656. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb +181 -0
  657. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb +232 -0
  658. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb +187 -0
  659. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb +176 -0
  660. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb +215 -0
  661. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
  662. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb +13 -0
  663. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb +173 -0
  664. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb +165 -0
  665. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb +172 -0
  666. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb +183 -0
  667. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb +170 -0
  668. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb +212 -0
  669. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb +13 -0
  670. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb +202 -0
  671. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb +23 -0
  672. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb +22 -0
  673. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
  674. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb +20 -0
  675. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb +25 -0
  676. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb +25 -0
  677. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
  678. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
  679. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
  680. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb +52 -0
  681. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb +51 -0
  682. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb +44 -0
  683. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb +98 -0
  684. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb +56 -0
  685. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb +292 -0
  686. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb +508 -0
  687. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb +56 -0
  688. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb +40 -0
  689. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb +94 -0
  690. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb +198 -0
  691. data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb +129 -0
  692. data/vendor/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +1021 -0
  693. data/vendor/activesupport/lib/active_support/version.rb +9 -0
  694. data/vendor/activesupport/lib/active_support/whiny_nil.rb +58 -0
  695. data/vendor/activesupport/lib/activesupport.rb +1 -0
  696. data/vendor/isaac/LICENSE +26 -0
  697. data/vendor/isaac/README +78 -0
  698. data/vendor/isaac/TODO +3 -0
  699. data/vendor/isaac/VERSIONS +3 -0
  700. data/vendor/isaac/crypt/ISAAC.rb +171 -0
  701. data/vendor/isaac/isaac.gemspec +39 -0
  702. data/vendor/isaac/setup.rb +596 -0
  703. data/vendor/isaac/test/TC_ISAAC.rb +76 -0
  704. data/vendor/json/CHANGES +93 -0
  705. data/vendor/json/GPL +340 -0
  706. data/vendor/json/README +78 -0
  707. data/vendor/json/RUBY +58 -0
  708. data/vendor/json/Rakefile +309 -0
  709. data/vendor/json/TODO +1 -0
  710. data/vendor/json/VERSION +1 -0
  711. data/vendor/json/benchmarks/benchmark.txt +133 -0
  712. data/vendor/json/benchmarks/benchmark_generator.rb +48 -0
  713. data/vendor/json/benchmarks/benchmark_parser.rb +26 -0
  714. data/vendor/json/benchmarks/benchmark_rails.rb +26 -0
  715. data/vendor/json/bin/edit_json.rb +10 -0
  716. data/vendor/json/bin/prettify_json.rb +76 -0
  717. data/vendor/json/data/example.json +1 -0
  718. data/vendor/json/data/index.html +38 -0
  719. data/vendor/json/data/prototype.js +4184 -0
  720. data/vendor/json/ext/json/ext/generator/extconf.rb +9 -0
  721. data/vendor/json/ext/json/ext/generator/generator.c +875 -0
  722. data/vendor/json/ext/json/ext/generator/unicode.c +182 -0
  723. data/vendor/json/ext/json/ext/generator/unicode.h +53 -0
  724. data/vendor/json/ext/json/ext/parser/extconf.rb +9 -0
  725. data/vendor/json/ext/json/ext/parser/parser.c +1758 -0
  726. data/vendor/json/ext/json/ext/parser/parser.rl +638 -0
  727. data/vendor/json/ext/json/ext/parser/unicode.c +154 -0
  728. data/vendor/json/ext/json/ext/parser/unicode.h +58 -0
  729. data/vendor/json/install.rb +26 -0
  730. data/vendor/json/lib/json.rb +235 -0
  731. data/vendor/json/lib/json/Array.xpm +21 -0
  732. data/vendor/json/lib/json/FalseClass.xpm +21 -0
  733. data/vendor/json/lib/json/Hash.xpm +21 -0
  734. data/vendor/json/lib/json/Key.xpm +73 -0
  735. data/vendor/json/lib/json/NilClass.xpm +21 -0
  736. data/vendor/json/lib/json/Numeric.xpm +28 -0
  737. data/vendor/json/lib/json/String.xpm +96 -0
  738. data/vendor/json/lib/json/TrueClass.xpm +21 -0
  739. data/vendor/json/lib/json/add/core.rb +135 -0
  740. data/vendor/json/lib/json/add/rails.rb +58 -0
  741. data/vendor/json/lib/json/common.rb +354 -0
  742. data/vendor/json/lib/json/editor.rb +1362 -0
  743. data/vendor/json/lib/json/ext.rb +13 -0
  744. data/vendor/json/lib/json/json.xpm +1499 -0
  745. data/vendor/json/lib/json/pure.rb +75 -0
  746. data/vendor/json/lib/json/pure/generator.rb +394 -0
  747. data/vendor/json/lib/json/pure/parser.rb +259 -0
  748. data/vendor/json/lib/json/version.rb +9 -0
  749. data/vendor/json/tests/fixtures/fail1.json +1 -0
  750. data/vendor/json/tests/fixtures/fail10.json +1 -0
  751. data/vendor/json/tests/fixtures/fail11.json +1 -0
  752. data/vendor/json/tests/fixtures/fail12.json +1 -0
  753. data/vendor/json/tests/fixtures/fail13.json +1 -0
  754. data/vendor/json/tests/fixtures/fail14.json +1 -0
  755. data/vendor/json/tests/fixtures/fail18.json +1 -0
  756. data/vendor/json/tests/fixtures/fail19.json +1 -0
  757. data/vendor/json/tests/fixtures/fail2.json +1 -0
  758. data/vendor/json/tests/fixtures/fail20.json +1 -0
  759. data/vendor/json/tests/fixtures/fail21.json +1 -0
  760. data/vendor/json/tests/fixtures/fail22.json +1 -0
  761. data/vendor/json/tests/fixtures/fail23.json +1 -0
  762. data/vendor/json/tests/fixtures/fail24.json +1 -0
  763. data/vendor/json/tests/fixtures/fail25.json +1 -0
  764. data/vendor/json/tests/fixtures/fail27.json +2 -0
  765. data/vendor/json/tests/fixtures/fail28.json +2 -0
  766. data/vendor/json/tests/fixtures/fail3.json +1 -0
  767. data/vendor/json/tests/fixtures/fail4.json +1 -0
  768. data/vendor/json/tests/fixtures/fail5.json +1 -0
  769. data/vendor/json/tests/fixtures/fail6.json +1 -0
  770. data/vendor/json/tests/fixtures/fail7.json +1 -0
  771. data/vendor/json/tests/fixtures/fail8.json +1 -0
  772. data/vendor/json/tests/fixtures/fail9.json +1 -0
  773. data/vendor/json/tests/fixtures/pass1.json +56 -0
  774. data/vendor/json/tests/fixtures/pass15.json +1 -0
  775. data/vendor/json/tests/fixtures/pass16.json +1 -0
  776. data/vendor/json/tests/fixtures/pass17.json +1 -0
  777. data/vendor/json/tests/fixtures/pass2.json +1 -0
  778. data/vendor/json/tests/fixtures/pass26.json +1 -0
  779. data/vendor/json/tests/fixtures/pass3.json +6 -0
  780. data/vendor/json/tests/runner.rb +25 -0
  781. data/vendor/json/tests/test_json.rb +293 -0
  782. data/vendor/json/tests/test_json_addition.rb +161 -0
  783. data/vendor/json/tests/test_json_fixtures.rb +30 -0
  784. data/vendor/json/tests/test_json_generate.rb +100 -0
  785. data/vendor/json/tests/test_json_rails.rb +118 -0
  786. data/vendor/json/tests/test_json_unicode.rb +61 -0
  787. data/vendor/json/tools/fuzz.rb +140 -0
  788. data/vendor/json/tools/server.rb +62 -0
  789. metadata +841 -0
@@ -0,0 +1,1479 @@
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
+ # 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?(: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?(: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
+ else
855
+ # - SQL standard is an integer
856
+ assert_kind_of Fixnum, b.value_of_e
857
+ assert_equal 2, b.value_of_e
858
+ end
859
+
860
+ GiveMeBigNumbers.down
861
+ assert_raises(ActiveRecord::StatementInvalid) { BigNumber.find(:first) }
862
+ end
863
+
864
+ def test_migrator
865
+ assert !Person.column_methods_hash.include?(:last_name)
866
+ assert !Reminder.table_exists?
867
+
868
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid")
869
+
870
+ assert_equal 3, ActiveRecord::Migrator.current_version
871
+ Person.reset_column_information
872
+ assert Person.column_methods_hash.include?(:last_name)
873
+ assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
874
+ assert_equal "hello world", Reminder.find(:first).content
875
+
876
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid")
877
+
878
+ assert_equal 0, ActiveRecord::Migrator.current_version
879
+ Person.reset_column_information
880
+ assert !Person.column_methods_hash.include?(:last_name)
881
+ assert_raises(ActiveRecord::StatementInvalid) { Reminder.find(:first) }
882
+ end
883
+
884
+ def test_migrator_one_up
885
+ assert !Person.column_methods_hash.include?(:last_name)
886
+ assert !Reminder.table_exists?
887
+
888
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
889
+
890
+ Person.reset_column_information
891
+ assert Person.column_methods_hash.include?(:last_name)
892
+ assert !Reminder.table_exists?
893
+
894
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 2)
895
+
896
+ assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
897
+ assert_equal "hello world", Reminder.find(:first).content
898
+ end
899
+
900
+ def test_migrator_one_down
901
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid")
902
+
903
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 1)
904
+
905
+ Person.reset_column_information
906
+ assert Person.column_methods_hash.include?(:last_name)
907
+ assert !Reminder.table_exists?
908
+ end
909
+
910
+ def test_migrator_one_up_one_down
911
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
912
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 0)
913
+
914
+ assert !Person.column_methods_hash.include?(:last_name)
915
+ assert !Reminder.table_exists?
916
+ end
917
+
918
+ def test_migrator_double_up
919
+ assert_equal(0, ActiveRecord::Migrator.current_version)
920
+ ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + "/valid", 1)
921
+ assert_nothing_raised { ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + "/valid", 1) }
922
+ assert_equal(1, ActiveRecord::Migrator.current_version)
923
+ end
924
+
925
+ def test_migrator_double_down
926
+ assert_equal(0, ActiveRecord::Migrator.current_version)
927
+ ActiveRecord::Migrator.run(:up, MIGRATIONS_ROOT + "/valid", 1)
928
+ ActiveRecord::Migrator.run(:down, MIGRATIONS_ROOT + "/valid", 1)
929
+ assert_nothing_raised { ActiveRecord::Migrator.run(:down, MIGRATIONS_ROOT + "/valid", 1) }
930
+ assert_equal(0, ActiveRecord::Migrator.current_version)
931
+ end
932
+
933
+ if current_adapter?(:PostgreSQLAdapter)
934
+ def test_migrator_one_up_with_exception_and_rollback
935
+ assert !Person.column_methods_hash.include?(:last_name)
936
+
937
+ e = assert_raises(StandardError) do
938
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/broken", 100)
939
+ end
940
+
941
+ assert_equal "An error has occurred, this and all later migrations canceled:\n\nSomething broke", e.message
942
+
943
+ Person.reset_column_information
944
+ assert !Person.column_methods_hash.include?(:last_name)
945
+ end
946
+ end
947
+
948
+ def test_finds_migrations
949
+ migrations = ActiveRecord::Migrator.new(:up, MIGRATIONS_ROOT + "/valid").migrations
950
+ [['1', 'people_have_last_names'],
951
+ ['2', 'we_need_reminders'],
952
+ ['3', 'innocent_jointable']].each_with_index do |pair, i|
953
+ migrations[i].version == pair.first
954
+ migrations[1].name == pair.last
955
+ end
956
+ end
957
+
958
+ def test_finds_pending_migrations
959
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/interleaved/pass_2", 1)
960
+ migrations = ActiveRecord::Migrator.new(:up, MIGRATIONS_ROOT + "/interleaved/pass_2").pending_migrations
961
+ assert_equal 1, migrations.size
962
+ migrations[0].version == '3'
963
+ migrations[0].name == 'innocent_jointable'
964
+ end
965
+
966
+ def test_only_loads_pending_migrations
967
+ # migrate up to 1
968
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
969
+
970
+ # now unload the migrations that have been defined
971
+ PeopleHaveLastNames.unloadable
972
+ ActiveSupport::Dependencies.remove_unloadable_constants!
973
+
974
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", nil)
975
+
976
+ assert !defined? PeopleHaveLastNames
977
+
978
+ %w(WeNeedReminders, InnocentJointable).each do |migration|
979
+ assert defined? migration
980
+ end
981
+
982
+ ensure
983
+ load(MIGRATIONS_ROOT + "/valid/1_people_have_last_names.rb")
984
+ end
985
+
986
+ def test_migrator_interleaved_migrations
987
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/interleaved/pass_1")
988
+
989
+ assert_nothing_raised do
990
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/interleaved/pass_2")
991
+ end
992
+
993
+ Person.reset_column_information
994
+ assert Person.column_methods_hash.include?(:last_name)
995
+
996
+ assert_nothing_raised do
997
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/interleaved/pass_3")
998
+ end
999
+ end
1000
+
1001
+ def test_migrator_db_has_no_schema_migrations_table
1002
+ ActiveRecord::Base.connection.execute("DROP TABLE schema_migrations;")
1003
+ assert_nothing_raised do
1004
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 1)
1005
+ end
1006
+ end
1007
+
1008
+ def test_migrator_verbosity
1009
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
1010
+ assert PeopleHaveLastNames.message_count > 0
1011
+ PeopleHaveLastNames.message_count = 0
1012
+
1013
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 0)
1014
+ assert PeopleHaveLastNames.message_count > 0
1015
+ PeopleHaveLastNames.message_count = 0
1016
+ end
1017
+
1018
+ def test_migrator_verbosity_off
1019
+ PeopleHaveLastNames.verbose = false
1020
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
1021
+ assert PeopleHaveLastNames.message_count.zero?
1022
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid", 0)
1023
+ assert PeopleHaveLastNames.message_count.zero?
1024
+ end
1025
+
1026
+ def test_migrator_going_down_due_to_version_target
1027
+ ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/valid", 1)
1028
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 0)
1029
+
1030
+ assert !Person.column_methods_hash.include?(:last_name)
1031
+ assert !Reminder.table_exists?
1032
+
1033
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid")
1034
+
1035
+ Person.reset_column_information
1036
+ assert Person.column_methods_hash.include?(:last_name)
1037
+ assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
1038
+ assert_equal "hello world", Reminder.find(:first).content
1039
+ end
1040
+
1041
+ def test_migrator_rollback
1042
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid")
1043
+ assert_equal(3, ActiveRecord::Migrator.current_version)
1044
+
1045
+ ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
1046
+ assert_equal(2, ActiveRecord::Migrator.current_version)
1047
+
1048
+ ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
1049
+ assert_equal(1, ActiveRecord::Migrator.current_version)
1050
+
1051
+ ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
1052
+ assert_equal(0, ActiveRecord::Migrator.current_version)
1053
+
1054
+ ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
1055
+ assert_equal(0, ActiveRecord::Migrator.current_version)
1056
+ end
1057
+
1058
+ def test_schema_migrations_table_name
1059
+ ActiveRecord::Base.table_name_prefix = "prefix_"
1060
+ ActiveRecord::Base.table_name_suffix = "_suffix"
1061
+ Reminder.reset_table_name
1062
+ assert_equal "prefix_schema_migrations_suffix", ActiveRecord::Migrator.schema_migrations_table_name
1063
+ ActiveRecord::Base.table_name_prefix = ""
1064
+ ActiveRecord::Base.table_name_suffix = ""
1065
+ Reminder.reset_table_name
1066
+ assert_equal "schema_migrations", ActiveRecord::Migrator.schema_migrations_table_name
1067
+ ensure
1068
+ ActiveRecord::Base.table_name_prefix = ""
1069
+ ActiveRecord::Base.table_name_suffix = ""
1070
+ end
1071
+
1072
+ def test_proper_table_name
1073
+ assert_equal "table", ActiveRecord::Migrator.proper_table_name('table')
1074
+ assert_equal "table", ActiveRecord::Migrator.proper_table_name(:table)
1075
+ assert_equal "reminders", ActiveRecord::Migrator.proper_table_name(Reminder)
1076
+ Reminder.reset_table_name
1077
+ assert_equal Reminder.table_name, ActiveRecord::Migrator.proper_table_name(Reminder)
1078
+
1079
+ # Use the model's own prefix/suffix if a model is given
1080
+ ActiveRecord::Base.table_name_prefix = "ARprefix_"
1081
+ ActiveRecord::Base.table_name_suffix = "_ARsuffix"
1082
+ Reminder.table_name_prefix = 'prefix_'
1083
+ Reminder.table_name_suffix = '_suffix'
1084
+ Reminder.reset_table_name
1085
+ assert_equal "prefix_reminders_suffix", ActiveRecord::Migrator.proper_table_name(Reminder)
1086
+ Reminder.table_name_prefix = ''
1087
+ Reminder.table_name_suffix = ''
1088
+ Reminder.reset_table_name
1089
+
1090
+ # Use AR::Base's prefix/suffix if string or symbol is given
1091
+ ActiveRecord::Base.table_name_prefix = "prefix_"
1092
+ ActiveRecord::Base.table_name_suffix = "_suffix"
1093
+ Reminder.reset_table_name
1094
+ assert_equal "prefix_table_suffix", ActiveRecord::Migrator.proper_table_name('table')
1095
+ assert_equal "prefix_table_suffix", ActiveRecord::Migrator.proper_table_name(:table)
1096
+ ActiveRecord::Base.table_name_prefix = ""
1097
+ ActiveRecord::Base.table_name_suffix = ""
1098
+ Reminder.reset_table_name
1099
+ end
1100
+
1101
+ def test_add_drop_table_with_prefix_and_suffix
1102
+ assert !Reminder.table_exists?
1103
+ ActiveRecord::Base.table_name_prefix = 'prefix_'
1104
+ ActiveRecord::Base.table_name_suffix = '_suffix'
1105
+ Reminder.reset_table_name
1106
+ Reminder.reset_sequence_name
1107
+ WeNeedReminders.up
1108
+ assert Reminder.create("content" => "hello world", "remind_at" => Time.now)
1109
+ assert_equal "hello world", Reminder.find(:first).content
1110
+
1111
+ WeNeedReminders.down
1112
+ assert_raises(ActiveRecord::StatementInvalid) { Reminder.find(:first) }
1113
+ ensure
1114
+ ActiveRecord::Base.table_name_prefix = ''
1115
+ ActiveRecord::Base.table_name_suffix = ''
1116
+ Reminder.reset_table_name
1117
+ Reminder.reset_sequence_name
1118
+ end
1119
+
1120
+ def test_create_table_with_binary_column
1121
+ Person.connection.drop_table :binary_testings rescue nil
1122
+
1123
+ assert_nothing_raised {
1124
+ Person.connection.create_table :binary_testings do |t|
1125
+ t.column "data", :binary, :null => false
1126
+ end
1127
+ }
1128
+
1129
+ columns = Person.connection.columns(:binary_testings)
1130
+ data_column = columns.detect { |c| c.name == "data" }
1131
+
1132
+ if current_adapter?(:MysqlAdapter)
1133
+ assert_equal '', data_column.default
1134
+ else
1135
+ assert_nil data_column.default
1136
+ end
1137
+
1138
+ Person.connection.drop_table :binary_testings rescue nil
1139
+ end
1140
+
1141
+ def test_migrator_with_duplicates
1142
+ assert_raises(ActiveRecord::DuplicateMigrationVersionError) do
1143
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/duplicate", nil)
1144
+ end
1145
+ end
1146
+
1147
+ def test_migrator_with_duplicate_names
1148
+ assert_raises(ActiveRecord::DuplicateMigrationNameError, "Multiple migrations have the name Chunky") do
1149
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/duplicate_names", nil)
1150
+ end
1151
+ end
1152
+
1153
+ def test_migrator_with_missing_version_numbers
1154
+ assert_raise(ActiveRecord::UnknownMigrationVersionError) do
1155
+ ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/missing", 500)
1156
+ end
1157
+ end
1158
+
1159
+ def test_create_table_with_custom_sequence_name
1160
+ return unless current_adapter? :OracleAdapter
1161
+
1162
+ # table name is 29 chars, the standard sequence name will
1163
+ # be 33 chars and fail
1164
+ assert_raises(ActiveRecord::StatementInvalid) do
1165
+ begin
1166
+ Person.connection.create_table :table_with_name_thats_just_ok do |t|
1167
+ t.column :foo, :string, :null => false
1168
+ end
1169
+ ensure
1170
+ Person.connection.drop_table :table_with_name_thats_just_ok rescue nil
1171
+ end
1172
+ end
1173
+
1174
+ # should be all good w/ a custom sequence name
1175
+ assert_nothing_raised do
1176
+ begin
1177
+ Person.connection.create_table :table_with_name_thats_just_ok,
1178
+ :sequence_name => 'suitably_short_seq' do |t|
1179
+ t.column :foo, :string, :null => false
1180
+ end
1181
+
1182
+ Person.connection.execute("select suitably_short_seq.nextval from dual")
1183
+
1184
+ ensure
1185
+ Person.connection.drop_table :table_with_name_thats_just_ok,
1186
+ :sequence_name => 'suitably_short_seq' rescue nil
1187
+ end
1188
+ end
1189
+
1190
+ # confirm the custom sequence got dropped
1191
+ assert_raises(ActiveRecord::StatementInvalid) do
1192
+ Person.connection.execute("select suitably_short_seq.nextval from dual")
1193
+ end
1194
+ end
1195
+
1196
+ protected
1197
+ def with_env_tz(new_tz = 'US/Eastern')
1198
+ old_tz, ENV['TZ'] = ENV['TZ'], new_tz
1199
+ yield
1200
+ ensure
1201
+ old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ')
1202
+ end
1203
+
1204
+ end
1205
+
1206
+ uses_mocha 'Sexy migration tests' do
1207
+ class SexyMigrationsTest < ActiveRecord::TestCase
1208
+ def test_references_column_type_adds_id
1209
+ with_new_table do |t|
1210
+ t.expects(:column).with('customer_id', :integer, {})
1211
+ t.references :customer
1212
+ end
1213
+ end
1214
+
1215
+ def test_references_column_type_with_polymorphic_adds_type
1216
+ with_new_table do |t|
1217
+ t.expects(:column).with('taggable_type', :string, {})
1218
+ t.expects(:column).with('taggable_id', :integer, {})
1219
+ t.references :taggable, :polymorphic => true
1220
+ end
1221
+ end
1222
+
1223
+ def test_references_column_type_with_polymorphic_and_options_null_is_false_adds_table_flag
1224
+ with_new_table do |t|
1225
+ t.expects(:column).with('taggable_type', :string, {:null => false})
1226
+ t.expects(:column).with('taggable_id', :integer, {:null => false})
1227
+ t.references :taggable, :polymorphic => true, :null => false
1228
+ end
1229
+ end
1230
+
1231
+ def test_belongs_to_works_like_references
1232
+ with_new_table do |t|
1233
+ t.expects(:column).with('customer_id', :integer, {})
1234
+ t.belongs_to :customer
1235
+ end
1236
+ end
1237
+
1238
+ def test_timestamps_creates_updated_at_and_created_at
1239
+ with_new_table do |t|
1240
+ t.expects(:column).with(:created_at, :datetime, kind_of(Hash))
1241
+ t.expects(:column).with(:updated_at, :datetime, kind_of(Hash))
1242
+ t.timestamps
1243
+ end
1244
+ end
1245
+
1246
+ def test_integer_creates_integer_column
1247
+ with_new_table do |t|
1248
+ t.expects(:column).with(:foo, 'integer', {})
1249
+ t.expects(:column).with(:bar, 'integer', {})
1250
+ t.integer :foo, :bar
1251
+ end
1252
+ end
1253
+
1254
+ def test_string_creates_string_column
1255
+ with_new_table do |t|
1256
+ t.expects(:column).with(:foo, 'string', {})
1257
+ t.expects(:column).with(:bar, 'string', {})
1258
+ t.string :foo, :bar
1259
+ end
1260
+ end
1261
+
1262
+ protected
1263
+ def with_new_table
1264
+ Person.connection.create_table :delete_me, :force => true do |t|
1265
+ yield t
1266
+ end
1267
+ ensure
1268
+ Person.connection.drop_table :delete_me rescue nil
1269
+ end
1270
+
1271
+ end # SexyMigrationsTest
1272
+ end # uses_mocha
1273
+
1274
+ uses_mocha 'ChangeTable migration tests' do
1275
+ class ChangeTableMigrationsTest < ActiveRecord::TestCase
1276
+ def setup
1277
+ @connection = Person.connection
1278
+ @connection.create_table :delete_me, :force => true do |t|
1279
+ end
1280
+ end
1281
+
1282
+ def teardown
1283
+ Person.connection.drop_table :delete_me rescue nil
1284
+ end
1285
+
1286
+ def test_references_column_type_adds_id
1287
+ with_change_table do |t|
1288
+ @connection.expects(:add_column).with(:delete_me, 'customer_id', :integer, {})
1289
+ t.references :customer
1290
+ end
1291
+ end
1292
+
1293
+ def test_remove_references_column_type_removes_id
1294
+ with_change_table do |t|
1295
+ @connection.expects(:remove_column).with(:delete_me, 'customer_id')
1296
+ t.remove_references :customer
1297
+ end
1298
+ end
1299
+
1300
+ def test_add_belongs_to_works_like_add_references
1301
+ with_change_table do |t|
1302
+ @connection.expects(:add_column).with(:delete_me, 'customer_id', :integer, {})
1303
+ t.belongs_to :customer
1304
+ end
1305
+ end
1306
+
1307
+ def test_remove_belongs_to_works_like_remove_references
1308
+ with_change_table do |t|
1309
+ @connection.expects(:remove_column).with(:delete_me, 'customer_id')
1310
+ t.remove_belongs_to :customer
1311
+ end
1312
+ end
1313
+
1314
+ def test_references_column_type_with_polymorphic_adds_type
1315
+ with_change_table do |t|
1316
+ @connection.expects(:add_column).with(:delete_me, 'taggable_type', :string, {})
1317
+ @connection.expects(:add_column).with(:delete_me, 'taggable_id', :integer, {})
1318
+ t.references :taggable, :polymorphic => true
1319
+ end
1320
+ end
1321
+
1322
+ def test_remove_references_column_type_with_polymorphic_removes_type
1323
+ with_change_table do |t|
1324
+ @connection.expects(:remove_column).with(:delete_me, 'taggable_type')
1325
+ @connection.expects(:remove_column).with(:delete_me, 'taggable_id')
1326
+ t.remove_references :taggable, :polymorphic => true
1327
+ end
1328
+ end
1329
+
1330
+ def test_references_column_type_with_polymorphic_and_options_null_is_false_adds_table_flag
1331
+ with_change_table do |t|
1332
+ @connection.expects(:add_column).with(:delete_me, 'taggable_type', :string, {:null => false})
1333
+ @connection.expects(:add_column).with(:delete_me, 'taggable_id', :integer, {:null => false})
1334
+ t.references :taggable, :polymorphic => true, :null => false
1335
+ end
1336
+ end
1337
+
1338
+ def test_remove_references_column_type_with_polymorphic_and_options_null_is_false_removes_table_flag
1339
+ with_change_table do |t|
1340
+ @connection.expects(:remove_column).with(:delete_me, 'taggable_type')
1341
+ @connection.expects(:remove_column).with(:delete_me, 'taggable_id')
1342
+ t.remove_references :taggable, :polymorphic => true, :null => false
1343
+ end
1344
+ end
1345
+
1346
+ def test_timestamps_creates_updated_at_and_created_at
1347
+ with_change_table do |t|
1348
+ @connection.expects(:add_timestamps).with(:delete_me)
1349
+ t.timestamps
1350
+ end
1351
+ end
1352
+
1353
+ def test_remove_timestamps_creates_updated_at_and_created_at
1354
+ with_change_table do |t|
1355
+ @connection.expects(:remove_timestamps).with(:delete_me)
1356
+ t.remove_timestamps
1357
+ end
1358
+ end
1359
+
1360
+ def string_column
1361
+ if current_adapter?(:PostgreSQLAdapter)
1362
+ "character varying(255)"
1363
+ else
1364
+ 'varchar(255)'
1365
+ end
1366
+ end
1367
+
1368
+ def integer_column
1369
+ if current_adapter?(:MysqlAdapter)
1370
+ 'int(11)'
1371
+ else
1372
+ 'integer'
1373
+ end
1374
+ end
1375
+
1376
+ def test_integer_creates_integer_column
1377
+ with_change_table do |t|
1378
+ @connection.expects(:add_column).with(:delete_me, :foo, integer_column, {})
1379
+ @connection.expects(:add_column).with(:delete_me, :bar, integer_column, {})
1380
+ t.integer :foo, :bar
1381
+ end
1382
+ end
1383
+
1384
+ def test_string_creates_string_column
1385
+ with_change_table do |t|
1386
+ @connection.expects(:add_column).with(:delete_me, :foo, string_column, {})
1387
+ @connection.expects(:add_column).with(:delete_me, :bar, string_column, {})
1388
+ t.string :foo, :bar
1389
+ end
1390
+ end
1391
+
1392
+ def test_column_creates_column
1393
+ with_change_table do |t|
1394
+ @connection.expects(:add_column).with(:delete_me, :bar, :integer, {})
1395
+ t.column :bar, :integer
1396
+ end
1397
+ end
1398
+
1399
+ def test_column_creates_column_with_options
1400
+ with_change_table do |t|
1401
+ @connection.expects(:add_column).with(:delete_me, :bar, :integer, {:null => false})
1402
+ t.column :bar, :integer, :null => false
1403
+ end
1404
+ end
1405
+
1406
+ def test_index_creates_index
1407
+ with_change_table do |t|
1408
+ @connection.expects(:add_index).with(:delete_me, :bar, {})
1409
+ t.index :bar
1410
+ end
1411
+ end
1412
+
1413
+ def test_index_creates_index_with_options
1414
+ with_change_table do |t|
1415
+ @connection.expects(:add_index).with(:delete_me, :bar, {:unique => true})
1416
+ t.index :bar, :unique => true
1417
+ end
1418
+ end
1419
+
1420
+ def test_change_changes_column
1421
+ with_change_table do |t|
1422
+ @connection.expects(:change_column).with(:delete_me, :bar, :string, {})
1423
+ t.change :bar, :string
1424
+ end
1425
+ end
1426
+
1427
+ def test_change_changes_column_with_options
1428
+ with_change_table do |t|
1429
+ @connection.expects(:change_column).with(:delete_me, :bar, :string, {:null => true})
1430
+ t.change :bar, :string, :null => true
1431
+ end
1432
+ end
1433
+
1434
+ def test_change_default_changes_column
1435
+ with_change_table do |t|
1436
+ @connection.expects(:change_column_default).with(:delete_me, :bar, :string)
1437
+ t.change_default :bar, :string
1438
+ end
1439
+ end
1440
+
1441
+ def test_remove_drops_single_column
1442
+ with_change_table do |t|
1443
+ @connection.expects(:remove_column).with(:delete_me, [:bar])
1444
+ t.remove :bar
1445
+ end
1446
+ end
1447
+
1448
+ def test_remove_drops_multiple_columns
1449
+ with_change_table do |t|
1450
+ @connection.expects(:remove_column).with(:delete_me, [:bar, :baz])
1451
+ t.remove :bar, :baz
1452
+ end
1453
+ end
1454
+
1455
+ def test_remove_index_removes_index_with_options
1456
+ with_change_table do |t|
1457
+ @connection.expects(:remove_index).with(:delete_me, {:unique => true})
1458
+ t.remove_index :unique => true
1459
+ end
1460
+ end
1461
+
1462
+ def test_rename_renames_column
1463
+ with_change_table do |t|
1464
+ @connection.expects(:rename_column).with(:delete_me, :bar, :baz)
1465
+ t.rename :bar, :baz
1466
+ end
1467
+ end
1468
+
1469
+ protected
1470
+ def with_change_table
1471
+ Person.connection.change_table :delete_me do |t|
1472
+ yield t
1473
+ end
1474
+ end
1475
+
1476
+ end # ChangeTable test
1477
+ end # uses_mocha
1478
+
1479
+ end