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,789 @@
|
|
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",
|
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",
|
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/#{@blog_post.id}/edit?preview=1"
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_create_with_a_bad_tag
|
90
|
+
@title = random_word
|
91
|
+
post(
|
92
|
+
"/admin/blog_posts2",
|
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.field_with_errors") 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",
|
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.field_with_errors") 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.field_with_errors") 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",
|
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/#{@blog_post.id}/edit"
|
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/#{@blog_post.id}/edit?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/#{@blog_post.id}/edit"
|
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/#{@blog_post.id}/edit"
|
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/#{@blog_post.id}/edit"
|
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/#{@user.id}/edit", :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[blog_post_id]=#{@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='']", :text => '')
|
455
|
+
assert_select("option:not(selected)[value='true']", :text => 'Yes')
|
456
|
+
assert_select("option:not(selected)[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/#{@blog_post.id}?" +
|
619
|
+
'blog_post[textile]' + "=1&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
|
+
assert_match(
|
659
|
+
%r!
|
660
|
+
<input[^>]*
|
661
|
+
(name="blog_post\[publish\][^>]*type="hidden"[^>]value="0"|
|
662
|
+
type="hidden"[^>]*name="blog_post\[publish\][^>]value="0")
|
663
|
+
.*
|
664
|
+
<input[^>]*
|
665
|
+
(name="blog_post\[publish\][^>]*type="checkbox"[^>]value="1"|
|
666
|
+
type="checkbox"[^>]*name="blog_post\[publish\][^>]value="1")
|
667
|
+
!x,
|
668
|
+
response.body
|
669
|
+
)
|
670
|
+
|
671
|
+
# should not duplicate the DOM ID of the 'publish' checkbox on the page
|
672
|
+
assert_equal(
|
673
|
+
1,
|
674
|
+
response.body.scan(
|
675
|
+
/id="blog_post_publish"|id="blog_post\[publish\]"/
|
676
|
+
).size
|
677
|
+
)
|
678
|
+
|
679
|
+
# should show the description for the 'publish' virtual field
|
680
|
+
assert_match(
|
681
|
+
/Click this and published_at will be set automatically/,
|
682
|
+
response.body
|
683
|
+
)
|
684
|
+
|
685
|
+
# should show a preview button
|
686
|
+
assert_select('input[type=submit][value=Preview]')
|
687
|
+
|
688
|
+
# should use a textarea for the body field
|
689
|
+
assert_select(
|
690
|
+
'textarea[name=?][cols=20][rows=40]', 'blog_post[body]'
|
691
|
+
)
|
692
|
+
|
693
|
+
# should use a checkbox for the boolean field 'textile'
|
694
|
+
assert_match(
|
695
|
+
%r!
|
696
|
+
<input[^>]*
|
697
|
+
(name="blog_post\[textile\][^>]*type="checkbox"|
|
698
|
+
type="checkbox"[^>]*name="blog_post\[textile\])
|
699
|
+
!x,
|
700
|
+
response.body
|
701
|
+
)
|
702
|
+
|
703
|
+
# should say 'Author' instead of 'User'
|
704
|
+
assert_match(/Author/, response.body)
|
705
|
+
end
|
706
|
+
|
707
|
+
def test_show
|
708
|
+
@blog_post = BlogPost.create! :title => random_word, :user => @user
|
709
|
+
get "/admin/blog_posts2/#{@blog_post.id}"
|
710
|
+
assert_response :success
|
711
|
+
|
712
|
+
# should show user
|
713
|
+
assert_match(/soren/, response.body)
|
714
|
+
|
715
|
+
# should not show created at
|
716
|
+
assert_no_match(/Created at/, response.body)
|
717
|
+
end
|
718
|
+
|
719
|
+
def test_update_when_there_are_no_validation_errors
|
720
|
+
@blog_post = BlogPost.create! :title => random_word, :user => @user
|
721
|
+
put(
|
722
|
+
"/admin/blog_posts2/#{@blog_post.id}",
|
723
|
+
:blog_post => {:tags => 'tag1 tag2 tag3'}
|
724
|
+
)
|
725
|
+
|
726
|
+
# should set the tags_string
|
727
|
+
@blog_post.reload
|
728
|
+
assert_match(/tag1,tag2,tag3/, @blog_post.tags_string)
|
729
|
+
end
|
730
|
+
|
731
|
+
def test_update_when_the_user_has_clicked_Preview
|
732
|
+
@blog_post = BlogPost.create! :title => random_word, :user => @user
|
733
|
+
title2 = random_word
|
734
|
+
put(
|
735
|
+
"/admin/blog_posts2/#{@blog_post.id}",
|
736
|
+
:blog_post => {:title => title2},
|
737
|
+
:commit => 'Preview'
|
738
|
+
)
|
739
|
+
|
740
|
+
# should redirect to the edit page with the preview flag
|
741
|
+
assert_redirected_to("/admin/blog_posts2/#{@blog_post.id}/edit?preview=1")
|
742
|
+
end
|
743
|
+
|
744
|
+
def test_update_with_a_bad_tag
|
745
|
+
@blog_post = BlogPost.create! :title => random_word, :user => @user
|
746
|
+
put(
|
747
|
+
"/admin/blog_posts2/#{@blog_post.id}",
|
748
|
+
:blog_post => {:tags => "foo bar! baz"}
|
749
|
+
)
|
750
|
+
|
751
|
+
# should render a useful error
|
752
|
+
assert_select("div.errorExplanation") do
|
753
|
+
assert_select 'li', :text => "Tags contain invalid string 'bar!'"
|
754
|
+
end
|
755
|
+
|
756
|
+
# should highlight the tag string entry
|
757
|
+
assert_select("div.field_with_errors") do
|
758
|
+
assert_select "input[name=?][value=?]", "blog_post[tags]", "foo bar! baz"
|
759
|
+
end
|
760
|
+
end
|
761
|
+
|
762
|
+
def test_update_with_a_bad_tag_and_a_missing_title
|
763
|
+
@blog_post = BlogPost.create! :title => random_word, :user => @user
|
764
|
+
put(
|
765
|
+
"/admin/blog_posts2/#{@blog_post.id}",
|
766
|
+
:blog_post => {:tags => "foo bar! baz", :title => ''}
|
767
|
+
)
|
768
|
+
|
769
|
+
# should render a useful tags error
|
770
|
+
assert_select("div.errorExplanation") do
|
771
|
+
assert_select 'li', :text => "Tags contain invalid string 'bar!'"
|
772
|
+
end
|
773
|
+
|
774
|
+
# should highlight the tag string entry
|
775
|
+
assert_select("div.field_with_errors") do
|
776
|
+
assert_select "input[name=?][value=?]", "blog_post[tags]", "foo bar! baz"
|
777
|
+
end
|
778
|
+
|
779
|
+
# should render a useful title error
|
780
|
+
assert_select("div.errorExplanation") do
|
781
|
+
assert_select 'li', :text => "Title can't be blank"
|
782
|
+
end
|
783
|
+
|
784
|
+
# should highlight the title string entry
|
785
|
+
assert_select("div.field_with_errors") do
|
786
|
+
assert_select "input[name=?][value=?]", "blog_post[title]", ""
|
787
|
+
end
|
788
|
+
end
|
789
|
+
end
|