admin_assistant 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/admin_assistant.gemspec +404 -8
- data/rails_2_test/README +256 -0
- data/rails_2_test/Rakefile +13 -0
- data/rails_2_test/app/controllers/admin/appointments2_controller.rb +15 -0
- data/rails_2_test/app/controllers/admin/appointments_controller.rb +11 -0
- data/rails_2_test/app/controllers/admin/blog_posts2_controller.rb +138 -0
- data/rails_2_test/app/controllers/admin/blog_posts3_controller.rb +76 -0
- data/rails_2_test/app/controllers/admin/blog_posts4_controller.rb +21 -0
- data/rails_2_test/app/controllers/admin/blog_posts5_controller.rb +27 -0
- data/rails_2_test/app/controllers/admin/blog_posts6_controller.rb +10 -0
- data/rails_2_test/app/controllers/admin/blog_posts_controller.rb +8 -0
- data/rails_2_test/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +15 -0
- data/rails_2_test/app/controllers/admin/blog_posts_read_only_controller.rb +19 -0
- data/rails_2_test/app/controllers/admin/bookmarks_controller.rb +11 -0
- data/rails_2_test/app/controllers/admin/comments2_controller.rb +14 -0
- data/rails_2_test/app/controllers/admin/comments_controller.rb +12 -0
- data/rails_2_test/app/controllers/admin/file_column_images2_controller.rb +10 -0
- data/rails_2_test/app/controllers/admin/file_column_images_controller.rb +6 -0
- data/rails_2_test/app/controllers/admin/images2_controller.rb +11 -0
- data/rails_2_test/app/controllers/admin/images_controller.rb +6 -0
- data/rails_2_test/app/controllers/admin/misconfigured1_controller.rb +7 -0
- data/rails_2_test/app/controllers/admin/not_migrated_yets_controller.rb +9 -0
- data/rails_2_test/app/controllers/admin/product_categories2_controller.rb +7 -0
- data/rails_2_test/app/controllers/admin/product_categories_controller.rb +5 -0
- data/rails_2_test/app/controllers/admin/products2_controller.rb +15 -0
- data/rails_2_test/app/controllers/admin/products_controller.rb +31 -0
- data/rails_2_test/app/controllers/admin/television_airings_controller.rb +5 -0
- data/rails_2_test/app/controllers/admin/television_time_slots_controller.rb +5 -0
- data/rails_2_test/app/controllers/admin/users2_controller.rb +10 -0
- data/rails_2_test/app/controllers/admin/users_controller.rb +63 -0
- data/rails_2_test/app/controllers/application.rb +16 -0
- data/rails_2_test/app/controllers/application_controller.rb +16 -0
- data/rails_2_test/app/controllers/blog_posts_controller.rb +5 -0
- data/rails_2_test/app/helpers/admin/appointments2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/appointments_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/blog_posts2_helper.rb +27 -0
- data/rails_2_test/app/helpers/admin/blog_posts3_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/blog_posts4_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/blog_posts6_helper.rb +16 -0
- data/rails_2_test/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +29 -0
- data/rails_2_test/app/helpers/admin/blog_posts_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/blog_posts_read_only_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/bookmarks_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/comments2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/comments_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/file_column_images2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/file_column_images_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/images2_helper.rb +8 -0
- data/rails_2_test/app/helpers/admin/images_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/misconfigured1_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/not_migrated_yets_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/product_categories2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/product_categories_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/products2_helper.rb +3 -0
- data/rails_2_test/app/helpers/admin/products_helper.rb +6 -0
- data/rails_2_test/app/helpers/admin/television_airings_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/television_time_slots_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/users2_helper.rb +2 -0
- data/rails_2_test/app/helpers/admin/users_helper.rb +25 -0
- data/rails_2_test/app/helpers/application_helper.rb +3 -0
- data/rails_2_test/app/helpers/blog_posts_helper.rb +2 -0
- data/rails_2_test/app/models/appointment.rb +5 -0
- data/rails_2_test/app/models/blog_post.rb +14 -0
- data/rails_2_test/app/models/blog_post_tag.rb +6 -0
- data/rails_2_test/app/models/bookmark.rb +6 -0
- data/rails_2_test/app/models/comment.rb +4 -0
- data/rails_2_test/app/models/file_column_image.rb +3 -0
- data/rails_2_test/app/models/image.rb +3 -0
- data/rails_2_test/app/models/not_migrated_yet.rb +2 -0
- data/rails_2_test/app/models/product.rb +7 -0
- data/rails_2_test/app/models/product_category.rb +9 -0
- data/rails_2_test/app/models/tag.rb +4 -0
- data/rails_2_test/app/models/television_airing.rb +3 -0
- data/rails_2_test/app/models/television_time_slot.rb +11 -0
- data/rails_2_test/app/models/user.rb +14 -0
- data/rails_2_test/app/views/admin/appointments/_subject_input.html.erb +2 -0
- data/rails_2_test/app/views/admin/appointments2/_time_input.html.erb +31 -0
- data/rails_2_test/app/views/admin/blog_posts2/_after_form.html.erb +5 -0
- data/rails_2_test/app/views/admin/blog_posts2/_after_index.html.erb +1 -0
- data/rails_2_test/app/views/admin/blog_posts2/_after_tags_input.html.erb +16 -0
- data/rails_2_test/app/views/admin/blog_posts2/_before_index.html.erb +2 -0
- data/rails_2_test/app/views/admin/blog_posts5/_after_index_header.html.erb +8 -0
- data/rails_2_test/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +1 -0
- data/rails_2_test/app/views/admin/products/_name_input.html.erb +2 -0
- data/rails_2_test/app/views/admin/products/_percent_off_input.html.erb +2 -0
- data/rails_2_test/app/views/admin/products/_price_input.html.erb +10 -0
- data/rails_2_test/app/views/blog_posts/show.html.erb +13 -0
- data/rails_2_test/app/views/layouts/admin.html.erb +31 -0
- data/rails_2_test/config/boot.rb +109 -0
- data/rails_2_test/config/database.yml +28 -0
- data/rails_2_test/config/environment.rb +78 -0
- data/rails_2_test/config/environments/development.rb +17 -0
- data/rails_2_test/config/environments/production.rb +24 -0
- data/rails_2_test/config/environments/test.rb +24 -0
- data/rails_2_test/config/initializers/inflections.rb +10 -0
- data/rails_2_test/config/initializers/mime_types.rb +5 -0
- data/rails_2_test/config/initializers/new_rails_defaults.rb +17 -0
- data/rails_2_test/config/locales/en.yml +5 -0
- data/rails_2_test/config/routes.rb +43 -0
- data/rails_2_test/db/migrate/20090213215514_create_blog_posts.rb +12 -0
- data/rails_2_test/db/migrate/20090217225542_add_body_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090221220917_create_tags.rb +13 -0
- data/rails_2_test/db/migrate/20090221220947_create_blog_post_tags.rb +14 -0
- data/rails_2_test/db/migrate/20090222162204_add_textile_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090301191722_create_images.rb +16 -0
- data/rails_2_test/db/migrate/20090305165345_create_accounts.rb +14 -0
- data/rails_2_test/db/migrate/20090307225027_rename_accounts_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090309185114_change_blog_posts_textile.rb +9 -0
- data/rails_2_test/db/migrate/20090309193635_create_products.rb +14 -0
- data/rails_2_test/db/migrate/20090309203056_create_comments.rb +15 -0
- data/rails_2_test/db/migrate/20090323005947_create_file_column_images.rb +12 -0
- data/rails_2_test/db/migrate/20090326160049_add_birthday_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20090326223606_add_state_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20090503134004_add_file_column_image_to_products.rb +9 -0
- data/rails_2_test/db/migrate/20090617173651_create_bookmarks.rb +15 -0
- data/rails_2_test/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +9 -0
- data/rails_2_test/db/migrate/20090625144313_add_avatar_fields_to_user.rb +11 -0
- data/rails_2_test/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +9 -0
- data/rails_2_test/db/migrate/20090701171857_add_force_textile_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20090704163647_add_deleted_at_to_products.rb +9 -0
- data/rails_2_test/db/migrate/20090704173800_add_sale_fields_to_products.rb +13 -0
- data/rails_2_test/db/migrate/20090714024501_create_product_categories.rb +15 -0
- data/rails_2_test/db/migrate/20090819162835_add_admin_level_to_users.rb +9 -0
- data/rails_2_test/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +11 -0
- data/rails_2_test/db/migrate/20091221011256_add_position_to_product_categories.rb +9 -0
- data/rails_2_test/db/migrate/20091222160814_create_appointments.rb +14 -0
- data/rails_2_test/db/migrate/20091227224547_add_user_id_to_appointments.rb +9 -0
- data/rails_2_test/db/migrate/20100214213359_create_television_time_slots.rb +13 -0
- data/rails_2_test/db/migrate/20100214213451_create_television_airings.rb +15 -0
- data/rails_2_test/doc/README_FOR_APP +5 -0
- data/rails_2_test/lib/tasks/rspec.rake +163 -0
- data/rails_2_test/public/404.html +30 -0
- data/rails_2_test/public/422.html +30 -0
- data/rails_2_test/public/500.html +33 -0
- data/rails_2_test/public/dispatch.cgi +10 -0
- data/rails_2_test/public/dispatch.fcgi +24 -0
- data/rails_2_test/public/dispatch.rb +10 -0
- data/rails_2_test/public/favicon.ico +0 -0
- data/rails_2_test/public/images/rails.png +0 -0
- data/rails_2_test/public/index.html +274 -0
- data/rails_2_test/public/javascripts/application.js +2 -0
- data/rails_2_test/public/javascripts/jquery-1.4.4.min.js +167 -0
- data/rails_2_test/public/robots.txt +5 -0
- data/rails_2_test/public/stylesheets/admin.css +3 -0
- data/rails_2_test/public/stylesheets/scaffold.css +54 -0
- data/rails_2_test/script/about +4 -0
- data/rails_2_test/script/autospec +5 -0
- data/rails_2_test/script/console +3 -0
- data/rails_2_test/script/dbconsole +3 -0
- data/rails_2_test/script/destroy +3 -0
- data/rails_2_test/script/generate +3 -0
- data/rails_2_test/script/performance/benchmarker +3 -0
- data/rails_2_test/script/performance/profiler +3 -0
- data/rails_2_test/script/performance/request +3 -0
- data/rails_2_test/script/plugin +3 -0
- data/rails_2_test/script/populate_tables.rb +49 -0
- data/rails_2_test/script/process/inspector +3 -0
- data/rails_2_test/script/process/reaper +3 -0
- data/rails_2_test/script/process/spawner +3 -0
- data/rails_2_test/script/runner +3 -0
- data/rails_2_test/script/server +3 -0
- data/rails_2_test/script/spec +5 -0
- data/rails_2_test/script/spec_server +125 -0
- data/rails_2_test/test/data/ruby_throated.jpg +0 -0
- data/rails_2_test/test/data/tweenbot.jpg +0 -0
- data/rails_2_test/test/fixtures/file_column_images.yml +7 -0
- data/rails_2_test/test/integration/admin/appointments2_integration_test.rb +79 -0
- data/rails_2_test/test/integration/admin/appointments_integration_test.rb +367 -0
- data/rails_2_test/test/integration/admin/blog_posts2_integration_test.rb +806 -0
- data/rails_2_test/test/integration/admin/blog_posts3_integration_test.rb +418 -0
- data/rails_2_test/test/integration/admin/blog_posts4_integration_test.rb +189 -0
- data/rails_2_test/test/integration/admin/blog_posts5_integration_test.rb +75 -0
- data/rails_2_test/test/integration/admin/blog_posts6_integration_test.rb +39 -0
- data/rails_2_test/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +89 -0
- data/rails_2_test/test/integration/admin/blog_posts_integration_test.rb +788 -0
- data/rails_2_test/test/integration/admin/blog_posts_read_only_integration_test.rb +69 -0
- data/rails_2_test/test/integration/admin/bookmarks_integration_test.rb +445 -0
- data/rails_2_test/test/integration/admin/comments2_integration_test.rb +52 -0
- data/rails_2_test/test/integration/admin/comments_integration_test.rb +50 -0
- data/rails_2_test/test/integration/admin/file_column_images2_integration_test.rb +19 -0
- data/rails_2_test/test/integration/admin/file_column_images_integration_test.rb +69 -0
- data/rails_2_test/test/integration/admin/images2_integration_test.rb +33 -0
- data/rails_2_test/test/integration/admin/images_integration_test.rb +79 -0
- data/rails_2_test/test/integration/admin/misconfigured1_integration_test.rb +17 -0
- data/rails_2_test/test/integration/admin/product_categories2_integration_test.rb +179 -0
- data/rails_2_test/test/integration/admin/product_categories_integration_test.rb +12 -0
- data/rails_2_test/test/integration/admin/products2_integration_test.rb +155 -0
- data/rails_2_test/test/integration/admin/products_integration_test.rb +210 -0
- data/rails_2_test/test/integration/admin/television_airings_integration_test.rb +25 -0
- data/rails_2_test/test/integration/admin/users2_integration_test.rb +48 -0
- data/rails_2_test/test/integration/admin/users_integration_test.rb +266 -0
- data/rails_2_test/test/integration/blog_posts_integration_test.rb +9 -0
- data/rails_2_test/test/test_helper.rb +114 -0
- data/rails_2_test/vendor/plugins/file_column/CHANGELOG +69 -0
- data/rails_2_test/vendor/plugins/file_column/README +54 -0
- data/rails_2_test/vendor/plugins/file_column/Rakefile +36 -0
- data/rails_2_test/vendor/plugins/file_column/TODO +6 -0
- data/rails_2_test/vendor/plugins/file_column/init.rb +13 -0
- data/rails_2_test/vendor/plugins/file_column/lib/file_column.rb +723 -0
- data/rails_2_test/vendor/plugins/file_column/lib/file_column_helper.rb +150 -0
- data/rails_2_test/vendor/plugins/file_column/lib/file_compat.rb +28 -0
- data/rails_2_test/vendor/plugins/file_column/lib/magick_file_column.rb +260 -0
- data/rails_2_test/vendor/plugins/file_column/lib/rails_file_column.rb +19 -0
- data/rails_2_test/vendor/plugins/file_column/lib/test_case.rb +124 -0
- data/rails_2_test/vendor/plugins/file_column/lib/validations.rb +112 -0
- data/rails_2_test/vendor/plugins/file_column/test/abstract_unit.rb +63 -0
- data/rails_2_test/vendor/plugins/file_column/test/connection.rb +17 -0
- data/rails_2_test/vendor/plugins/file_column/test/file_column_helper_test.rb +97 -0
- data/rails_2_test/vendor/plugins/file_column/test/file_column_test.rb +650 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/entry.rb +32 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/invalid-image.jpg +1 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/kerb.jpg +0 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/mysql.sql +25 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/schema.rb +10 -0
- data/rails_2_test/vendor/plugins/file_column/test/fixtures/skanthak.png +0 -0
- data/rails_2_test/vendor/plugins/file_column/test/magick_test.rb +380 -0
- data/rails_2_test/vendor/plugins/file_column/test/magick_view_only_test.rb +21 -0
- data/rails_3_test/.gitignore +4 -0
- data/rails_3_test/Gemfile +12 -0
- data/rails_3_test/Gemfile.lock +100 -0
- data/rails_3_test/README +256 -0
- data/rails_3_test/Rakefile +7 -0
- data/rails_3_test/app/controllers/admin/appointments2_controller.rb +15 -0
- data/rails_3_test/app/controllers/admin/appointments_controller.rb +11 -0
- data/rails_3_test/app/controllers/admin/blog_posts2_controller.rb +138 -0
- data/rails_3_test/app/controllers/admin/blog_posts3_controller.rb +76 -0
- data/rails_3_test/app/controllers/admin/blog_posts4_controller.rb +21 -0
- data/rails_3_test/app/controllers/admin/blog_posts5_controller.rb +27 -0
- data/rails_3_test/app/controllers/admin/blog_posts6_controller.rb +10 -0
- data/rails_3_test/app/controllers/admin/blog_posts_controller.rb +9 -0
- data/rails_3_test/app/controllers/admin/blog_posts_custom_new_and_edit_controller.rb +15 -0
- data/rails_3_test/app/controllers/admin/blog_posts_read_only_controller.rb +19 -0
- data/rails_3_test/app/controllers/admin/bookmarks_controller.rb +11 -0
- data/rails_3_test/app/controllers/admin/comments2_controller.rb +14 -0
- data/rails_3_test/app/controllers/admin/comments_controller.rb +12 -0
- data/rails_3_test/app/controllers/admin/images2_controller.rb +11 -0
- data/rails_3_test/app/controllers/admin/images_controller.rb +6 -0
- data/rails_3_test/app/controllers/admin/misconfigured1_controller.rb +7 -0
- data/rails_3_test/app/controllers/admin/not_migrated_yets_controller.rb +9 -0
- data/rails_3_test/app/controllers/admin/product_categories2_controller.rb +7 -0
- data/rails_3_test/app/controllers/admin/product_categories_controller.rb +5 -0
- data/rails_3_test/app/controllers/admin/television_airings_controller.rb +5 -0
- data/rails_3_test/app/controllers/admin/television_time_slots_controller.rb +5 -0
- data/rails_3_test/app/controllers/admin/users2_controller.rb +10 -0
- data/rails_3_test/app/controllers/admin/users_controller.rb +48 -0
- data/rails_3_test/app/controllers/application_controller.rb +7 -0
- data/rails_3_test/app/controllers/blog_posts_controller.rb +5 -0
- data/rails_3_test/app/helpers/admin/appointments_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/blog_posts2_helper.rb +27 -0
- data/rails_3_test/app/helpers/admin/blog_posts3_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/blog_posts4_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/blog_posts6_helper.rb +13 -0
- data/rails_3_test/app/helpers/admin/blog_posts_custom_new_and_edit_helper.rb +29 -0
- data/rails_3_test/app/helpers/admin/blog_posts_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/blog_posts_read_only_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/bookmarks_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/comments2_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/comments_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/images2_helper.rb +8 -0
- data/rails_3_test/app/helpers/admin/images_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/misconfigured1_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/not_migrated_yets_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/product_categories2_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/product_categories_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/television_airings_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/television_time_slots_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/users2_helper.rb +2 -0
- data/rails_3_test/app/helpers/admin/users_helper.rb +13 -0
- data/rails_3_test/app/helpers/application_helper.rb +2 -0
- data/rails_3_test/app/models/appointment.rb +5 -0
- data/rails_3_test/app/models/blog_post.rb +14 -0
- data/rails_3_test/app/models/blog_post_tag.rb +6 -0
- data/rails_3_test/app/models/bookmark.rb +6 -0
- data/rails_3_test/app/models/comment.rb +4 -0
- data/rails_3_test/app/models/image.rb +3 -0
- data/rails_3_test/app/models/not_migrated_yet.rb +2 -0
- data/rails_3_test/app/models/product.rb +5 -0
- data/rails_3_test/app/models/product_category.rb +9 -0
- data/rails_3_test/app/models/tag.rb +4 -0
- data/rails_3_test/app/models/television_airing.rb +3 -0
- data/rails_3_test/app/models/television_time_slot.rb +11 -0
- data/rails_3_test/app/models/user.rb +11 -0
- data/rails_3_test/app/views/admin/appointments/_subject_input.html.erb +2 -0
- data/rails_3_test/app/views/admin/appointments2/_time_input.html.erb +31 -0
- data/rails_3_test/app/views/admin/blog_posts2/_after_form.html.erb +5 -0
- data/rails_3_test/app/views/admin/blog_posts2/_after_index.html.erb +1 -0
- data/rails_3_test/app/views/admin/blog_posts2/_after_tags_input.html.erb +16 -0
- data/rails_3_test/app/views/admin/blog_posts2/_before_index.html.erb +2 -0
- data/rails_3_test/app/views/admin/blog_posts5/_after_index_header.html.erb +8 -0
- data/rails_3_test/app/views/admin/blog_posts_read_only/_body_for_show.html.erb +1 -0
- data/rails_3_test/app/views/layouts/admin.html.erb +32 -0
- data/rails_3_test/app/views/layouts/application.html.erb +14 -0
- data/rails_3_test/config/application.rb +42 -0
- data/rails_3_test/config/boot.rb +6 -0
- data/rails_3_test/config/database.yml +22 -0
- data/rails_3_test/config/environment.rb +5 -0
- data/rails_3_test/config/environments/development.rb +26 -0
- data/rails_3_test/config/environments/production.rb +49 -0
- data/rails_3_test/config/environments/test.rb +35 -0
- data/rails_3_test/config/initializers/backtrace_silencers.rb +7 -0
- data/rails_3_test/config/initializers/inflections.rb +10 -0
- data/rails_3_test/config/initializers/mime_types.rb +5 -0
- data/rails_3_test/config/initializers/secret_token.rb +7 -0
- data/rails_3_test/config/initializers/session_store.rb +8 -0
- data/rails_3_test/config/locales/en.yml +5 -0
- data/rails_3_test/config/routes.rb +63 -0
- data/rails_3_test/config.ru +4 -0
- data/rails_3_test/db/migrate/20090213215514_create_blog_posts.rb +12 -0
- data/rails_3_test/db/migrate/20090217225542_add_body_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090221220917_create_tags.rb +13 -0
- data/rails_3_test/db/migrate/20090221220947_create_blog_post_tags.rb +14 -0
- data/rails_3_test/db/migrate/20090222162204_add_textile_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090222163231_add_published_at_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090301191722_create_images.rb +16 -0
- data/rails_3_test/db/migrate/20090305165345_create_accounts.rb +14 -0
- data/rails_3_test/db/migrate/20090307225027_rename_accounts_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20090307225750_add_user_id_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090309185114_change_blog_posts_textile.rb +9 -0
- data/rails_3_test/db/migrate/20090309193635_create_products.rb +14 -0
- data/rails_3_test/db/migrate/20090309203056_create_comments.rb +15 -0
- data/rails_3_test/db/migrate/20090323005947_create_file_column_images.rb +12 -0
- data/rails_3_test/db/migrate/20090326160049_add_birthday_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20090326223606_add_state_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20090503134004_add_file_column_image_to_products.rb +9 -0
- data/rails_3_test/db/migrate/20090617173651_create_bookmarks.rb +15 -0
- data/rails_3_test/db/migrate/20090624165355_add_tags_string_to_blog_post.rb +9 -0
- data/rails_3_test/db/migrate/20090625144313_add_avatar_fields_to_user.rb +11 -0
- data/rails_3_test/db/migrate/20090629202956_add_merged_into_to_blog_posts.rb +9 -0
- data/rails_3_test/db/migrate/20090701171857_add_force_textile_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20090704163647_add_deleted_at_to_products.rb +9 -0
- data/rails_3_test/db/migrate/20090704173800_add_sale_fields_to_products.rb +13 -0
- data/rails_3_test/db/migrate/20090714024501_create_product_categories.rb +15 -0
- data/rails_3_test/db/migrate/20090819162835_add_admin_level_to_users.rb +9 -0
- data/rails_3_test/db/migrate/20091115134559_add_first_and_last_names_to_users.rb +11 -0
- data/rails_3_test/db/migrate/20091221011256_add_position_to_product_categories.rb +9 -0
- data/rails_3_test/db/migrate/20091222160814_create_appointments.rb +14 -0
- data/rails_3_test/db/migrate/20091227224547_add_user_id_to_appointments.rb +9 -0
- data/rails_3_test/db/migrate/20100214213359_create_television_time_slots.rb +13 -0
- data/rails_3_test/db/migrate/20100214213451_create_television_airings.rb +15 -0
- data/rails_3_test/db/migrate/20110426215702_remove_avatar_fields_from_users.rb +11 -0
- data/rails_3_test/db/seeds.rb +7 -0
- data/rails_3_test/doc/README_FOR_APP +2 -0
- data/rails_3_test/lib/tasks/.gitkeep +0 -0
- data/rails_3_test/public/404.html +26 -0
- data/rails_3_test/public/422.html +26 -0
- data/rails_3_test/public/500.html +26 -0
- data/rails_3_test/public/favicon.ico +0 -0
- data/rails_3_test/public/images/rails.png +0 -0
- data/rails_3_test/public/index.html +239 -0
- data/rails_3_test/public/javascripts/application.js +2 -0
- data/rails_3_test/public/javascripts/jquery-1.4.4.min.js +167 -0
- data/rails_3_test/public/javascripts/rails.js +191 -0
- data/rails_3_test/public/robots.txt +5 -0
- data/rails_3_test/public/stylesheets/.gitkeep +0 -0
- data/rails_3_test/public/stylesheets/admin.css +3 -0
- data/rails_3_test/public/stylesheets/scaffold.css +54 -0
- data/rails_3_test/script/rails +6 -0
- data/rails_3_test/test/data/ruby_throated.jpg +0 -0
- data/rails_3_test/test/data/tweenbot.jpg +0 -0
- data/rails_3_test/test/fixtures/placeholder.txt +0 -0
- data/rails_3_test/test/integration/admin/appointments2_integration_test.rb +79 -0
- data/rails_3_test/test/integration/admin/appointments_integration_test.rb +367 -0
- data/rails_3_test/test/integration/admin/blog_posts2_integration_test.rb +789 -0
- data/rails_3_test/test/integration/admin/blog_posts3_integration_test.rb +418 -0
- data/rails_3_test/test/integration/admin/blog_posts4_integration_test.rb +189 -0
- data/rails_3_test/test/integration/admin/blog_posts5_integration_test.rb +75 -0
- data/rails_3_test/test/integration/admin/blog_posts6_integration_test.rb +39 -0
- data/rails_3_test/test/integration/admin/blog_posts_custom_new_and_edit_integration_test.rb +89 -0
- data/rails_3_test/test/integration/admin/blog_posts_integration_test.rb +784 -0
- data/rails_3_test/test/integration/admin/blog_posts_read_only_integration_test.rb +69 -0
- data/rails_3_test/test/integration/admin/bookmarks_integration_test.rb +445 -0
- data/rails_3_test/test/integration/admin/comments2_integration_test.rb +52 -0
- data/rails_3_test/test/integration/admin/comments_integration_test.rb +50 -0
- data/rails_3_test/test/integration/admin/images2_integration_test.rb +33 -0
- data/rails_3_test/test/integration/admin/images_integration_test.rb +79 -0
- data/rails_3_test/test/integration/admin/misconfigured1_integration_test.rb +21 -0
- data/rails_3_test/test/integration/admin/product_categories2_integration_test.rb +179 -0
- data/rails_3_test/test/integration/admin/product_categories_integration_test.rb +12 -0
- data/rails_3_test/test/integration/admin/television_airings_integration_test.rb +25 -0
- data/rails_3_test/test/integration/admin/users2_integration_test.rb +48 -0
- data/rails_3_test/test/integration/admin/users_integration_test.rb +182 -0
- data/rails_3_test/test/integration/blog_posts_integration_test.rb +10 -0
- data/rails_3_test/test/performance/browsing_test.rb +9 -0
- data/rails_3_test/test/test_helper.rb +98 -0
- data/rails_3_test/vendor/plugins/.gitkeep +0 -0
- data/website/_layouts/api.html +20 -17
- data/website/_layouts/api1.html +42 -0
- data/website/_layouts/default.html +42 -18
- data/website/api/core.markdown +6 -3
- data/website/api/destroy.markdown +4 -2
- data/website/api/form.markdown +6 -5
- data/website/api/idx.markdown +8 -7
- data/website/api/index.markdown +9 -7
- data/website/api/search.markdown +5 -3
- data/website/api/show.markdown +4 -2
- data/website/community.markdown +3 -2
- data/website/css/main.css +83 -17
- data/website/design_principles.markdown +3 -8
- data/website/index.markdown +13 -9
- data/website/js/lightbox.js +2 -2
- data/website/quick_start.markdown +10 -10
- data/website/screenshots.markdown +11 -11
- data/website/tutorial.markdown +23 -14
- data/website/v1/api/core.markdown +108 -0
- data/website/v1/api/destroy.markdown +27 -0
- data/website/v1/api/form.markdown +293 -0
- data/website/v1/api/idx.markdown +288 -0
- data/website/v1/api/index.markdown +149 -0
- data/website/v1/api/search.markdown +110 -0
- data/website/v1/api/show.markdown +24 -0
- data/website/v1/index.markdown +10 -0
- data/website/v1/quick_start.markdown +48 -0
- data/website/v1/tutorial.markdown +60 -0
- metadata +407 -9
@@ -0,0 +1,418 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
+
|
3
|
+
class Admin::BlogPosts3IntegrationTest < ActionController::IntegrationTest
|
4
|
+
def setup
|
5
|
+
User.destroy_all
|
6
|
+
@user = User.create! :username => 'soren', :password => 'password'
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_create_with_no_title
|
10
|
+
@orig_blog_post_count = BlogPost.count
|
11
|
+
post "/admin/blog_posts3/create", :blog_post => {:user_id => @user.id}
|
12
|
+
|
13
|
+
# should redirect to the index
|
14
|
+
assert_redirected_to(:action => 'index')
|
15
|
+
|
16
|
+
# should create a new blog post with the title pre-filled as (draft)
|
17
|
+
assert_equal(@orig_blog_post_count + 1, BlogPost.count)
|
18
|
+
blog_post = BlogPost.last
|
19
|
+
assert_equal('(draft)', blog_post.title)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_edit
|
23
|
+
@blog_post = BlogPost.create! :title => random_word, :user => @user
|
24
|
+
get "/admin/blog_posts3/edit/#{@blog_post.id}"
|
25
|
+
|
26
|
+
# should have a body field
|
27
|
+
assert_select('textarea[name=?]', 'blog_post[body]')
|
28
|
+
|
29
|
+
# should not include textile
|
30
|
+
assert_no_match(/textile/, response.body)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_index_with_no_blog_posts
|
34
|
+
BlogPost.destroy_all
|
35
|
+
get "/admin/blog_posts3"
|
36
|
+
assert_response :success
|
37
|
+
|
38
|
+
# should use the activescaffold-themed CSS
|
39
|
+
assert_select(
|
40
|
+
'link[href^=/stylesheets/admin_assistant/activescaffold.css]'
|
41
|
+
)
|
42
|
+
|
43
|
+
# should say 'Posts'
|
44
|
+
assert_select('h2', :text => 'Posts')
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_index_with_one_unpublished_blog_post
|
48
|
+
BlogPost.destroy_all
|
49
|
+
@blog_post = BlogPost.create!(
|
50
|
+
:title => "unpublished blog post", :user => @user,
|
51
|
+
:published_at => nil
|
52
|
+
)
|
53
|
+
$cache.flush
|
54
|
+
get "/admin/blog_posts3"
|
55
|
+
|
56
|
+
# should show the blog post
|
57
|
+
assert_match(/unpublished blog post/, response.body)
|
58
|
+
|
59
|
+
# should show 'No' from having called BlogPost#published?
|
60
|
+
assert_select("tr[id=blog_post_#{@blog_post.id}]") do
|
61
|
+
assert_select "td", :text => 'No'
|
62
|
+
end
|
63
|
+
|
64
|
+
# should not have a comparator for the ID search field
|
65
|
+
assert_select('form[id=search_form][method=get]') do
|
66
|
+
assert_select("select[name=?]", "search[id(comparator)]", false)
|
67
|
+
end
|
68
|
+
|
69
|
+
# should have a blank checkbox for the body search field
|
70
|
+
assert_select('form[id=search_form][method=get]') do
|
71
|
+
assert_select("input[type=checkbox][name=?]", "search[body(blank)]")
|
72
|
+
end
|
73
|
+
|
74
|
+
# should render extra action links in order
|
75
|
+
assert_match(/Short title.*Blank body/m, response.body)
|
76
|
+
|
77
|
+
# should have a trinary select for the has_short_title search field
|
78
|
+
assert_select('form[id=search_form][method=get]') do
|
79
|
+
assert_select('select[name=?]', 'search[has_short_title]') do
|
80
|
+
assert_select("option[value='']", :text => '')
|
81
|
+
assert_select("option[value='true']", :text => 'Yes')
|
82
|
+
assert_select("option[value='false']", :text => 'No')
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# should show a search form with specific fields
|
87
|
+
assert_select(
|
88
|
+
'form[id=search_form][method=get]', :text => /Title/
|
89
|
+
) do
|
90
|
+
assert_select('input[name=?]', 'search[title]')
|
91
|
+
assert_select('input[name=?]', 'search[body]')
|
92
|
+
assert_select('select[name=?]', 'search[textile]') do
|
93
|
+
assert_select("option[value='']", :text => '')
|
94
|
+
assert_select("option[value='true']", :text => 'true')
|
95
|
+
assert_select("option[value='false']", :text => 'false')
|
96
|
+
end
|
97
|
+
assert_select('label', :text => 'User')
|
98
|
+
assert_select('input[name=?]', 'search[user]')
|
99
|
+
end
|
100
|
+
|
101
|
+
# should set the count in memcache
|
102
|
+
key =
|
103
|
+
"AdminAssistant::Admin::BlogPosts3Controller_count_published_at_is_null_"
|
104
|
+
assert_equal(1, $cache.read(key))
|
105
|
+
assert_in_delta(12.hours, $cache.expires_in(key), 5.seconds)
|
106
|
+
|
107
|
+
# should not make the textile field an Ajax toggle
|
108
|
+
toggle_div_id = "blog_post_#{@blog_post.id}_textile"
|
109
|
+
assert_no_match(%r|new Ajax.Updater\('#{toggle_div_id}'|, response.body)
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_index_with_a_published_blog_post
|
113
|
+
$cache.flush
|
114
|
+
BlogPost.destroy_all
|
115
|
+
BlogPost.create!(
|
116
|
+
:title => "published blog post", :user => @user,
|
117
|
+
:published_at => Time.now.utc
|
118
|
+
)
|
119
|
+
get "/admin/blog_posts3"
|
120
|
+
|
121
|
+
# should not show the blog post
|
122
|
+
assert_no_match(/published blog post/, response.body)
|
123
|
+
assert_match(/No posts found/, response.body)
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_index_when_searching_by_user
|
127
|
+
User.destroy_all
|
128
|
+
tiffany = User.create!(:username => 'tiffany')
|
129
|
+
BlogPost.create! :title => "By Tiffany", :user => tiffany
|
130
|
+
BlogPost.create!(
|
131
|
+
:title => "Already published", :user => tiffany,
|
132
|
+
:published_at => Time.now
|
133
|
+
)
|
134
|
+
bill = User.create! :username => 'bill', :password => 'parsimony'
|
135
|
+
BlogPost.create! :title => "By Bill", :user => bill
|
136
|
+
brooklyn_steve = User.create!(
|
137
|
+
:username => 'brooklyn_steve', :state => 'NY'
|
138
|
+
)
|
139
|
+
BlogPost.create! :title => "By Brooklyn Steve", :user => brooklyn_steve
|
140
|
+
sadie = User.create!(
|
141
|
+
:username => 'Sadie', :password => 'sadie', :state => 'KY'
|
142
|
+
)
|
143
|
+
BlogPost.create! :title => "By Sadie", :user => sadie
|
144
|
+
get(
|
145
|
+
"/admin/blog_posts3",
|
146
|
+
:search => {
|
147
|
+
:body => "", :textile => "", :id => "", :user => 'ny',
|
148
|
+
:has_short_title => ''
|
149
|
+
}
|
150
|
+
)
|
151
|
+
assert_response :success
|
152
|
+
|
153
|
+
# should match the string to the username
|
154
|
+
assert_match(/By Tiffany/, response.body)
|
155
|
+
|
156
|
+
# should match the string to the password
|
157
|
+
assert_match(/By Bill/, response.body)
|
158
|
+
|
159
|
+
# should match the string to the state
|
160
|
+
assert_match(/By Brooklyn Steve/, response.body)
|
161
|
+
|
162
|
+
# should skip blog posts that don't match anything on the user
|
163
|
+
assert_no_match(/By Sadie/, response.body)
|
164
|
+
|
165
|
+
# should skip blog posts that have already been published
|
166
|
+
assert_no_match(/Already published/, response.body)
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_index_with_blog_posts_from_two_different_users
|
170
|
+
aardvark_man = User.create!(:username => 'aardvark_man')
|
171
|
+
BlogPost.create! :title => 'AARDVARKS!!!!!1', :user => aardvark_man
|
172
|
+
ziggurat = User.create!(:username => 'zigguratz')
|
173
|
+
BlogPost.create! :title => "Wanna go climbing?", :user => ziggurat
|
174
|
+
get "/admin/blog_posts3"
|
175
|
+
assert_response :success
|
176
|
+
|
177
|
+
# should sort by username
|
178
|
+
assert_match(%r|AARDVARKS!!!!!1.*Wanna go climbing|m, response.body)
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_index_when_searching_for_a_blank_body
|
182
|
+
BlogPost.destroy_all
|
183
|
+
@nil_body_post = BlogPost.create!(
|
184
|
+
:title => "nil", :user => @user, :body => nil
|
185
|
+
)
|
186
|
+
@empty_string_body_post = BlogPost.create!(
|
187
|
+
:title => "empty string", :user => @user, :body => ''
|
188
|
+
)
|
189
|
+
@non_blank_body_post = BlogPost.create!(
|
190
|
+
:title => "non-blank", :user => @user, :body => 'foo'
|
191
|
+
)
|
192
|
+
get(
|
193
|
+
"/admin/blog_posts3",
|
194
|
+
:search => {
|
195
|
+
"body(blank)" => '1', :user => '', :body => '', :title => '',
|
196
|
+
:textile => '', :id => '', '(all_or_any)' => 'all',
|
197
|
+
:has_short_title => ''
|
198
|
+
}
|
199
|
+
)
|
200
|
+
|
201
|
+
# should retrieve a blog post with a nil body
|
202
|
+
assert_select("tr[id=?]", "blog_post_#{@nil_body_post.id}")
|
203
|
+
|
204
|
+
# should retrieve a blog post with a space-only string body
|
205
|
+
assert_select(
|
206
|
+
"tr[id=?]", "blog_post_#{@empty_string_body_post.id}"
|
207
|
+
)
|
208
|
+
|
209
|
+
# should not retrieve a blog post with a non-blank body
|
210
|
+
assert_select(
|
211
|
+
"tr[id=?]", "blog_post_#{@non_blank_body_post.id}", false
|
212
|
+
)
|
213
|
+
|
214
|
+
# should have a checked blank checkbox for the body search field
|
215
|
+
assert_select('form[id=search_form][method=get]') do
|
216
|
+
assert_select(
|
217
|
+
"input[type=checkbox][checked=checked][name=?]",
|
218
|
+
"search[body(blank)]"
|
219
|
+
)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_index_when_searching_for_short_title_blog_posts
|
224
|
+
BlogPost.destroy_all
|
225
|
+
@bp1 = BlogPost.create!(
|
226
|
+
:title => 'short', :body => 'foobar', :user => @user
|
227
|
+
)
|
228
|
+
@bp2 = BlogPost.create!(
|
229
|
+
:title => "longer title", :body => 'foobar', :user => @user
|
230
|
+
)
|
231
|
+
get(
|
232
|
+
"/admin/blog_posts3",
|
233
|
+
:search => {
|
234
|
+
:body => "", "body(blank)" => '0', :textile => "", :id => "",
|
235
|
+
:user => '', :has_short_title => 'true'
|
236
|
+
}
|
237
|
+
)
|
238
|
+
|
239
|
+
# should return a short-titled blog post
|
240
|
+
assert_select('td', :text => 'short')
|
241
|
+
|
242
|
+
# should not return a longer-title blog post
|
243
|
+
assert_no_match(%r|<td[^>]*>longer title</td>|, response.body)
|
244
|
+
|
245
|
+
# should pre-select 'true' in the has_short_title search field
|
246
|
+
assert_select('form[id=search_form][method=get]') do
|
247
|
+
assert_select('select[name=?]', 'search[has_short_title]') do
|
248
|
+
assert_select("option[value='']", :text => '')
|
249
|
+
assert_select("option[value='true'][selected=selected]", :text => 'Yes')
|
250
|
+
assert_select("option[value='false']", :text => 'No')
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def test_index_when_searching_for_long_titled_blog_posts
|
256
|
+
BlogPost.destroy_all
|
257
|
+
@bp1 = BlogPost.create!(
|
258
|
+
:title => 'short', :body => 'foobar', :user => @user
|
259
|
+
)
|
260
|
+
@bp2 = BlogPost.create!(
|
261
|
+
:title => "longer title", :body => 'foobar', :user => @user
|
262
|
+
)
|
263
|
+
get(
|
264
|
+
"/admin/blog_posts3",
|
265
|
+
:search => {
|
266
|
+
:body => "", "body(blank)" => '0', :textile => "", :id => "",
|
267
|
+
:user => '', :has_short_title => 'false'
|
268
|
+
}
|
269
|
+
)
|
270
|
+
|
271
|
+
# should not return a short-titled blog post
|
272
|
+
assert_no_match(%r|<td[^>]*>short</td>|, response.body)
|
273
|
+
|
274
|
+
# should return a longer-title blog post
|
275
|
+
assert_select('td', :text => 'longer title')
|
276
|
+
|
277
|
+
# should pre-select 'false' in the has_short_title search field
|
278
|
+
assert_select('form[id=search_form][method=get]') do
|
279
|
+
assert_select('select[name=?]', 'search[has_short_title]') do
|
280
|
+
assert_select("option[value='']", :text => '')
|
281
|
+
assert_select("option[value='true']", :text => 'Yes')
|
282
|
+
assert_select("option[value='false'][selected=selected]", :text => 'No')
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_index_when_searching_for_blog_posts_of_any_title_length
|
288
|
+
BlogPost.destroy_all
|
289
|
+
@bp1 = BlogPost.create!(
|
290
|
+
:title => 'short', :body => 'foobar', :user => @user
|
291
|
+
)
|
292
|
+
@bp2 = BlogPost.create!(
|
293
|
+
:title => "longer title", :body => 'foobar', :user => @user
|
294
|
+
)
|
295
|
+
get(
|
296
|
+
"/admin/blog_posts3",
|
297
|
+
:search => {
|
298
|
+
:body => 'foobar', "body(blank)" => '0', :textile => "", :id => "",
|
299
|
+
:user => '', :has_short_title => ''
|
300
|
+
}
|
301
|
+
)
|
302
|
+
|
303
|
+
# should return a short-titled blog post
|
304
|
+
assert_select('td', :text => 'short')
|
305
|
+
|
306
|
+
# should return a longer-title blog post
|
307
|
+
assert_select('td', :text => 'longer title')
|
308
|
+
end
|
309
|
+
|
310
|
+
def test_index_when_searching_by_id
|
311
|
+
BlogPost.destroy_all
|
312
|
+
@blog_post1 = BlogPost.create! :title => random_word, :user => @user
|
313
|
+
blog_post2 = BlogPost.create! :title => random_word, :user => @user
|
314
|
+
BlogPost.update_all(
|
315
|
+
"id = #{@blog_post1.id * 10}", "id = #{blog_post2.id}"
|
316
|
+
)
|
317
|
+
@blog_post2 = BlogPost.find(@blog_post1.id * 10)
|
318
|
+
get(
|
319
|
+
"/admin/blog_posts3",
|
320
|
+
:search => {
|
321
|
+
:body => '', "body(blank)" => '0', :textile => "",
|
322
|
+
:id => @blog_post1.id.to_s, :user => '', :has_short_title => ''
|
323
|
+
}
|
324
|
+
)
|
325
|
+
|
326
|
+
# should match the record with that ID
|
327
|
+
assert_select("tr[id=?]", "blog_post_#{@blog_post1.id}")
|
328
|
+
|
329
|
+
# should not match a record with an ID that has the ID as a substring
|
330
|
+
assert_select("tr[id=?]", "blog_post_#{@blog_post2.id}", false)
|
331
|
+
end
|
332
|
+
|
333
|
+
def test_index_when_the_blank_body_count_has_been_cached_in_memcache_but_the_request_is_looking_for_the_default_index
|
334
|
+
$cache.flush
|
335
|
+
another_key =
|
336
|
+
"AdminAssistant::Admin::BlogPosts3Controller_count__body_is_null_or_body______"
|
337
|
+
$cache.write another_key, 1_000_000, :expires_in => 12.hours
|
338
|
+
get "/admin/blog_posts3"
|
339
|
+
|
340
|
+
# should not read a value from memcache
|
341
|
+
assert_no_match(/1000000 posts found/, response.body)
|
342
|
+
|
343
|
+
# should set the count in memcache
|
344
|
+
key =
|
345
|
+
"AdminAssistant::Admin::BlogPosts3Controller_count_published_at_is_null_"
|
346
|
+
assert $cache.read(key)
|
347
|
+
assert_in_delta(12.hours, $cache.expires_in(key), 5.seconds)
|
348
|
+
end
|
349
|
+
|
350
|
+
def test_index_when_the_count_has_been_cached_in_memcache
|
351
|
+
BlogPost.create!(:title => "title", :user => @user)
|
352
|
+
key =
|
353
|
+
"AdminAssistant::Admin::BlogPosts3Controller_count_published_at_is_null_"
|
354
|
+
$cache.write key, 1_000_000, :expires_in => 12.hours
|
355
|
+
$cache.raise_on_write
|
356
|
+
get "/admin/blog_posts3"
|
357
|
+
|
358
|
+
# should read memcache and not hit the database
|
359
|
+
assert_match(/1000000 posts found/, response.body)
|
360
|
+
end
|
361
|
+
|
362
|
+
def test_index_with_more_than_one_pages_worth_of_unpublished_blog_posts
|
363
|
+
$cache.flush
|
364
|
+
BlogPost.destroy_all
|
365
|
+
1.upto(26) do |i|
|
366
|
+
BlogPost.create!(
|
367
|
+
:title => "unpublished blog post #{i}", :user => @user,
|
368
|
+
:published_at => nil
|
369
|
+
)
|
370
|
+
end
|
371
|
+
@unpub_count = BlogPost.count "published_at is null"
|
372
|
+
$cache.flush
|
373
|
+
get "/admin/blog_posts3"
|
374
|
+
|
375
|
+
# should cache the total number of entries, not the entries on just this page
|
376
|
+
key =
|
377
|
+
"AdminAssistant::Admin::BlogPosts3Controller_count_published_at_is_null_"
|
378
|
+
assert_equal(@unpub_count, $cache.read(key))
|
379
|
+
assert_in_delta(12.hours, $cache.expires_in(key), 5.seconds)
|
380
|
+
end
|
381
|
+
|
382
|
+
def test_new
|
383
|
+
@request_time = Time.now.utc
|
384
|
+
get "/admin/blog_posts3/new"
|
385
|
+
|
386
|
+
# should not have a body field
|
387
|
+
assert_select('textarea[name=?]', 'blog_post[body]', false)
|
388
|
+
|
389
|
+
# should have a published_at select that starts in the year 2009
|
390
|
+
name = 'blog_post[published_at(1i)]'
|
391
|
+
assert_select('select[name=?]', name) do
|
392
|
+
assert_select "option[value='2009']"
|
393
|
+
assert_select "option[value='2010']"
|
394
|
+
assert_select "option[value='2008']", false
|
395
|
+
end
|
396
|
+
|
397
|
+
# should have a published_at select that is set to now
|
398
|
+
name = 'blog_post[published_at(3i)]'
|
399
|
+
assert_select('select[name=?]', name) do
|
400
|
+
assert_select "option[value=?][selected=selected]", @request_time.day
|
401
|
+
end
|
402
|
+
|
403
|
+
# should not show a nullify link for published_at
|
404
|
+
assert_no_match(%r|<a [^>]*>Set "published at" to nil</a>|, response.body)
|
405
|
+
|
406
|
+
# should say 'New post'
|
407
|
+
assert_select('h2', :text => 'New post')
|
408
|
+
end
|
409
|
+
|
410
|
+
def test_show
|
411
|
+
@blog_post = BlogPost.create! :title => "title", :user => @user
|
412
|
+
get "/admin/blog_posts3/show/#{@blog_post.id}"
|
413
|
+
assert_response :success
|
414
|
+
|
415
|
+
# should say 'Post [ID]'
|
416
|
+
assert_select('h2', :text => "Post #{@blog_post.id}")
|
417
|
+
end
|
418
|
+
end
|
@@ -0,0 +1,189 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
+
|
3
|
+
class Admin::BlogPosts4IntegrationTest < ActionController::IntegrationTest
|
4
|
+
def setup
|
5
|
+
User.destroy_all
|
6
|
+
@user = User.create! :username => 'soren'
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_index
|
10
|
+
BlogPost.create!(
|
11
|
+
:published_at => Time.utc(2009, 9, 1, 12, 30, 0), :user => @user,
|
12
|
+
:title => 'whatever'
|
13
|
+
)
|
14
|
+
get "/admin/blog_posts4"
|
15
|
+
assert_response :success
|
16
|
+
|
17
|
+
# should show datetime stuff in the search form for published_at
|
18
|
+
assert_select(
|
19
|
+
'form[id=search_form][method=get]', :text => /Title/
|
20
|
+
) do
|
21
|
+
assert_select('select[name=?]', 'search[published_at(comparator)]') do
|
22
|
+
assert_select("option[value=?]", ">", :text => 'greater than')
|
23
|
+
assert_select("option[value=?]", "<", :text => 'less than')
|
24
|
+
end
|
25
|
+
nums_and_dt_fields = {
|
26
|
+
1 => :year, 2 => :month, 3 => :day, 4 => :hour, 5 => :min
|
27
|
+
}
|
28
|
+
nums_and_dt_fields.each do |num, dt_field|
|
29
|
+
name = "search[published_at(#{num}i)]"
|
30
|
+
value_for_now_option = Time.now.send(dt_field).to_s
|
31
|
+
if [:hour, :min].include?(dt_field) && value_for_now_option.size == 1
|
32
|
+
value_for_now_option = "0#{value_for_now_option}"
|
33
|
+
end
|
34
|
+
assert_select('select[name=?]', name) do
|
35
|
+
assert_select "option[value='']"
|
36
|
+
assert_select "option[value=?]", value_for_now_option
|
37
|
+
end
|
38
|
+
end
|
39
|
+
assert_select(
|
40
|
+
"a.clear_datetime_select[data-prefix=search_published_at]",
|
41
|
+
:text => 'Clear'
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
# should use strftime_format for displaying published_at
|
46
|
+
assert_select('td', :text => "Sep 01, 2009 12:30:00")
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_index_when_searching_by_published_at_with_a_greater_than_comparator
|
50
|
+
@jun_blog_post = BlogPost.create!(
|
51
|
+
:published_at => Time.utc(2009,6,1), :title => 'June', :user => @user
|
52
|
+
)
|
53
|
+
@aug_blog_post = BlogPost.create!(
|
54
|
+
:published_at => Time.utc(2009,8,1), :title => 'August', :user => @user
|
55
|
+
)
|
56
|
+
get(
|
57
|
+
"/admin/blog_posts4",
|
58
|
+
:search => {
|
59
|
+
:textile => '', :title => '', :user_id => '',
|
60
|
+
'published_at(comparator)' => '>',
|
61
|
+
'published_at(1i)' => '2009', 'published_at(2i)' => '7',
|
62
|
+
'published_at(3i)' => '1', 'published_at(4i)' => '1',
|
63
|
+
'published_at(5i)' => '1'
|
64
|
+
}
|
65
|
+
)
|
66
|
+
assert_response :success
|
67
|
+
|
68
|
+
# should include a blog post with a published_at time after the entered time
|
69
|
+
assert_select('td', :text => 'August')
|
70
|
+
|
71
|
+
# should not include a blog post with a published_at time before the entered time
|
72
|
+
assert_no_match(%r|<td[^>]*>June</td>|, response.body)
|
73
|
+
|
74
|
+
# should show the right fields pre-filled in the search form
|
75
|
+
assert_select(
|
76
|
+
'form[id=search_form][method=get]', :text => /Title/
|
77
|
+
) do
|
78
|
+
assert_select('select[name=?]', 'search[published_at(comparator)]') do
|
79
|
+
assert_select(
|
80
|
+
"option[value=?][selected=selected]", ">", :text => 'greater than'
|
81
|
+
)
|
82
|
+
assert_select("option[value=?]", "<", :text => 'less than')
|
83
|
+
end
|
84
|
+
assert_select('select[name=?]', 'search[published_at(1i)]') do
|
85
|
+
assert_select "option[value=?][selected=selected]", "2009"
|
86
|
+
end
|
87
|
+
assert_select('select[name=?]', 'search[published_at(2i)]') do
|
88
|
+
assert_select "option[value=?][selected=selected]", "7"
|
89
|
+
end
|
90
|
+
assert_select('select[name=?]', 'search[published_at(3i)]') do
|
91
|
+
assert_select "option[value=?][selected=selected]", "1"
|
92
|
+
end
|
93
|
+
assert_select('select[name=?]', 'search[published_at(4i)]') do
|
94
|
+
assert_select "option[value=?][selected=selected]", "01"
|
95
|
+
end
|
96
|
+
assert_select('select[name=?]', 'search[published_at(5i)]') do
|
97
|
+
assert_select "option[value=?][selected=selected]", "01"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_index_when_searching_by_published_at_with_a_less_than_comparator
|
103
|
+
@jun_blog_post = BlogPost.create!(
|
104
|
+
:published_at => Time.utc(2009,6,1), :title => 'June', :user => @user
|
105
|
+
)
|
106
|
+
@aug_blog_post = BlogPost.create!(
|
107
|
+
:published_at => Time.utc(2009,8,1), :title => 'August', :user => @user
|
108
|
+
)
|
109
|
+
get(
|
110
|
+
"/admin/blog_posts4",
|
111
|
+
:search => {
|
112
|
+
:textile => '', :title => '', :user_id => '',
|
113
|
+
'published_at(comparator)' => '<',
|
114
|
+
'published_at(1i)' => '2009', 'published_at(2i)' => '7',
|
115
|
+
'published_at(3i)' => '1', 'published_at(4i)' => '1',
|
116
|
+
'published_at(5i)' => '1'
|
117
|
+
}
|
118
|
+
)
|
119
|
+
assert_response :success
|
120
|
+
|
121
|
+
# should not include a blog post with a published_at time after the entered time
|
122
|
+
assert_no_match(%r|<td[^>]*>August</td>|, response.body)
|
123
|
+
|
124
|
+
# should include a blog post with a published_at time before the entered time
|
125
|
+
assert_select('td', :text => 'June')
|
126
|
+
|
127
|
+
# should show the right fields pre-filled in the search form
|
128
|
+
assert_select(
|
129
|
+
'form[id=search_form][method=get]', :text => /Title/
|
130
|
+
) do
|
131
|
+
assert_select('select[name=?]', 'search[published_at(comparator)]') do
|
132
|
+
assert_select "option[value=?]", ">", :text => 'greater than'
|
133
|
+
assert_select(
|
134
|
+
"option[value=?][selected=selected]", "<", :text => 'less than'
|
135
|
+
)
|
136
|
+
end
|
137
|
+
assert_select('select[name=?]', 'search[published_at(1i)]') do
|
138
|
+
assert_select "option[value=?][selected=selected]", "2009"
|
139
|
+
end
|
140
|
+
assert_select('select[name=?]', 'search[published_at(2i)]') do
|
141
|
+
assert_select "option[value=?][selected=selected]", "7"
|
142
|
+
end
|
143
|
+
assert_select('select[name=?]', 'search[published_at(3i)]') do
|
144
|
+
assert_select "option[value=?][selected=selected]", "1"
|
145
|
+
end
|
146
|
+
assert_select('select[name=?]', 'search[published_at(4i)]') do
|
147
|
+
assert_select "option[value=?][selected=selected]", "01"
|
148
|
+
end
|
149
|
+
assert_select('select[name=?]', 'search[published_at(5i)]') do
|
150
|
+
assert_select "option[value=?][selected=selected]", "01"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_index_with_26_unpublished_blog_posts
|
156
|
+
BlogPost.destroy_all
|
157
|
+
1.upto(26) do |i|
|
158
|
+
BlogPost.create!(
|
159
|
+
:title => "--post #{i}--", :user => @user, :published_at => nil
|
160
|
+
)
|
161
|
+
end
|
162
|
+
get "/admin/blog_posts4"
|
163
|
+
|
164
|
+
# should not show link to page 2
|
165
|
+
assert_select("a[href=/admin/blog_posts4?page=2]", false)
|
166
|
+
|
167
|
+
# should only say 25 blog posts found
|
168
|
+
assert_match(/25 blog posts found/, response.body)
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_new
|
172
|
+
get "/admin/blog_posts4/new"
|
173
|
+
|
174
|
+
# should use a textarea for virtual_text
|
175
|
+
assert_select("textarea[name=?]", "blog_post[virtual_text]")
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_show
|
179
|
+
@blog_post = BlogPost.create!(
|
180
|
+
:published_at => Time.utc(2009, 9, 1, 12, 30, 0), :user => @user,
|
181
|
+
:title => 'whatever'
|
182
|
+
)
|
183
|
+
get "/admin/blog_posts4/show/#{@blog_post.id}"
|
184
|
+
assert_response :success
|
185
|
+
|
186
|
+
# should use strftime_format for displaying published_at
|
187
|
+
assert_match(/Sep 01, 2009 12:30:00/, response.body)
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../test_helper")
|
2
|
+
|
3
|
+
class Admin::BlogPosts5IntegrationTest < ActionController::IntegrationTest
|
4
|
+
def setup
|
5
|
+
User.destroy_all
|
6
|
+
@soren = User.create! :username => 'soren'
|
7
|
+
@jean = User.create! :username => 'jean'
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_create_with_title_alt
|
11
|
+
post(
|
12
|
+
"/admin/blog_posts5/create",
|
13
|
+
:blog_post => {
|
14
|
+
:user_id => @soren.id, :title => '', :title_alt => 'alternate field'
|
15
|
+
}
|
16
|
+
)
|
17
|
+
assert_response :redirect
|
18
|
+
|
19
|
+
# should use the value of title alt for the title
|
20
|
+
bp = BlogPost.last
|
21
|
+
assert_equal('alternate field', bp.title)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_index
|
25
|
+
BlogPost.create!(
|
26
|
+
:published_at => Time.utc(2009, 9, 1, 12, 30, 0), :user => @soren,
|
27
|
+
:title => 'whatever'
|
28
|
+
)
|
29
|
+
BlogPost.create!(
|
30
|
+
:published_at => Time.utc(2009, 9, 1, 12, 30, 0), :user => @soren,
|
31
|
+
:title => 'just do it'
|
32
|
+
)
|
33
|
+
get "/admin/blog_posts5"
|
34
|
+
assert_response :success
|
35
|
+
|
36
|
+
# should render the filter.html.erb partial
|
37
|
+
assert_select('ul.aa_filter')
|
38
|
+
assert_select('ul.aa_filter li a', :text => "soren")
|
39
|
+
assert_select('td', :text => "whatever")
|
40
|
+
assert_select('td', :text => "just do it")
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_index_filter
|
44
|
+
BlogPost.create!(
|
45
|
+
:published_at => Time.utc(2009, 9, 1, 12, 30, 0), :user => @soren,
|
46
|
+
:title => 'whatever'
|
47
|
+
)
|
48
|
+
BlogPost.create!(
|
49
|
+
:published_at => Time.utc(2009, 9, 1, 12, 30, 0), :user => @soren,
|
50
|
+
:title => 'whatever'
|
51
|
+
)
|
52
|
+
|
53
|
+
get "/admin/blog_posts5?filter=#{@soren.id}"
|
54
|
+
assert_response :success
|
55
|
+
|
56
|
+
# should filter blog posts by user id
|
57
|
+
assert_select('td', :text => "whatever")
|
58
|
+
assert_no_match(%r|<td[^>]*>just do it</td>|, response.body)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_search_retains_filter
|
62
|
+
user1 = User.find_or_create_by_username 'friedrich'
|
63
|
+
user2 = User.find_or_create_by_username 'rene'
|
64
|
+
|
65
|
+
BlogPost.create! :title => "God is dead", :user => user1
|
66
|
+
blog_post2 = BlogPost.create! :title => "I think therefore I am", :user => user2
|
67
|
+
|
68
|
+
visit "/admin/blog_posts5"
|
69
|
+
click_link "friedrich"
|
70
|
+
fill_in "search", :with => 'I think therefore I am'
|
71
|
+
click_button 'Search'
|
72
|
+
|
73
|
+
assert_select 'a[href=?]', "/admin/blog_posts5/edit/#{blog_post2.id}", false
|
74
|
+
end
|
75
|
+
end
|