admin_assistant 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (400) hide show
  1. data/Rakefile +5 -14
  2. data/VERSION +1 -1
  3. data/admin_assistant.gemspec +174 -388
  4. data/lib/admin_assistant/column.rb +2 -2
  5. data/lib/admin_assistant/has_many_column.rb +6 -1
  6. data/lib/admin_assistant/polymorphic_belongs_to_column.rb +5 -1
  7. data/lib/admin_assistant.rb +4 -5
  8. data/{rails_3_test → rails_3_0}/.gitignore +0 -0
  9. data/{rails_3_test → rails_3_0}/Gemfile +0 -0
  10. data/{rails_3_test → rails_3_0}/Gemfile.lock +1 -1
  11. data/{rails_3_test → rails_3_0}/README +0 -0
  12. data/{rails_3_test → rails_3_0}/Rakefile +0 -0
  13. data/{rails_2_test → rails_3_0}/app/controllers/admin/appointments2_controller.rb +0 -0
  14. data/{rails_2_test → rails_3_0}/app/controllers/admin/appointments_controller.rb +0 -0
  15. data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts2_controller.rb +0 -0
  16. data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts3_controller.rb +0 -0
  17. data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts4_controller.rb +0 -0
  18. data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts5_controller.rb +0 -0
  19. data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts6_controller.rb +0 -0
  20. data/{rails_3_test → rails_3_0}/app/controllers/admin/blog_posts_controller.rb +0 -0
  21. data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +0 -0
  22. data/{rails_2_test → rails_3_0}/app/controllers/admin/blog_posts_read_only_controller.rb +0 -0
  23. data/{rails_2_test → rails_3_0}/app/controllers/admin/bookmarks_controller.rb +0 -0
  24. data/{rails_2_test → rails_3_0}/app/controllers/admin/comments2_controller.rb +0 -0
  25. data/{rails_2_test → rails_3_0}/app/controllers/admin/comments_controller.rb +0 -0
  26. data/{rails_2_test → rails_3_0}/app/controllers/admin/images2_controller.rb +0 -0
  27. data/{rails_2_test → rails_3_0}/app/controllers/admin/images_controller.rb +0 -0
  28. data/{rails_2_test → rails_3_0}/app/controllers/admin/misconfigured1_controller.rb +0 -0
  29. data/{rails_2_test → rails_3_0}/app/controllers/admin/not_migrated_yets_controller.rb +0 -0
  30. data/{rails_2_test → rails_3_0}/app/controllers/admin/product_categories2_controller.rb +0 -0
  31. data/{rails_2_test → rails_3_0}/app/controllers/admin/product_categories_controller.rb +0 -0
  32. data/{rails_2_test → rails_3_0}/app/controllers/admin/television_airings_controller.rb +0 -0
  33. data/{rails_2_test → rails_3_0}/app/controllers/admin/television_time_slots_controller.rb +0 -0
  34. data/{rails_2_test → rails_3_0}/app/controllers/admin/users2_controller.rb +0 -0
  35. data/{rails_3_test → rails_3_0}/app/controllers/admin/users_controller.rb +0 -0
  36. data/{rails_3_test → rails_3_0}/app/controllers/application_controller.rb +0 -0
  37. data/{rails_2_test → rails_3_0}/app/controllers/blog_posts_controller.rb +0 -0
  38. data/{rails_2_test → rails_3_0}/app/helpers/admin/appointments_helper.rb +0 -0
  39. data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts2_helper.rb +0 -0
  40. data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts3_helper.rb +0 -0
  41. data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts4_helper.rb +0 -0
  42. data/{rails_3_test → rails_3_0}/app/helpers/admin/blog_posts6_helper.rb +0 -0
  43. data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +0 -0
  44. data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts_helper.rb +0 -0
  45. data/{rails_2_test → rails_3_0}/app/helpers/admin/blog_posts_read_only_helper.rb +0 -0
  46. data/{rails_2_test → rails_3_0}/app/helpers/admin/bookmarks_helper.rb +0 -0
  47. data/{rails_2_test → rails_3_0}/app/helpers/admin/comments2_helper.rb +0 -0
  48. data/{rails_2_test → rails_3_0}/app/helpers/admin/comments_helper.rb +0 -0
  49. data/{rails_2_test → rails_3_0}/app/helpers/admin/images2_helper.rb +0 -0
  50. data/{rails_2_test → rails_3_0}/app/helpers/admin/images_helper.rb +0 -0
  51. data/{rails_2_test → rails_3_0}/app/helpers/admin/misconfigured1_helper.rb +0 -0
  52. data/{rails_2_test → rails_3_0}/app/helpers/admin/not_migrated_yets_helper.rb +0 -0
  53. data/{rails_2_test → rails_3_0}/app/helpers/admin/product_categories2_helper.rb +0 -0
  54. data/{rails_2_test → rails_3_0}/app/helpers/admin/product_categories_helper.rb +0 -0
  55. data/{rails_2_test → rails_3_0}/app/helpers/admin/television_airings_helper.rb +0 -0
  56. data/{rails_2_test → rails_3_0}/app/helpers/admin/television_time_slots_helper.rb +0 -0
  57. data/{rails_2_test → rails_3_0}/app/helpers/admin/users2_helper.rb +0 -0
  58. data/{rails_3_test → rails_3_0}/app/helpers/admin/users_helper.rb +0 -0
  59. data/{rails_3_test → rails_3_0}/app/helpers/application_helper.rb +0 -0
  60. data/{rails_2_test → rails_3_0}/app/models/appointment.rb +0 -0
  61. data/{rails_2_test → rails_3_0}/app/models/blog_post.rb +0 -0
  62. data/{rails_2_test → rails_3_0}/app/models/blog_post_tag.rb +0 -0
  63. data/{rails_2_test → rails_3_0}/app/models/bookmark.rb +0 -0
  64. data/{rails_2_test → rails_3_0}/app/models/comment.rb +0 -0
  65. data/{rails_2_test → rails_3_0}/app/models/image.rb +0 -0
  66. data/{rails_2_test → rails_3_0}/app/models/not_migrated_yet.rb +0 -0
  67. data/{rails_3_test → rails_3_0}/app/models/product.rb +0 -0
  68. data/{rails_2_test → rails_3_0}/app/models/product_category.rb +0 -0
  69. data/{rails_2_test → rails_3_0}/app/models/tag.rb +0 -0
  70. data/{rails_2_test → rails_3_0}/app/models/television_airing.rb +0 -0
  71. data/{rails_2_test → rails_3_0}/app/models/television_time_slot.rb +0 -0
  72. data/{rails_3_test → rails_3_0}/app/models/user.rb +0 -0
  73. data/{rails_2_test → rails_3_0}/app/views/admin/appointments/_subject_input.html.erb +0 -0
  74. data/{rails_2_test → rails_3_0}/app/views/admin/appointments2/_time_input.html.erb +0 -0
  75. data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts2/_after_form.html.erb +0 -0
  76. data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts2/_after_index.html.erb +0 -0
  77. data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts2/_after_tags_input.html.erb +0 -0
  78. data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts2/_before_index.html.erb +0 -0
  79. data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts5/_after_index_header.html.erb +0 -0
  80. data/{rails_2_test → rails_3_0}/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +0 -0
  81. data/{rails_3_test → rails_3_0}/app/views/layouts/admin.html.erb +0 -0
  82. data/{rails_3_test → rails_3_0}/app/views/layouts/application.html.erb +0 -0
  83. data/{rails_3_test → rails_3_0}/config/application.rb +0 -0
  84. data/{rails_3_test → rails_3_0}/config/boot.rb +0 -0
  85. data/{rails_3_test → rails_3_0}/config/database.yml +0 -0
  86. data/{rails_3_test → rails_3_0}/config/environment.rb +0 -0
  87. data/{rails_3_test → rails_3_0}/config/environments/development.rb +0 -1
  88. data/{rails_3_test → rails_3_0}/config/environments/production.rb +0 -0
  89. data/{rails_3_test → rails_3_0}/config/environments/test.rb +0 -0
  90. data/{rails_3_test → rails_3_0}/config/initializers/backtrace_silencers.rb +0 -0
  91. data/{rails_3_test → rails_3_0}/config/initializers/inflections.rb +0 -0
  92. data/{rails_2_test → rails_3_0}/config/initializers/mime_types.rb +0 -0
  93. data/{rails_3_test → rails_3_0}/config/initializers/secret_token.rb +0 -0
  94. data/{rails_3_test → rails_3_0}/config/initializers/session_store.rb +0 -0
  95. data/{rails_3_test → rails_3_0}/config/locales/en.yml +0 -0
  96. data/rails_3_0/config/routes.rb +8 -0
  97. data/{rails_3_test → rails_3_0}/config.ru +0 -0
  98. data/{rails_2_test → rails_3_0}/db/migrate/20090213215514_create_blog_posts.rb +0 -0
  99. data/{rails_2_test → rails_3_0}/db/migrate/20090217225542_add_body_to_blog_posts.rb +0 -0
  100. data/{rails_2_test → rails_3_0}/db/migrate/20090221220917_create_tags.rb +0 -0
  101. data/{rails_2_test → rails_3_0}/db/migrate/20090221220947_create_blog_post_tags.rb +0 -0
  102. data/{rails_2_test → rails_3_0}/db/migrate/20090222162204_add_textile_to_blog_posts.rb +0 -0
  103. data/{rails_2_test → rails_3_0}/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +0 -0
  104. data/{rails_2_test → rails_3_0}/db/migrate/20090301191722_create_images.rb +0 -0
  105. data/{rails_2_test → rails_3_0}/db/migrate/20090305165345_create_accounts.rb +0 -0
  106. data/{rails_2_test → rails_3_0}/db/migrate/20090307225027_rename_accounts_to_users.rb +0 -0
  107. data/{rails_2_test → rails_3_0}/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +0 -0
  108. data/{rails_2_test → rails_3_0}/db/migrate/20090309185114_change_blog_posts_textile.rb +0 -0
  109. data/{rails_2_test → rails_3_0}/db/migrate/20090309193635_create_products.rb +0 -0
  110. data/{rails_2_test → rails_3_0}/db/migrate/20090309203056_create_comments.rb +0 -0
  111. data/{rails_2_test → rails_3_0}/db/migrate/20090323005947_create_file_column_images.rb +0 -0
  112. data/{rails_2_test → rails_3_0}/db/migrate/20090326160049_add_birthday_to_users.rb +0 -0
  113. data/{rails_2_test → rails_3_0}/db/migrate/20090326223606_add_state_to_users.rb +0 -0
  114. data/{rails_2_test → rails_3_0}/db/migrate/20090503134004_add_file_column_image_to_products.rb +0 -0
  115. data/{rails_2_test → rails_3_0}/db/migrate/20090617173651_create_bookmarks.rb +0 -0
  116. data/{rails_2_test → rails_3_0}/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +0 -0
  117. data/{rails_2_test → rails_3_0}/db/migrate/20090625144313_add_avatar_fields_to_user.rb +0 -0
  118. data/{rails_2_test → rails_3_0}/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +0 -0
  119. data/{rails_2_test → rails_3_0}/db/migrate/20090701171857_add_force_textile_to_users.rb +0 -0
  120. data/{rails_2_test → rails_3_0}/db/migrate/20090704163647_add_deleted_at_to_products.rb +0 -0
  121. data/{rails_2_test → rails_3_0}/db/migrate/20090704173800_add_sale_fields_to_products.rb +0 -0
  122. data/{rails_2_test → rails_3_0}/db/migrate/20090714024501_create_product_categories.rb +0 -0
  123. data/{rails_2_test → rails_3_0}/db/migrate/20090819162835_add_admin_level_to_users.rb +0 -0
  124. data/{rails_2_test → rails_3_0}/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +0 -0
  125. data/{rails_2_test → rails_3_0}/db/migrate/20091221011256_add_position_to_product_categories.rb +0 -0
  126. data/{rails_2_test → rails_3_0}/db/migrate/20091222160814_create_appointments.rb +0 -0
  127. data/{rails_2_test → rails_3_0}/db/migrate/20091227224547_add_user_id_to_appointments.rb +0 -0
  128. data/{rails_2_test → rails_3_0}/db/migrate/20100214213359_create_television_time_slots.rb +0 -0
  129. data/{rails_2_test → rails_3_0}/db/migrate/20100214213451_create_television_airings.rb +0 -0
  130. data/{rails_3_test → rails_3_0}/db/migrate/20110426215702_remove_avatar_fields_from_users.rb +0 -0
  131. data/{rails_3_test → rails_3_0}/db/seeds.rb +0 -0
  132. data/{rails_3_test → rails_3_0}/doc/README_FOR_APP +0 -0
  133. data/{rails_3_test → rails_3_0}/lib/tasks/.gitkeep +0 -0
  134. data/{rails_3_test → rails_3_0}/public/404.html +0 -0
  135. data/{rails_3_test → rails_3_0}/public/422.html +0 -0
  136. data/{rails_3_test → rails_3_0}/public/500.html +0 -0
  137. data/{rails_2_test → rails_3_0}/public/favicon.ico +0 -0
  138. data/{rails_2_test → rails_3_0}/public/images/rails.png +0 -0
  139. data/{rails_3_test → rails_3_0}/public/index.html +0 -0
  140. data/{rails_2_test → rails_3_0}/public/javascripts/application.js +0 -0
  141. data/{rails_2_test → rails_3_0}/public/javascripts/jquery-1.4.4.min.js +0 -0
  142. data/{rails_3_test → rails_3_0}/public/javascripts/rails.js +0 -0
  143. data/{rails_2_test → rails_3_0}/public/robots.txt +0 -0
  144. data/{rails_3_test → rails_3_0}/public/stylesheets/.gitkeep +0 -0
  145. data/{rails_2_test → rails_3_0}/public/stylesheets/admin.css +0 -0
  146. data/{rails_2_test → rails_3_0}/public/stylesheets/scaffold.css +0 -0
  147. data/{rails_3_test → rails_3_0}/script/rails +0 -0
  148. data/{rails_2_test → rails_3_0}/test/data/ruby_throated.jpg +0 -0
  149. data/{rails_2_test → rails_3_0}/test/data/tweenbot.jpg +0 -0
  150. data/{rails_3_test → rails_3_0}/test/fixtures/placeholder.txt +0 -0
  151. data/{rails_3_test → rails_3_0}/test/integration/admin/appointments2_integration_test.rb +0 -0
  152. data/{rails_3_test → rails_3_0}/test/integration/admin/appointments_integration_test.rb +0 -0
  153. data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts2_integration_test.rb +2 -2
  154. data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts3_integration_test.rb +0 -0
  155. data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts4_integration_test.rb +0 -0
  156. data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts5_integration_test.rb +0 -0
  157. data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts6_integration_test.rb +0 -0
  158. data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +0 -0
  159. data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts_integration_test.rb +8 -16
  160. data/{rails_3_test → rails_3_0}/test/integration/admin/blog_posts_read_only_integration_test.rb +0 -0
  161. data/{rails_3_test → rails_3_0}/test/integration/admin/bookmarks_integration_test.rb +0 -0
  162. data/{rails_3_test → rails_3_0}/test/integration/admin/comments2_integration_test.rb +0 -0
  163. data/{rails_3_test → rails_3_0}/test/integration/admin/comments_integration_test.rb +0 -0
  164. data/{rails_2_test → rails_3_0}/test/integration/admin/images2_integration_test.rb +0 -0
  165. data/{rails_3_test → rails_3_0}/test/integration/admin/images_integration_test.rb +0 -0
  166. data/{rails_3_test → rails_3_0}/test/integration/admin/misconfigured1_integration_test.rb +0 -0
  167. data/{rails_3_test → rails_3_0}/test/integration/admin/product_categories2_integration_test.rb +0 -0
  168. data/{rails_2_test → rails_3_0}/test/integration/admin/product_categories_integration_test.rb +0 -0
  169. data/{rails_2_test → rails_3_0}/test/integration/admin/television_airings_integration_test.rb +0 -0
  170. data/{rails_2_test → rails_3_0}/test/integration/admin/users2_integration_test.rb +0 -0
  171. data/{rails_3_test → rails_3_0}/test/integration/admin/users_integration_test.rb +0 -0
  172. data/{rails_3_test → rails_3_0}/test/integration/blog_posts_integration_test.rb +0 -0
  173. data/{rails_3_test → rails_3_0}/test/performance/browsing_test.rb +0 -0
  174. data/{rails_3_test → rails_3_0}/test/test_helper.rb +40 -0
  175. data/{rails_3_test → rails_3_0}/vendor/plugins/.gitkeep +0 -0
  176. data/rails_3_1/Gemfile +12 -0
  177. data/rails_3_1/Gemfile.lock +116 -0
  178. data/rails_3_1/README +256 -0
  179. data/{rails_2_test → rails_3_1}/Rakefile +2 -8
  180. data/rails_3_1/config.ru +4 -0
  181. metadata +176 -390
  182. data/lib/admin_assistant/date_time_range_end_point_selector.rb +0 -341
  183. data/rails_2_test/README +0 -256
  184. data/rails_2_test/app/controllers/admin/blog_posts_controller.rb +0 -8
  185. data/rails_2_test/app/controllers/admin/file_column_images2_controller.rb +0 -10
  186. data/rails_2_test/app/controllers/admin/file_column_images_controller.rb +0 -6
  187. data/rails_2_test/app/controllers/admin/products2_controller.rb +0 -15
  188. data/rails_2_test/app/controllers/admin/products_controller.rb +0 -31
  189. data/rails_2_test/app/controllers/admin/users_controller.rb +0 -63
  190. data/rails_2_test/app/controllers/application.rb +0 -16
  191. data/rails_2_test/app/controllers/application_controller.rb +0 -16
  192. data/rails_2_test/app/helpers/admin/appointments2_helper.rb +0 -2
  193. data/rails_2_test/app/helpers/admin/blog_posts6_helper.rb +0 -16
  194. data/rails_2_test/app/helpers/admin/file_column_images2_helper.rb +0 -2
  195. data/rails_2_test/app/helpers/admin/file_column_images_helper.rb +0 -2
  196. data/rails_2_test/app/helpers/admin/products2_helper.rb +0 -3
  197. data/rails_2_test/app/helpers/admin/products_helper.rb +0 -6
  198. data/rails_2_test/app/helpers/admin/users_helper.rb +0 -25
  199. data/rails_2_test/app/helpers/application_helper.rb +0 -3
  200. data/rails_2_test/app/helpers/blog_posts_helper.rb +0 -2
  201. data/rails_2_test/app/models/file_column_image.rb +0 -3
  202. data/rails_2_test/app/models/product.rb +0 -7
  203. data/rails_2_test/app/models/user.rb +0 -14
  204. data/rails_2_test/app/views/admin/products/_name_input.html.erb +0 -2
  205. data/rails_2_test/app/views/admin/products/_percent_off_input.html.erb +0 -2
  206. data/rails_2_test/app/views/admin/products/_price_input.html.erb +0 -10
  207. data/rails_2_test/app/views/blog_posts/show.html.erb +0 -13
  208. data/rails_2_test/app/views/layouts/admin.html.erb +0 -31
  209. data/rails_2_test/config/boot.rb +0 -109
  210. data/rails_2_test/config/database.yml +0 -28
  211. data/rails_2_test/config/environment.rb +0 -78
  212. data/rails_2_test/config/environments/development.rb +0 -17
  213. data/rails_2_test/config/environments/production.rb +0 -24
  214. data/rails_2_test/config/environments/test.rb +0 -24
  215. data/rails_2_test/config/initializers/inflections.rb +0 -10
  216. data/rails_2_test/config/initializers/new_rails_defaults.rb +0 -17
  217. data/rails_2_test/config/locales/en.yml +0 -5
  218. data/rails_2_test/config/routes.rb +0 -43
  219. data/rails_2_test/doc/README_FOR_APP +0 -5
  220. data/rails_2_test/lib/tasks/rspec.rake +0 -163
  221. data/rails_2_test/public/404.html +0 -30
  222. data/rails_2_test/public/422.html +0 -30
  223. data/rails_2_test/public/500.html +0 -33
  224. data/rails_2_test/public/dispatch.cgi +0 -10
  225. data/rails_2_test/public/dispatch.fcgi +0 -24
  226. data/rails_2_test/public/dispatch.rb +0 -10
  227. data/rails_2_test/public/index.html +0 -274
  228. data/rails_2_test/script/about +0 -4
  229. data/rails_2_test/script/autospec +0 -5
  230. data/rails_2_test/script/console +0 -3
  231. data/rails_2_test/script/dbconsole +0 -3
  232. data/rails_2_test/script/destroy +0 -3
  233. data/rails_2_test/script/generate +0 -3
  234. data/rails_2_test/script/performance/benchmarker +0 -3
  235. data/rails_2_test/script/performance/profiler +0 -3
  236. data/rails_2_test/script/performance/request +0 -3
  237. data/rails_2_test/script/plugin +0 -3
  238. data/rails_2_test/script/populate_tables.rb +0 -49
  239. data/rails_2_test/script/process/inspector +0 -3
  240. data/rails_2_test/script/process/reaper +0 -3
  241. data/rails_2_test/script/process/spawner +0 -3
  242. data/rails_2_test/script/runner +0 -3
  243. data/rails_2_test/script/server +0 -3
  244. data/rails_2_test/script/spec +0 -5
  245. data/rails_2_test/script/spec_server +0 -125
  246. data/rails_2_test/test/fixtures/file_column_images.yml +0 -7
  247. data/rails_2_test/test/integration/admin/appointments2_integration_test.rb +0 -79
  248. data/rails_2_test/test/integration/admin/appointments_integration_test.rb +0 -367
  249. data/rails_2_test/test/integration/admin/blog_posts2_integration_test.rb +0 -806
  250. data/rails_2_test/test/integration/admin/blog_posts3_integration_test.rb +0 -418
  251. data/rails_2_test/test/integration/admin/blog_posts4_integration_test.rb +0 -189
  252. data/rails_2_test/test/integration/admin/blog_posts5_integration_test.rb +0 -75
  253. data/rails_2_test/test/integration/admin/blog_posts6_integration_test.rb +0 -39
  254. data/rails_2_test/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +0 -89
  255. data/rails_2_test/test/integration/admin/blog_posts_integration_test.rb +0 -788
  256. data/rails_2_test/test/integration/admin/blog_posts_read_only_integration_test.rb +0 -69
  257. data/rails_2_test/test/integration/admin/bookmarks_integration_test.rb +0 -445
  258. data/rails_2_test/test/integration/admin/comments2_integration_test.rb +0 -52
  259. data/rails_2_test/test/integration/admin/comments_integration_test.rb +0 -50
  260. data/rails_2_test/test/integration/admin/file_column_images2_integration_test.rb +0 -19
  261. data/rails_2_test/test/integration/admin/file_column_images_integration_test.rb +0 -69
  262. data/rails_2_test/test/integration/admin/images_integration_test.rb +0 -79
  263. data/rails_2_test/test/integration/admin/misconfigured1_integration_test.rb +0 -17
  264. data/rails_2_test/test/integration/admin/product_categories2_integration_test.rb +0 -179
  265. data/rails_2_test/test/integration/admin/products2_integration_test.rb +0 -155
  266. data/rails_2_test/test/integration/admin/products_integration_test.rb +0 -210
  267. data/rails_2_test/test/integration/admin/users_integration_test.rb +0 -266
  268. data/rails_2_test/test/integration/blog_posts_integration_test.rb +0 -9
  269. data/rails_2_test/test/test_helper.rb +0 -114
  270. data/rails_2_test/vendor/plugins/file_column/CHANGELOG +0 -69
  271. data/rails_2_test/vendor/plugins/file_column/README +0 -54
  272. data/rails_2_test/vendor/plugins/file_column/Rakefile +0 -36
  273. data/rails_2_test/vendor/plugins/file_column/TODO +0 -6
  274. data/rails_2_test/vendor/plugins/file_column/init.rb +0 -13
  275. data/rails_2_test/vendor/plugins/file_column/lib/file_column.rb +0 -723
  276. data/rails_2_test/vendor/plugins/file_column/lib/file_column_helper.rb +0 -150
  277. data/rails_2_test/vendor/plugins/file_column/lib/file_compat.rb +0 -28
  278. data/rails_2_test/vendor/plugins/file_column/lib/magick_file_column.rb +0 -260
  279. data/rails_2_test/vendor/plugins/file_column/lib/rails_file_column.rb +0 -19
  280. data/rails_2_test/vendor/plugins/file_column/lib/test_case.rb +0 -124
  281. data/rails_2_test/vendor/plugins/file_column/lib/validations.rb +0 -112
  282. data/rails_2_test/vendor/plugins/file_column/test/abstract_unit.rb +0 -63
  283. data/rails_2_test/vendor/plugins/file_column/test/connection.rb +0 -17
  284. data/rails_2_test/vendor/plugins/file_column/test/file_column_helper_test.rb +0 -97
  285. data/rails_2_test/vendor/plugins/file_column/test/file_column_test.rb +0 -650
  286. data/rails_2_test/vendor/plugins/file_column/test/fixtures/entry.rb +0 -32
  287. data/rails_2_test/vendor/plugins/file_column/test/fixtures/invalid-image.jpg +0 -1
  288. data/rails_2_test/vendor/plugins/file_column/test/fixtures/kerb.jpg +0 -0
  289. data/rails_2_test/vendor/plugins/file_column/test/fixtures/mysql.sql +0 -25
  290. data/rails_2_test/vendor/plugins/file_column/test/fixtures/schema.rb +0 -10
  291. data/rails_2_test/vendor/plugins/file_column/test/fixtures/skanthak.png +0 -0
  292. data/rails_2_test/vendor/plugins/file_column/test/magick_test.rb +0 -380
  293. data/rails_2_test/vendor/plugins/file_column/test/magick_view_only_test.rb +0 -21
  294. data/rails_3_test/app/controllers/admin/appointments2_controller.rb +0 -15
  295. data/rails_3_test/app/controllers/admin/appointments_controller.rb +0 -11
  296. data/rails_3_test/app/controllers/admin/blog_posts2_controller.rb +0 -138
  297. data/rails_3_test/app/controllers/admin/blog_posts3_controller.rb +0 -76
  298. data/rails_3_test/app/controllers/admin/blog_posts4_controller.rb +0 -21
  299. data/rails_3_test/app/controllers/admin/blog_posts5_controller.rb +0 -27
  300. data/rails_3_test/app/controllers/admin/blog_posts6_controller.rb +0 -10
  301. data/rails_3_test/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +0 -15
  302. data/rails_3_test/app/controllers/admin/blog_posts_read_only_controller.rb +0 -19
  303. data/rails_3_test/app/controllers/admin/bookmarks_controller.rb +0 -11
  304. data/rails_3_test/app/controllers/admin/comments2_controller.rb +0 -14
  305. data/rails_3_test/app/controllers/admin/comments_controller.rb +0 -12
  306. data/rails_3_test/app/controllers/admin/images2_controller.rb +0 -11
  307. data/rails_3_test/app/controllers/admin/images_controller.rb +0 -6
  308. data/rails_3_test/app/controllers/admin/misconfigured1_controller.rb +0 -7
  309. data/rails_3_test/app/controllers/admin/not_migrated_yets_controller.rb +0 -9
  310. data/rails_3_test/app/controllers/admin/product_categories2_controller.rb +0 -7
  311. data/rails_3_test/app/controllers/admin/product_categories_controller.rb +0 -5
  312. data/rails_3_test/app/controllers/admin/television_airings_controller.rb +0 -5
  313. data/rails_3_test/app/controllers/admin/television_time_slots_controller.rb +0 -5
  314. data/rails_3_test/app/controllers/admin/users2_controller.rb +0 -10
  315. data/rails_3_test/app/controllers/blog_posts_controller.rb +0 -5
  316. data/rails_3_test/app/helpers/admin/appointments_helper.rb +0 -2
  317. data/rails_3_test/app/helpers/admin/blog_posts2_helper.rb +0 -27
  318. data/rails_3_test/app/helpers/admin/blog_posts3_helper.rb +0 -2
  319. data/rails_3_test/app/helpers/admin/blog_posts4_helper.rb +0 -2
  320. data/rails_3_test/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +0 -29
  321. data/rails_3_test/app/helpers/admin/blog_posts_helper.rb +0 -2
  322. data/rails_3_test/app/helpers/admin/blog_posts_read_only_helper.rb +0 -2
  323. data/rails_3_test/app/helpers/admin/bookmarks_helper.rb +0 -2
  324. data/rails_3_test/app/helpers/admin/comments2_helper.rb +0 -2
  325. data/rails_3_test/app/helpers/admin/comments_helper.rb +0 -2
  326. data/rails_3_test/app/helpers/admin/images2_helper.rb +0 -8
  327. data/rails_3_test/app/helpers/admin/images_helper.rb +0 -2
  328. data/rails_3_test/app/helpers/admin/misconfigured1_helper.rb +0 -2
  329. data/rails_3_test/app/helpers/admin/not_migrated_yets_helper.rb +0 -2
  330. data/rails_3_test/app/helpers/admin/product_categories2_helper.rb +0 -2
  331. data/rails_3_test/app/helpers/admin/product_categories_helper.rb +0 -2
  332. data/rails_3_test/app/helpers/admin/television_airings_helper.rb +0 -2
  333. data/rails_3_test/app/helpers/admin/television_time_slots_helper.rb +0 -2
  334. data/rails_3_test/app/helpers/admin/users2_helper.rb +0 -2
  335. data/rails_3_test/app/models/appointment.rb +0 -5
  336. data/rails_3_test/app/models/blog_post.rb +0 -14
  337. data/rails_3_test/app/models/blog_post_tag.rb +0 -6
  338. data/rails_3_test/app/models/bookmark.rb +0 -6
  339. data/rails_3_test/app/models/comment.rb +0 -4
  340. data/rails_3_test/app/models/image.rb +0 -3
  341. data/rails_3_test/app/models/not_migrated_yet.rb +0 -2
  342. data/rails_3_test/app/models/product_category.rb +0 -9
  343. data/rails_3_test/app/models/tag.rb +0 -4
  344. data/rails_3_test/app/models/television_airing.rb +0 -3
  345. data/rails_3_test/app/models/television_time_slot.rb +0 -11
  346. data/rails_3_test/app/views/admin/appointments/_subject_input.html.erb +0 -2
  347. data/rails_3_test/app/views/admin/appointments2/_time_input.html.erb +0 -31
  348. data/rails_3_test/app/views/admin/blog_posts2/_after_form.html.erb +0 -5
  349. data/rails_3_test/app/views/admin/blog_posts2/_after_index.html.erb +0 -1
  350. data/rails_3_test/app/views/admin/blog_posts2/_after_tags_input.html.erb +0 -16
  351. data/rails_3_test/app/views/admin/blog_posts2/_before_index.html.erb +0 -2
  352. data/rails_3_test/app/views/admin/blog_posts5/_after_index_header.html.erb +0 -8
  353. data/rails_3_test/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +0 -1
  354. data/rails_3_test/config/initializers/mime_types.rb +0 -5
  355. data/rails_3_test/config/routes.rb +0 -63
  356. data/rails_3_test/db/migrate/20090213215514_create_blog_posts.rb +0 -12
  357. data/rails_3_test/db/migrate/20090217225542_add_body_to_blog_posts.rb +0 -9
  358. data/rails_3_test/db/migrate/20090221220917_create_tags.rb +0 -13
  359. data/rails_3_test/db/migrate/20090221220947_create_blog_post_tags.rb +0 -14
  360. data/rails_3_test/db/migrate/20090222162204_add_textile_to_blog_posts.rb +0 -9
  361. data/rails_3_test/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +0 -9
  362. data/rails_3_test/db/migrate/20090301191722_create_images.rb +0 -16
  363. data/rails_3_test/db/migrate/20090305165345_create_accounts.rb +0 -14
  364. data/rails_3_test/db/migrate/20090307225027_rename_accounts_to_users.rb +0 -9
  365. data/rails_3_test/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +0 -9
  366. data/rails_3_test/db/migrate/20090309185114_change_blog_posts_textile.rb +0 -9
  367. data/rails_3_test/db/migrate/20090309193635_create_products.rb +0 -14
  368. data/rails_3_test/db/migrate/20090309203056_create_comments.rb +0 -15
  369. data/rails_3_test/db/migrate/20090323005947_create_file_column_images.rb +0 -12
  370. data/rails_3_test/db/migrate/20090326160049_add_birthday_to_users.rb +0 -9
  371. data/rails_3_test/db/migrate/20090326223606_add_state_to_users.rb +0 -9
  372. data/rails_3_test/db/migrate/20090503134004_add_file_column_image_to_products.rb +0 -9
  373. data/rails_3_test/db/migrate/20090617173651_create_bookmarks.rb +0 -15
  374. data/rails_3_test/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +0 -9
  375. data/rails_3_test/db/migrate/20090625144313_add_avatar_fields_to_user.rb +0 -11
  376. data/rails_3_test/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +0 -9
  377. data/rails_3_test/db/migrate/20090701171857_add_force_textile_to_users.rb +0 -9
  378. data/rails_3_test/db/migrate/20090704163647_add_deleted_at_to_products.rb +0 -9
  379. data/rails_3_test/db/migrate/20090704173800_add_sale_fields_to_products.rb +0 -13
  380. data/rails_3_test/db/migrate/20090714024501_create_product_categories.rb +0 -15
  381. data/rails_3_test/db/migrate/20090819162835_add_admin_level_to_users.rb +0 -9
  382. data/rails_3_test/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +0 -11
  383. data/rails_3_test/db/migrate/20091221011256_add_position_to_product_categories.rb +0 -9
  384. data/rails_3_test/db/migrate/20091222160814_create_appointments.rb +0 -14
  385. data/rails_3_test/db/migrate/20091227224547_add_user_id_to_appointments.rb +0 -9
  386. data/rails_3_test/db/migrate/20100214213359_create_television_time_slots.rb +0 -13
  387. data/rails_3_test/db/migrate/20100214213451_create_television_airings.rb +0 -15
  388. data/rails_3_test/public/favicon.ico +0 -0
  389. data/rails_3_test/public/images/rails.png +0 -0
  390. data/rails_3_test/public/javascripts/application.js +0 -2
  391. data/rails_3_test/public/javascripts/jquery-1.4.4.min.js +0 -167
  392. data/rails_3_test/public/robots.txt +0 -5
  393. data/rails_3_test/public/stylesheets/admin.css +0 -3
  394. data/rails_3_test/public/stylesheets/scaffold.css +0 -54
  395. data/rails_3_test/test/data/ruby_throated.jpg +0 -0
  396. data/rails_3_test/test/data/tweenbot.jpg +0 -0
  397. data/rails_3_test/test/integration/admin/images2_integration_test.rb +0 -33
  398. data/rails_3_test/test/integration/admin/product_categories_integration_test.rb +0 -12
  399. data/rails_3_test/test/integration/admin/television_airings_integration_test.rb +0 -25
  400. data/rails_3_test/test/integration/admin/users2_integration_test.rb +0 -48
@@ -1,806 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
2
-
3
- class Admin::BlogPosts2IntegrationTest < ActionController::IntegrationTest
4
- def setup
5
- User.destroy_all
6
- @user = User.find_or_create_by_username 'soren'
7
- end
8
-
9
- def create_foobar_blog_posts
10
- BlogPost.destroy_all
11
- BlogPost.create!(
12
- :title => 'textile_false_foobar', :textile => false, :user => @user
13
- )
14
- BlogPost.create!(
15
- :title => 'textile_true_foobar', :textile => true, :user => @user
16
- )
17
- BlogPost.create!(
18
- :title => 'not_in_the_title', :textile => false,
19
- :body => 'foobar here though', :user => @user
20
- )
21
- BlogPost.create!(
22
- :title => 'textile is false', :textile => false,
23
- :body => "body doesn't say f**bar", :user => @user
24
- )
25
- BlogPost.create!(
26
- :title => 'already published', :textile => false,
27
- :body => "body doesn't say f**bar", :user => @user,
28
- :published_at => Time.now.utc
29
- )
30
- end
31
-
32
- def test_comes_back_to_index_sorted_by_published_at_after_preview_then_create
33
- BlogPost.create! :title => random_word, :user => @user
34
- visit "/admin/blog_posts2"
35
- click_link "Published at"
36
- click_link "New blog post"
37
- fill_in "blog_post[title]", :with => 'Funny ha ha'
38
- select "soren", :from => "blog_post[user_id]"
39
- click_button 'Preview'
40
- click_button 'Update'
41
- assert_select 'th.asc', :text => 'Published at'
42
- end
43
-
44
- def test_create_when_there_are_no_validation_errors
45
- title = random_word
46
- post(
47
- "/admin/blog_posts2/create",
48
- :blog_post => {
49
- :title => title, :tags => 'tag1 tag2', :publish => '1',
50
- :user_id => @user.id
51
- }
52
- )
53
- @blog_post = BlogPost.find_by_title title
54
-
55
- # should create a new BlogPost
56
- assert @blog_post
57
-
58
- # should create tags
59
- assert_equal(2, @blog_post.tags.size)
60
- %w(tag1 tag2).each do |tag_str|
61
- assert(@blog_post.tags.any? { |tag| tag.tag == tag_str })
62
- end
63
-
64
- # should set published_at because of the publish flag
65
- assert @blog_post.published_at
66
-
67
- # should set the tags_string
68
- assert_match(/tag1,tag2/, @blog_post.tags_string)
69
- end
70
-
71
- def test_create_when_the_user_has_clicked_Preview
72
- title = random_word
73
- post(
74
- "/admin/blog_posts2/create",
75
- :blog_post => {
76
- :title => title, :tags => 'tag1 tag2', :publish => '1',
77
- :user_id => @user.id
78
- },
79
- :commit => 'Preview'
80
- )
81
- @blog_post = BlogPost.find_by_title title
82
-
83
- # should redirect to the edit page with the preview flag
84
- assert_redirected_to(
85
- "/admin/blog_posts2/edit/#{@blog_post.id}?preview=1"
86
- )
87
- end
88
-
89
- def test_create_with_a_bad_tag
90
- @title = random_word
91
- post(
92
- "/admin/blog_posts2/create",
93
- :blog_post => {
94
- :title => @title, :tags => 'foo bar! baz', :user_id => @user.id
95
- }
96
- )
97
-
98
- # should not create a new BlogPost
99
- assert_nil BlogPost.find_by_title(@title)
100
-
101
- # should keep the title in the form
102
- assert_select(
103
- "input[name=?][value=?]", 'blog_post[title]', @title
104
- )
105
-
106
- # should render a useful error
107
- assert_select("div.errorExplanation") do
108
- assert_select 'li', :text => "Tags contain invalid string 'bar!'"
109
- end
110
-
111
- # should highlight the tag string entry
112
- assert_select("div.fieldWithErrors") do
113
- assert_select "input[name=?][value=?]", "blog_post[tags]", "foo bar! baz"
114
- end
115
- end
116
-
117
- def test_create_with_a_bad_tag_and_a_missing_title
118
- @orig_count = BlogPost.count
119
- post(
120
- "/admin/blog_posts2/create",
121
- :blog_post => {
122
- :title => '', :tags => 'foo bar! baz', :user_id => @user.id
123
- }
124
- )
125
-
126
- # should not create a new BlogPost
127
- assert_equal(@orig_count, BlogPost.count)
128
-
129
- # should render a useful tags error
130
- assert_select("div.errorExplanation") do
131
- assert_select 'li', :text => "Tags contain invalid string 'bar!'"
132
- end
133
-
134
- # should highlight the tag string entry
135
- assert_select("div.fieldWithErrors") do
136
- assert_select "input[name=?][value=?]", "blog_post[tags]", "foo bar! baz"
137
- end
138
-
139
- # should render a useful title error
140
- assert_select("div.errorExplanation") do
141
- assert_select 'li', :text => "Title can't be blank"
142
- end
143
-
144
- # should highlight the title string entry
145
- assert_select("div.fieldWithErrors") do
146
- assert_select "input[name=?][value=?]", "blog_post[title]", ""
147
- end
148
- end
149
-
150
- def test_create_with_a_bad_publish_value_somehow
151
- @title = random_word
152
- post(
153
- "/admin/blog_posts2/create",
154
- :blog_post => {
155
- :title => @title, :tags => 'tag1 tag2', :publish => 'FOOBAR',
156
- }
157
- )
158
-
159
- # should be successful
160
- assert_response :success
161
-
162
- # should not save the blog post
163
- assert_nil BlogPost.find_by_title(@title)
164
-
165
- # should display the publish error
166
- assert_match(/Publish can't be .*FOOBAR.*/, response.body)
167
-
168
- # should display a user error too
169
- assert_match(/User can't be blank/, response.body)
170
- end
171
-
172
- def test_edit
173
- BlogPost.destroy_all
174
- @blog_post = BlogPost.create!(
175
- :title => "blog post title", :body => 'blog post body', :user => @user
176
- )
177
- tag1 = Tag.find_or_create_by_tag 'tag1'
178
- BlogPostTag.create! :blog_post => @blog_post, :tag => tag1
179
- tag2 = Tag.find_or_create_by_tag 'tag2'
180
- BlogPostTag.create! :blog_post => @blog_post, :tag => tag2
181
- get "/admin/blog_posts2/edit", :id => @blog_post.id
182
- assert_response :success
183
-
184
- # should show the tags
185
- assert_match(%r|<input.*name="blog_post\[tags\]"|m, response.body)
186
- assert_match(/(tag2 tag1|tag1 tag2)/, response.body)
187
-
188
- # should show a preview button
189
- assert_select('input[type=submit][value=Preview]')
190
- end
191
-
192
- def test_edit_in_preview_mode
193
- @blog_post = BlogPost.create!(
194
- :title => "blog post title", :body => 'blog post body', :user => @user
195
- )
196
- get "/admin/blog_posts2/edit", :id => @blog_post.id, :preview => '1'
197
- assert_response :success
198
-
199
- # should render the preview HTML
200
- assert_select('html') do
201
- assert_select 'h4', 'Preview'
202
- end
203
- end
204
-
205
- def test_edit_when_there_are_more_than_15_users
206
- @blog_post = BlogPost.create! :title => random_word, :user => @user
207
- 1.upto(16) do |i|
208
- User.create! :username => "--user #{i}--"
209
- end
210
- get "/admin/blog_posts2/edit",:id => @blog_post.id
211
-
212
- # should use the token input instead of a drop-down
213
- assert_select("select[name=?]", "blog_post[user_id]", false)
214
- assert_select("input[name=?][value=?]", 'blog_post[user_id]', @user.id)
215
- assert_match(
216
- %r|
217
- \$\("\#blog_post_user_id"\)\.tokenInput\(
218
- \s*"/admin/blog_posts2/autocomplete_user",
219
- .*prePopulate
220
- .*"id":\s*#{@user.id}
221
- |mx,
222
- response.body
223
- )
224
- end
225
-
226
- def test_edit_when_there_are_less_than_15_users
227
- @blog_post = BlogPost.create! :title => random_word, :user => @user
228
- User.count.downto(14) do
229
- user = User.find(
230
- :first, :conditions => ['username != ?', @user.username]
231
- )
232
- user.destroy
233
- end
234
- get "/admin/blog_posts2/edit",:id => @blog_post.id
235
-
236
- # should use a drop-down without a blank option
237
- assert_select('select[name=?]', 'blog_post[user_id]') do
238
- assert_select("option[value='']", false)
239
- end
240
- end
241
-
242
- def test_edit_a_blog_post_that_has_already_been_published
243
- @blog_post = BlogPost.create!(
244
- :title => "blog post title", :body => 'blog post body', :user => @user,
245
- :published_at => Time.now.utc
246
- )
247
- get "/admin/blog_posts2/edit",:id => @blog_post.id
248
- assert_response :success
249
-
250
- # should show the publish check-box checked
251
- assert_select(
252
- 'input[type=checkbox][name=?][checked=checked]', 'blog_post[publish]'
253
- )
254
- end
255
-
256
- def test_index_when_there_is_one_record_and_15_or_less_users
257
- BlogPost.destroy_all
258
- @blog_post = BlogPost.create!(
259
- :title => "blog post title", :body => 'blog post body',
260
- :user => @user
261
- )
262
- tag1 = Tag.find_or_create_by_tag 'tag1'
263
- BlogPostTag.create! :blog_post => @blog_post, :tag => tag1
264
- tag2 = Tag.find_or_create_by_tag 'tag2'
265
- BlogPostTag.create! :blog_post => @blog_post, :tag => tag2
266
- User.count.downto(15) do
267
- user = User.find(:first, :conditions => ['id != ?', @user.id])
268
- user.destroy
269
- end
270
- get "/admin/blog_posts2"
271
- assert_response :success
272
-
273
- # should show the tags
274
- assert_match(/(tag2 tag1|tag1 tag2)/, response.body)
275
-
276
- # should show the title
277
- assert_match(/blog post title/, response.body)
278
-
279
- # should not show the body
280
- assert_no_match(/blog post body/, response.body)
281
-
282
- # should show a link to the all index page
283
- assert_match(%r|<a.*href="/admin/blog_posts2\?all=1"|, response.body)
284
-
285
- # should not show a sort link for tags
286
- assert_no_match(%r|<a [^>]*>Tags</a>|, response.body)
287
-
288
- # should show a sort link for users
289
- assert_a_tag_with_get_args(
290
- 'Author', '/admin/blog_posts2',
291
- {:sort => 'user', :sort_order => 'asc'}, response.body
292
- )
293
-
294
- # should render the author as a username with a link
295
- assert_select('td') do
296
- assert_select(
297
- "a[href=?]", "/admin/users/edit/#{@user.id}", :text => 'soren'
298
- )
299
- end
300
-
301
- # should say 'Yes' or 'No' for the textile field
302
- assert_match(/No/, response.body)
303
-
304
- # should show a search form with specific fields
305
- assert_select(
306
- 'form[id=search_form][method=get]', :text => /Title/
307
- ) do
308
- assert_select(
309
- 'input[type=radio][name=?][value=all][checked=checked]',
310
- 'search[(all_or_any)]'
311
- )
312
- assert_select(
313
- 'input[type=radio][name=?][value=any]', 'search[(all_or_any)]'
314
- )
315
- assert_select('input[name=?]', 'search[title]')
316
- assert_select('input[name=?]', 'search[body]')
317
- assert_select('select[name=?]', 'search[textile]') do
318
- assert_select("option[value='']", :text => '')
319
- assert_select("option[value='true']", :text => 'Yes')
320
- assert_select("option[value='false']", :text => 'No')
321
- end
322
- assert_select('select[name=?]', 'search[user_id]') do
323
- assert_select("option[value='']", :text => '')
324
- assert_select("option[value=?]", @user.id)
325
- end
326
- end
327
-
328
- # should show a link to /admin/comments/new
329
- assert_select('td') do
330
- assert_select(
331
- "a[href=?]",
332
- "/admin/comments/new?comment%5Bblog_post_id%5D=#{@blog_post.id}",
333
- :text => "New comment"
334
- )
335
- end
336
-
337
- # should have a header of 'Blog posts (unpublished)'
338
- assert_select('h2', :text => 'Blog posts (unpublished)')
339
-
340
- # should render custom HTML after the index
341
- assert_select(
342
- '#after_index', :text => 'Custom HTML rendered after the index'
343
- )
344
-
345
- # should render custom HTML before the index
346
- assert_select(
347
- '#before_index', :text => 'Custom HTML rendered before the index'
348
- )
349
-
350
- # should not have a blank checkbox for the body search field
351
- assert_select('form[id=search_form][method=get]') do
352
- assert_select(
353
- "input[type=checkbox][name=?]", "search[body(blank)]", false
354
- )
355
- end
356
-
357
- # should output ivar set by index_before_render controller hook
358
- assert assigns(:var_set_by_before_render_for_index_hook)
359
- assert_match(/Confirmed that we have some records/, response.body)
360
- end
361
-
362
- def test_index_when_there_is_one_published_post_and_one_unpublished_post
363
- BlogPost.create! :title => "--unpublished--", :user => @user
364
- BlogPost.create!(
365
- :title => "--published--", :published_at => Time.now.utc,
366
- :user => @user
367
- )
368
- get "/admin/blog_posts2"
369
- assert_response :success
370
-
371
- # should show the unpublished post
372
- assert_match(/--unpublished--/, response.body)
373
-
374
- # should not show the published post
375
- assert_no_match(/--published--/, response.body)
376
- end
377
-
378
- def test_index_when_there_is_1_blog_post_and_16_users
379
- @blog_post = BlogPost.create! :title => random_word, :user => @user
380
- User.count.upto(16) do |i|
381
- User.create! :username => random_word
382
- end
383
- get "/admin/blog_posts2"
384
-
385
- # should use the token input in the search form for users
386
- assert_select("select[name=?]", "search[user_id]]", false)
387
- assert_select("input:not([value])[name=?]", 'search[user_id]')
388
- assert_match(
389
- %r|
390
- \$\("\#search_user_id"\)\.tokenInput\(
391
- \s*"/admin/blog_posts2/autocomplete_user"
392
- |mx,
393
- response.body
394
- )
395
- end
396
-
397
- def test_index_all_1
398
- BlogPost.create!(
399
- :title => "--published--", :published_at => Time.now.utc,
400
- :user => @user
401
- )
402
- get "/admin/blog_posts2", :all => '1'
403
- assert_response :success
404
-
405
- # should show published posts
406
- assert_match(/--published--/, response.body)
407
-
408
- # should show a sort link for titles that includes all=1
409
- assert_a_tag_with_get_args(
410
- 'Title', '/admin/blog_posts2',
411
- {:sort => 'title', :sort_order => 'asc', :all => '1'}, response.body
412
- )
413
-
414
- # should have a header of 'Blog posts (all)'
415
- assert_select('h2', :text => 'Blog posts (all)')
416
- end
417
-
418
- def test_index_all_1_with_two_published_posts
419
- BlogPost.create!(
420
- :title => 'published later', :published_at => Time.utc(2009, 2, 1),
421
- :user => @user
422
- )
423
- BlogPost.create!(
424
- :title => 'published earlier', :published_at => Time.utc(2009, 1, 1),
425
- :user => @user
426
- )
427
- get "/admin/blog_posts2", :all => '1'
428
-
429
- # should order by published_at desc
430
- assert_match(/published later.*published earlier/m, response.body)
431
- end
432
-
433
- def test_index_when_searching_for_title_with_foobar
434
- create_foobar_blog_posts
435
- get(
436
- "/admin/blog_posts2",
437
- :search => {
438
- :body => "", :title => "foobar", :textile => "", :id => "",
439
- :user => ''
440
- }
441
- )
442
- assert_response :success
443
-
444
- # should match records where textile=true
445
- assert_select('td', :text => 'textile_true_foobar')
446
-
447
- # should match records where textile=false
448
- assert_select('td', :text => 'textile_false_foobar')
449
-
450
- # should show the textile and title search fields pre-set
451
- assert_select('form[id=search_form][method=get]') do
452
- assert_select('input[name=?][value=foobar]', 'search[title]')
453
- assert_select('select[name=?]', 'search[textile]') do
454
- assert_select("option[value=''][selected=selected]", :text => '')
455
- assert_select("option[value='true']", :text => 'Yes')
456
- assert_select("option[value='false']", :text => 'No')
457
- end
458
- end
459
- end
460
-
461
- def test_index_when_searching_for_title_with_foobar_and_textile_false
462
- create_foobar_blog_posts
463
- get(
464
- "/admin/blog_posts2",
465
- :search => {
466
- :textile => 'false', :title => 'foobar', '(all_or_any)' => 'all',
467
- :user => ''
468
- }
469
- )
470
- assert_response :success
471
-
472
- # should show blog posts with textile=false and the word 'foobar' in the title
473
- assert_select('td', :text => 'textile_false_foobar')
474
-
475
- # should not show a blog post with textile=true
476
- assert_no_match(%r|<td[^>]*>textile_true_foobar</td>|, response.body)
477
-
478
- # should not show a blog post just 'cause it has 'foobar' in the body
479
- assert_no_match(%r|<td[^>]*>not_in_the_title</td>|, response.body)
480
-
481
- # should show the textile, title, and all-or-any search fields pre-set
482
- assert_select('form[id=search_form][method=get]') do
483
- assert_select(
484
- 'input[type=radio][name=?][value=all][checked=checked]',
485
- 'search[(all_or_any)]'
486
- )
487
- assert_select('input[name=?][value=foobar]', 'search[title]')
488
- assert_select('select[name=?]', 'search[textile]') do
489
- assert_select("option[value='']", :text => '')
490
- assert_select("option[value='true']", :text => 'Yes')
491
- assert_select("option[value='false'][selected=selected]", :text => 'No')
492
- end
493
- end
494
- end
495
-
496
- def test_index_for_title_with_foobar_and_textile_false
497
- create_foobar_blog_posts
498
- get(
499
- "/admin/blog_posts2",
500
- :search => {
501
- :textile => 'false', :title => 'foobar', '(all_or_any)' => 'any',
502
- :user => ''
503
- }
504
- )
505
- assert_response :success
506
-
507
- # should show a blog post with 'foobar' in the title
508
- assert_select('td', :text => 'textile_true_foobar')
509
-
510
- # should show a blog post with textile=false
511
- assert_select('td', :text => 'textile is false')
512
-
513
- # should not show a blog post that's already published, because of the conditions set in controller
514
- assert_no_match(%r|<td[^>]*>already published</td>|, response.body)
515
-
516
- # should show the textile, title, and all-or-any search fields pre-set
517
- assert_select('form[id=search_form][method=get]') do
518
- assert_select(
519
- 'input[type=radio][name=?][value=any][checked=checked]',
520
- 'search[(all_or_any)]'
521
- )
522
- assert_select('input[name=?][value=foobar]', 'search[title]')
523
- assert_select('select[name=?]', 'search[textile]') do
524
- assert_select("option[value='']", :text => '')
525
- assert_select("option[value='true']", :text => 'Yes')
526
- assert_select("option[value='false'][selected=selected]", :text => 'No')
527
- end
528
- end
529
- end
530
-
531
- def test_index_when_searching_by_user_and_there_are_less_than_15_users
532
- @user2 = User.create! :username => 'Jean-Paul'
533
- User.count.downto(14) do
534
- user = User.find(
535
- :first,
536
- :conditions => [
537
- 'username != ? and username != ?', @user.username, @user.username
538
- ]
539
- )
540
- user.destroy
541
- end
542
- BlogPost.destroy_all
543
- BlogPost.create! :title => "Soren's first post", :user => @user
544
- BlogPost.create! :title => "Soren's second post", :user => @user
545
- BlogPost.create! :title => "Jean-Paul's post", :user => @user2
546
- get(
547
- "/admin/blog_posts2",
548
- :search => {:textile => '', :title => '', :user_id => @user2.id.to_s}
549
- )
550
- assert_response :success
551
-
552
- # should show blog posts by Jean-Paul
553
- assert_select('td', :text => "Jean-Paul's post")
554
-
555
- # should not show blog posts by Soren
556
- assert_no_match(%r|<td[^>]*>Soren's first post</td>|, response.body)
557
- assert_no_match(%r|<td[^>]*>Soren's second post</td>|, response.body)
558
-
559
- # should show the user field pre-set
560
- assert_select(
561
- 'form[id=search_form][method=get]', :text => /Title/
562
- ) do
563
- assert_select('select[name=?]', 'search[user_id]') do
564
- assert_select("option[value='']", :text => '')
565
- assert_select("option[value=?][selected=selected]", @user2.id)
566
- end
567
- end
568
- end
569
-
570
- def test_index_when_searching_by_user_and_there_are_more_than_15_users
571
- @blog_post = BlogPost.create! :title => random_word, :user => @user
572
- User.count.upto(16) do |i|
573
- User.create! :username => "--user #{i}--"
574
- end
575
- get(
576
- "/admin/blog_posts2",
577
- :search => {:textile => '', :title => '', :user_id => @user.id.to_s}
578
- )
579
- assert_response :success
580
-
581
- # should show pre-populated user token input in the search form
582
- assert_select("select[name=?]", "search[user_id]]", false)
583
- assert_select("input[name=?][value=?]", 'search[user_id]', @user.id)
584
- assert_match(
585
- %r|
586
- \$\("\#search_user_id"\)\.tokenInput\(
587
- \s*"/admin/blog_posts2/autocomplete_user",
588
- .*prePopulate
589
- .*"id":\s*#{@user.id}
590
- |mx,
591
- response.body
592
- )
593
- end
594
-
595
- def test_index_with_a_blank_search
596
- get(
597
- "/admin/blog_posts2",
598
- :search => {
599
- :body => '', :title => '', :textile => '', :id => '', :user_id => '',
600
- '(all_or_any)' => 'all', 'id(comparator)' => ''
601
- }
602
- )
603
-
604
- # should be successful
605
- assert_response :success
606
- end
607
-
608
- def test_index_with_one_record_with_a_false_textile_field
609
- BlogPost.destroy_all
610
- @blog_post = BlogPost.create!(
611
- :title => random_word, :user => @user, :textile => false
612
- )
613
- get "/admin/blog_posts2"
614
-
615
- # should make the textile field an Ajax toggle
616
- toggle_div_id = "blog_post_#{@blog_post.id}_textile"
617
- post_url =
618
- "/admin/blog_posts2/update/#{@blog_post.id}?" +
619
- CGI.escape('blog_post[textile]') + "=1&amp;from=#{toggle_div_id}"
620
- assert_select("div[id=?]", toggle_div_id) do
621
- assert_select("a.toggle[href=?]", post_url, :text => 'No')
622
- end
623
- end
624
-
625
- def test_index_with_11_blog_posts
626
- BlogPost.destroy_all
627
- 1.upto(11) do |i|
628
- BlogPost.create!(
629
- :title => "--post #{i}--", :user => @user
630
- )
631
- end
632
- get "/admin/blog_posts2"
633
-
634
- # should show link to page 2
635
- assert_select("a[href=/admin/blog_posts2?page=2]")
636
-
637
- # should say 11 blog posts found
638
- assert_match(/11 blog posts found/, response.body)
639
-
640
- # should mark the table rows with custom CSS class
641
- assert_select('tr[class~="custom_tr_css_class"]')
642
-
643
- # should mark the user cells with custom CSS class
644
- assert_select('td[class~="custom_td_css_class"]', :text => @user.username)
645
- end
646
-
647
- def test_new
648
- Tag.find_or_create_by_tag 'tag_from_yesterday'
649
- get "/admin/blog_posts2/new"
650
-
651
- # should show a field for tags
652
- assert_match(%r|<input.*name="blog_post\[tags\]"|m, response.body)
653
-
654
- # should show current tags
655
- assert_match(/tag_from_yesterday/, response.body)
656
-
657
- # should show a checkbox for the 'publish' virtual field
658
- if %w(2.3.2 2.3.3 2.3.4).include?(RAILS_GEM_VERSION)
659
- assert_match(
660
- %r!
661
- <input[^>]*
662
- (name="blog_post\[publish\][^>]*type="hidden"[^>]value="0"|
663
- type="hidden"[^>]*name="blog_post\[publish\][^>]value="0")
664
- .*
665
- <input[^>]*
666
- (name="blog_post\[publish\][^>]*type="checkbox"[^>]value="1"|
667
- type="checkbox"[^>]*name="blog_post\[publish\][^>]value="1")
668
- !x,
669
- response.body
670
- )
671
- elsif %w(2.1.0 2.1.2 2.2.2).include?(RAILS_GEM_VERSION)
672
- assert_match(
673
- %r!
674
- <input[^>]*
675
- (name="blog_post\[publish\][^>]*type="checkbox"[^>]value="1"|
676
- type="checkbox"[^>]*name="blog_post\[publish\][^>]value="1")
677
- .*
678
- <input[^>]*
679
- (name="blog_post\[publish\][^>]*type="hidden"[^>]value="0"|
680
- type="hidden"[^>]*name="blog_post\[publish\][^>]value="0")
681
- !x,
682
- response.body
683
- )
684
- else
685
- raise "I don't have a specified behavior for #{RAILS_GEM_VERSION}"
686
- end
687
-
688
- # should not duplicate the DOM ID of the 'publish' checkbox on the page
689
- assert_equal(
690
- 1,
691
- response.body.scan(
692
- /id="blog_post_publish"|id="blog_post\[publish\]"/
693
- ).size
694
- )
695
-
696
- # should show the description for the 'publish' virtual field
697
- assert_match(
698
- /Click this and published_at will be set automatically/,
699
- response.body
700
- )
701
-
702
- # should show a preview button
703
- assert_select('input[type=submit][value=Preview]')
704
-
705
- # should use a textarea for the body field
706
- assert_select(
707
- 'textarea[name=?][cols=20][rows=40]', 'blog_post[body]'
708
- )
709
-
710
- # should use a checkbox for the boolean field 'textile'
711
- assert_match(
712
- %r!
713
- <input[^>]*
714
- (name="blog_post\[textile\][^>]*type="checkbox"|
715
- type="checkbox"[^>]*name="blog_post\[textile\])
716
- !x,
717
- response.body
718
- )
719
-
720
- # should say 'Author' instead of 'User'
721
- assert_match(/Author/, response.body)
722
- end
723
-
724
- def test_show
725
- @blog_post = BlogPost.create! :title => random_word, :user => @user
726
- get "/admin/blog_posts2/show/#{@blog_post.id}"
727
- assert_response :success
728
-
729
- # should show user
730
- assert_match(/soren/, response.body)
731
-
732
- # should not show created at
733
- assert_no_match(/Created at/, response.body)
734
- end
735
-
736
- def test_update_when_there_are_no_validation_errors
737
- @blog_post = BlogPost.create! :title => random_word, :user => @user
738
- post(
739
- "/admin/blog_posts2/update/#{@blog_post.id}",
740
- :blog_post => {:tags => 'tag1 tag2 tag3'}
741
- )
742
-
743
- # should set the tags_string
744
- @blog_post.reload
745
- assert_match(/tag1,tag2,tag3/, @blog_post.tags_string)
746
- end
747
-
748
- def test_update_when_the_user_has_clicked_Preview
749
- @blog_post = BlogPost.create! :title => random_word, :user => @user
750
- title2 = random_word
751
- post(
752
- "/admin/blog_posts2/update/#{@blog_post.id}",
753
- :blog_post => {:title => title2},
754
- :commit => 'Preview'
755
- )
756
-
757
- # should redirect to the edit page with the preview flag
758
- assert_redirected_to("/admin/blog_posts2/edit/#{@blog_post.id}?preview=1")
759
- end
760
-
761
- def test_update_with_a_bad_tag
762
- @blog_post = BlogPost.create! :title => random_word, :user => @user
763
- post(
764
- "/admin/blog_posts2/update/#{@blog_post.id}",
765
- :blog_post => {:tags => "foo bar! baz"}
766
- )
767
-
768
- # should render a useful error
769
- assert_select("div.errorExplanation") do
770
- assert_select 'li', :text => "Tags contain invalid string 'bar!'"
771
- end
772
-
773
- # should highlight the tag string entry
774
- assert_select("div.fieldWithErrors") do
775
- assert_select "input[name=?][value=?]", "blog_post[tags]", "foo bar! baz"
776
- end
777
- end
778
-
779
- def test_update_with_a_bad_tag_and_a_missing_title
780
- @blog_post = BlogPost.create! :title => random_word, :user => @user
781
- post(
782
- "/admin/blog_posts2/update/#{@blog_post.id}",
783
- :blog_post => {:tags => "foo bar! baz", :title => ''}
784
- )
785
-
786
- # should render a useful tags error
787
- assert_select("div.errorExplanation") do
788
- assert_select 'li', :text => "Tags contain invalid string 'bar!'"
789
- end
790
-
791
- # should highlight the tag string entry
792
- assert_select("div.fieldWithErrors") do
793
- assert_select "input[name=?][value=?]", "blog_post[tags]", "foo bar! baz"
794
- end
795
-
796
- # should render a useful title error
797
- assert_select("div.errorExplanation") do
798
- assert_select 'li', :text => "Title can't be blank"
799
- end
800
-
801
- # should highlight the title string entry
802
- assert_select("div.fieldWithErrors") do
803
- assert_select "input[name=?][value=?]", "blog_post[title]", ""
804
- end
805
- end
806
- end