spree 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/History.txt +24 -0
- data/License.txt +26 -0
- data/Manifest.txt +534 -0
- data/README.txt +1 -0
- data/Rakefile +4 -0
- data/bin/spree +157 -0
- data/config/hoe.rb +78 -0
- data/config/requirements.rb +15 -0
- data/lib/spree/version.rb +9 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/starter-app/README +182 -0
- data/starter-app/Rakefile +10 -0
- data/starter-app/app/controllers/application.rb +14 -0
- data/starter-app/app/helpers/application_helper.rb +3 -0
- data/starter-app/app/models/role.rb +3 -0
- data/starter-app/app/models/tag.rb +37 -0
- data/starter-app/app/models/tagging.rb +16 -0
- data/starter-app/app/models/user.rb +102 -0
- data/starter-app/app/views/layouts/application.rhtml +46 -0
- data/starter-app/app/views/shared/_store_menu.rhtml +6 -0
- data/starter-app/config/boot.rb +45 -0
- data/starter-app/config/database.yml +23 -0
- data/starter-app/config/environment.rb +140 -0
- data/starter-app/config/environments/development.rb +21 -0
- data/starter-app/config/environments/production.rb +21 -0
- data/starter-app/config/environments/test.rb +19 -0
- data/starter-app/config/routes.rb +28 -0
- data/starter-app/db/migrate/001_create_users.rb +17 -0
- data/starter-app/db/migrate/002_create_roles.rb +20 -0
- data/starter-app/db/migrate/003_create_tags_and_taggings.rb +28 -0
- data/starter-app/db/migrate/004_spree_to_version_21.rb +9 -0
- data/starter-app/db/sample/addresses.yml +24 -0
- data/starter-app/db/sample/categories.yml +35 -0
- data/starter-app/db/sample/countries.yml +3 -0
- data/starter-app/db/sample/credit_cards.yml +12 -0
- data/starter-app/db/sample/images.yml +252 -0
- data/starter-app/db/sample/line_items.yml +23 -0
- data/starter-app/db/sample/option_types.yml +6 -0
- data/starter-app/db/sample/option_values.yml +35 -0
- data/starter-app/db/sample/orders.yml +15 -0
- data/starter-app/db/sample/product_option_types.yml +8 -0
- data/starter-app/db/sample/products.yml +35 -0
- data/starter-app/db/sample/roles.yml +3 -0
- data/starter-app/db/sample/skus.yml +28 -0
- data/starter-app/db/sample/states.yml +154 -0
- data/starter-app/db/sample/taggings.yml +16 -0
- data/starter-app/db/sample/tags.yml +6 -0
- data/starter-app/db/sample/txns.yml +7 -0
- data/starter-app/db/sample/users.yml +6 -0
- data/starter-app/db/sample/variations.yml +31 -0
- data/starter-app/doc/README_FOR_APP +2 -0
- data/starter-app/lib/authenticated_system.rb +116 -0
- data/starter-app/lib/authenticated_test_helper.rb +10 -0
- data/starter-app/lib/custom_fixtures.rb +7 -0
- data/starter-app/lib/hijacker.rb +78 -0
- data/starter-app/lib/role_requirement_system.rb +142 -0
- data/starter-app/lib/role_requirement_test_helper.rb +86 -0
- data/starter-app/lib/tagging_extensions.rb +104 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/spree_sample_data.rake +38 -0
- data/starter-app/public/.htaccess +40 -0
- data/starter-app/public/404.html +30 -0
- data/starter-app/public/500.html +30 -0
- data/starter-app/public/dispatch.cgi +10 -0
- data/starter-app/public/dispatch.fcgi +24 -0
- data/starter-app/public/dispatch.rb +10 -0
- data/starter-app/public/favicon.ico +0 -0
- data/starter-app/public/images/rails.png +0 -0
- data/starter-app/public/index.html +277 -0
- data/starter-app/public/javascripts/application.js +2 -0
- data/starter-app/public/javascripts/controls.js +833 -0
- data/starter-app/public/javascripts/dragdrop.js +942 -0
- data/starter-app/public/javascripts/effects.js +1088 -0
- data/starter-app/public/javascripts/prototype.js +4184 -0
- data/starter-app/public/robots.txt +1 -0
- data/starter-app/public/stylesheets/application.css +209 -0
- data/starter-app/public/stylesheets/cart/_controller.css +4 -0
- data/starter-app/public/stylesheets/checkout/_controller.css +13 -0
- data/starter-app/script/about +3 -0
- data/starter-app/script/breakpointer +3 -0
- data/starter-app/script/console +3 -0
- data/starter-app/script/destroy +3 -0
- data/starter-app/script/generate +3 -0
- data/starter-app/script/performance/benchmarker +3 -0
- data/starter-app/script/performance/profiler +3 -0
- data/starter-app/script/plugin +3 -0
- data/starter-app/script/process/inspector +3 -0
- data/starter-app/script/process/reaper +3 -0
- data/starter-app/script/process/spawner +3 -0
- data/starter-app/script/runner +3 -0
- data/starter-app/script/server +3 -0
- data/starter-app/test/fixtures/users.yml +7 -0
- data/starter-app/test/test_helper.rb +28 -0
- data/starter-app/test/unit/user_test.rb +8 -0
- data/starter-app/vendor/plugins/acts_as_list/README +23 -0
- data/starter-app/vendor/plugins/acts_as_list/init.rb +3 -0
- data/starter-app/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/starter-app/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/starter-app/vendor/plugins/acts_as_tree/README +26 -0
- data/starter-app/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/starter-app/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/starter-app/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/starter-app/vendor/plugins/attachment_fu/CHANGELOG +24 -0
- data/starter-app/vendor/plugins/attachment_fu/README +162 -0
- data/starter-app/vendor/plugins/attachment_fu/Rakefile +22 -0
- data/starter-app/vendor/plugins/attachment_fu/amazon_s3.yml.tpl +14 -0
- data/starter-app/vendor/plugins/attachment_fu/init.rb +14 -0
- data/starter-app/vendor/plugins/attachment_fu/install.rb +5 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/geometry.rb +93 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb +410 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb +39 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb +97 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb +309 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb +61 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb +56 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb +53 -0
- data/starter-app/vendor/plugins/attachment_fu/test/amazon_s3.yml +6 -0
- data/starter-app/vendor/plugins/attachment_fu/test/backends/db_file_test.rb +16 -0
- data/starter-app/vendor/plugins/attachment_fu/test/backends/file_system_test.rb +80 -0
- data/starter-app/vendor/plugins/attachment_fu/test/backends/remote/s3_test.rb +103 -0
- data/starter-app/vendor/plugins/attachment_fu/test/base_attachment_tests.rb +57 -0
- data/starter-app/vendor/plugins/attachment_fu/test/basic_test.rb +64 -0
- data/starter-app/vendor/plugins/attachment_fu/test/database.yml +18 -0
- data/starter-app/vendor/plugins/attachment_fu/test/extra_attachment_test.rb +57 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/attachment.rb +127 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/files/fake/rails.png +0 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/files/foo.txt +1 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/files/rails.png +0 -0
- data/starter-app/vendor/plugins/attachment_fu/test/geometry_test.rb +101 -0
- data/starter-app/vendor/plugins/attachment_fu/test/processors/image_science_test.rb +31 -0
- data/starter-app/vendor/plugins/attachment_fu/test/processors/mini_magick_test.rb +31 -0
- data/starter-app/vendor/plugins/attachment_fu/test/processors/rmagick_test.rb +241 -0
- data/starter-app/vendor/plugins/attachment_fu/test/schema.rb +86 -0
- data/starter-app/vendor/plugins/attachment_fu/test/test_helper.rb +142 -0
- data/starter-app/vendor/plugins/attachment_fu/test/validation_test.rb +55 -0
- data/starter-app/vendor/plugins/calendar_date_select/CHANGELOG +170 -0
- data/starter-app/vendor/plugins/calendar_date_select/MIT-LICENSE +20 -0
- data/starter-app/vendor/plugins/calendar_date_select/README +10 -0
- data/starter-app/vendor/plugins/calendar_date_select/init.rb +15 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/cds_test.html +324 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/prototype.js +4184 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/test.css +40 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/unit/cds_helper_methods.html +46 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/unittest.js +564 -0
- data/starter-app/vendor/plugins/calendar_date_select/lib/calendar_date_select.rb +192 -0
- data/starter-app/vendor/plugins/calendar_date_select/lib/includes_helper.rb +22 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/images/calendar_date_select/calendar.gif +0 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/calendar_date_select.js +439 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_american.js +34 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_finnish.js +24 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_hyphen_ampm.js +36 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_italian.js +24 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/blue.css +130 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/default.css +135 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/plain.css +128 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/red.css +135 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/silver.css +133 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/functional/calendar_date_select_test.rb +95 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/functional/helper_methods_test.rb +15 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/test_helper.rb +26 -0
- data/starter-app/vendor/plugins/engines/CHANGELOG +258 -0
- data/starter-app/vendor/plugins/engines/MIT-LICENSE +21 -0
- data/starter-app/vendor/plugins/engines/README +63 -0
- data/starter-app/vendor/plugins/engines/Rakefile +32 -0
- data/starter-app/vendor/plugins/engines/about.yml +7 -0
- data/starter-app/vendor/plugins/engines/boot.rb +18 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/USAGE +45 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +79 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +13 -0
- data/starter-app/vendor/plugins/engines/init.rb +2 -0
- data/starter-app/vendor/plugins/engines/lib/engines.rb +169 -0
- data/starter-app/vendor/plugins/engines/lib/engines/assets.rb +38 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin.rb +125 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/list.rb +30 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/loader.rb +18 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/locator.rb +11 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/migrator.rb +60 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb +85 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +24 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/asset_helpers.rb +119 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +145 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +161 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +11 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +84 -0
- data/starter-app/vendor/plugins/engines/lib/engines/testing.rb +87 -0
- data/starter-app/vendor/plugins/engines/tasks/engines.rake +176 -0
- data/starter-app/vendor/plugins/in_place_editing/README +14 -0
- data/starter-app/vendor/plugins/in_place_editing/Rakefile +22 -0
- data/starter-app/vendor/plugins/in_place_editing/init.rb +2 -0
- data/starter-app/vendor/plugins/in_place_editing/lib/in_place_editing.rb +25 -0
- data/starter-app/vendor/plugins/in_place_editing/lib/in_place_macros_helper.rb +71 -0
- data/starter-app/vendor/plugins/in_place_editing/test/in_place_editing_test.rb +69 -0
- data/starter-app/vendor/plugins/paginating_find/CHANGELOG +120 -0
- data/starter-app/vendor/plugins/paginating_find/README +89 -0
- data/starter-app/vendor/plugins/paginating_find/init.rb +2 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paginating_find.rb +138 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paging_enumerator.rb +158 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paging_helper.rb +47 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/Rakefile +10 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/app/controllers/application.rb +2 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/boot.rb +44 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/database.yml +6 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/environment.rb +53 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/environments/test.rb +19 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/routes.rb +22 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/db/schema.rb +16 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/script/console +3 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/articles.yml +19 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/authors.yml +7 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/edits.yml +11 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/models.rb +18 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/test_helper.rb +33 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/abstract_test.rb +7 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/group_test.rb +40 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paginating_find_test.rb +194 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paging_enumerator_test.rb +143 -0
- data/starter-app/vendor/plugins/spree/.rakeTasks +7 -0
- data/starter-app/vendor/plugins/spree/CHANGELOG +1 -0
- data/starter-app/vendor/plugins/spree/LICENSE +26 -0
- data/starter-app/vendor/plugins/spree/README +1 -0
- data/starter-app/vendor/plugins/spree/Rakefile +10 -0
- data/starter-app/vendor/plugins/spree/VERSION +1 -0
- data/starter-app/vendor/plugins/spree/app/controllers/account_controller.rb +48 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/base_controller.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/categories_controller.rb +107 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/images_controller.rb +15 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/option_types_controller.rb +70 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/orders_controller.rb +247 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/overview_controller.rb +14 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/products_controller.rb +207 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/reports_controller.rb +53 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/users_controller.rb +45 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/variations_controller.rb +73 -0
- data/starter-app/vendor/plugins/spree/app/controllers/cart_controller.rb +45 -0
- data/starter-app/vendor/plugins/spree/app/controllers/checkout_controller.rb +184 -0
- data/starter-app/vendor/plugins/spree/app/controllers/rails_cart/base_controller.rb +47 -0
- data/starter-app/vendor/plugins/spree/app/controllers/store_controller.rb +27 -0
- data/starter-app/vendor/plugins/spree/app/helpers/account_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/base_helper.rb +14 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/categories_helper.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/option_values_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/orders_helper.rb +11 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/overview_helper.rb +12 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/products_helper.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/users_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/variations_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/cart_helper.rb +6 -0
- data/starter-app/vendor/plugins/spree/app/helpers/checkout_helper.rb +17 -0
- data/starter-app/vendor/plugins/spree/app/helpers/rails_cart/base_helper.rb +101 -0
- data/starter-app/vendor/plugins/spree/app/helpers/search_helper.rb +10 -0
- data/starter-app/vendor/plugins/spree/app/helpers/store_helper.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/models/address.rb +17 -0
- data/starter-app/vendor/plugins/spree/app/models/cart.rb +37 -0
- data/starter-app/vendor/plugins/spree/app/models/cart_item.rb +29 -0
- data/starter-app/vendor/plugins/spree/app/models/category.rb +66 -0
- data/starter-app/vendor/plugins/spree/app/models/country.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/models/credit_card.rb +24 -0
- data/starter-app/vendor/plugins/spree/app/models/image.rb +12 -0
- data/starter-app/vendor/plugins/spree/app/models/line_item.rb +24 -0
- data/starter-app/vendor/plugins/spree/app/models/option_type.rb +4 -0
- data/starter-app/vendor/plugins/spree/app/models/option_value.rb +5 -0
- data/starter-app/vendor/plugins/spree/app/models/order.rb +87 -0
- data/starter-app/vendor/plugins/spree/app/models/order_mailer.rb +22 -0
- data/starter-app/vendor/plugins/spree/app/models/order_operation.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/models/payment.rb +49 -0
- data/starter-app/vendor/plugins/spree/app/models/product.rb +42 -0
- data/starter-app/vendor/plugins/spree/app/models/product_option_type.rb +5 -0
- data/starter-app/vendor/plugins/spree/app/models/search_criteria.rb +27 -0
- data/starter-app/vendor/plugins/spree/app/models/sku.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/models/state.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/models/tax_treatment.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/models/txn.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/models/variation.rb +8 -0
- data/starter-app/vendor/plugins/spree/app/views/account/index.rhtml +3 -0
- data/starter-app/vendor/plugins/spree/app/views/account/login.rhtml +12 -0
- data/starter-app/vendor/plugins/spree/app/views/account/signup.rhtml +16 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/_form.rhtml +24 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/edit.rhtml +9 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/list.rhtml +47 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/new.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/images/new.html.erb +10 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/_form.rhtml +16 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/_new_option_value.rhtml +13 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/_option_values.rhtml +43 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/index.rhtml +23 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/new.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/select.rhtml +28 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/test.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/orders/_address.rhtml +37 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/orders/index.rhtml +99 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/orders/show.rhtml +72 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/overview/index.rhtml +0 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_form.rhtml +65 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_menu.rhtml +7 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_new_variation.rhtml +11 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_option_types.rhtml +42 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_variations.rhtml +41 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/index.rhtml +66 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/new.rhtml +9 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/reports/index.rhtml +29 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/reports/sales_total.rhtml +28 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/_form.rhtml +29 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/_menu.rhtml +5 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/index.rhtml +26 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/new.rhtml +6 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/show.rhtml +9 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/_form.rhtml +33 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/_option_values.rhtml +5 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/list.rhtml +23 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/new.rhtml +14 -0
- data/starter-app/vendor/plugins/spree/app/views/cart/index.rhtml +49 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_address.rhtml +51 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_address_ro.rhtml +18 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_cart_item.rhtml +5 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_extra.rhtml +1 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/addresses.rhtml +51 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/cvv.rhtml +15 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/empty_cart.rhtml +4 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/final_confirmation.rhtml +92 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/incomplete.rhtml +7 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/thank_you.rhtml +11 -0
- data/starter-app/vendor/plugins/spree/app/views/layouts/admin.rhtml +69 -0
- data/starter-app/vendor/plugins/spree/app/views/layouts/products.rhtml +20 -0
- data/starter-app/vendor/plugins/spree/app/views/layouts/simple.rhtml +37 -0
- data/starter-app/vendor/plugins/spree/app/views/order_mailer/cancel.rhtml +15 -0
- data/starter-app/vendor/plugins/spree/app/views/order_mailer/confirm.rhtml +18 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_images.html.erb +43 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_order_details.rhtml +35 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_paginate.rhtml +34 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_report_criteria.rhtml +32 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_tax_treatments.rhtml +12 -0
- data/starter-app/vendor/plugins/spree/app/views/store/_image.html.erb +5 -0
- data/starter-app/vendor/plugins/spree/app/views/store/_products.rhtml +10 -0
- data/starter-app/vendor/plugins/spree/app/views/store/_thumbnails.html.erb +9 -0
- data/starter-app/vendor/plugins/spree/app/views/store/list.rhtml +15 -0
- data/starter-app/vendor/plugins/spree/app/views/store/show.rhtml +69 -0
- data/starter-app/vendor/plugins/spree/assets/.htaccess +40 -0
- data/starter-app/vendor/plugins/spree/assets/404.html +30 -0
- data/starter-app/vendor/plugins/spree/assets/500.html +30 -0
- data/starter-app/vendor/plugins/spree/assets/dispatch.cgi +10 -0
- data/starter-app/vendor/plugins/spree/assets/dispatch.fcgi +24 -0
- data/starter-app/vendor/plugins/spree/assets/dispatch.rb +10 -0
- data/starter-app/vendor/plugins/spree/assets/favicon.ico +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/amex_cid.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/creditcard.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/discover_cid.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/master_cid.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_bag.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_baseball_jersey.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_jr_spaghetti.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_mug.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_ringer_tshirt.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_stein.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_tote.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/rails.png +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spinner.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/progress.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spinner.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo142x65.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo245x112.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/visa_cid.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/application.js +2 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/controls.js +833 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/dragdrop.js +942 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/effects.js +1088 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/lowpro.js +307 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/prototype.js +2515 -0
- data/starter-app/vendor/plugins/spree/assets/robots.txt +1 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/cart/_controller.css +71 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/checkout/_controller.css +31 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/fullscreen.css +63 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/orders/_controller.css +3 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/products/_controller.css +38 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/spree-admin.css +348 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/spree.css +66 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/store/_controller.css +23 -0
- data/starter-app/vendor/plugins/spree/db/migrate/001_create_addresses.rb +20 -0
- data/starter-app/vendor/plugins/spree/db/migrate/002_create_cart_items.rb +14 -0
- data/starter-app/vendor/plugins/spree/db/migrate/003_create_carts.rb +12 -0
- data/starter-app/vendor/plugins/spree/db/migrate/004_create_categories.rb +15 -0
- data/starter-app/vendor/plugins/spree/db/migrate/005_create_categories_products.rb +12 -0
- data/starter-app/vendor/plugins/spree/db/migrate/006_create_line_items.rb +17 -0
- data/starter-app/vendor/plugins/spree/db/migrate/007_create_option_values.rb +15 -0
- data/starter-app/vendor/plugins/spree/db/migrate/008_create_orders.rb +24 -0
- data/starter-app/vendor/plugins/spree/db/migrate/009_create_products.rb +20 -0
- data/starter-app/vendor/plugins/spree/db/migrate/010_create_txns.rb +18 -0
- data/starter-app/vendor/plugins/spree/db/migrate/011_create_variations.rb +11 -0
- data/starter-app/vendor/plugins/spree/db/migrate/012_create_tax_treatments.rb +23 -0
- data/starter-app/vendor/plugins/spree/db/migrate/013_create_skus.rb +13 -0
- data/starter-app/vendor/plugins/spree/db/migrate/014_create_countries.rb +11 -0
- data/starter-app/vendor/plugins/spree/db/migrate/015_create_states.rb +13 -0
- data/starter-app/vendor/plugins/spree/db/migrate/016_create_option_types.rb +13 -0
- data/starter-app/vendor/plugins/spree/db/migrate/017_create_product_option_types.rb +14 -0
- data/starter-app/vendor/plugins/spree/db/migrate/018_create_option_values_variations.rb +12 -0
- data/starter-app/vendor/plugins/spree/db/migrate/019_create_images.rb +19 -0
- data/starter-app/vendor/plugins/spree/db/migrate/020_create_credit_cards.rb +20 -0
- data/starter-app/vendor/plugins/spree/db/migrate/021_create_order_operations.rb +14 -0
- data/starter-app/vendor/plugins/spree/init.rb +11 -0
- data/starter-app/vendor/plugins/spree/install.rb +3 -0
- data/starter-app/vendor/plugins/spree/lib/constants/enumerable_constants.rb +207 -0
- data/starter-app/vendor/plugins/spree/lib/format.rb +12 -0
- data/starter-app/vendor/plugins/spree/lib/gateway/bogus_gateway.rb +63 -0
- data/starter-app/vendor/plugins/spree/lib/shipping/flat_rate.rb +10 -0
- data/starter-app/vendor/plugins/spree/lib/tasks/spree_bootstrap.rake +24 -0
- data/starter-app/vendor/plugins/spree/lib/tax/sales_tax.rb +26 -0
- data/starter-app/vendor/plugins/spree/routes.rb +3 -0
- data/starter-app/vendor/plugins/spree/script/about +3 -0
- data/starter-app/vendor/plugins/spree/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/spree/script/console +3 -0
- data/starter-app/vendor/plugins/spree/script/destroy +3 -0
- data/starter-app/vendor/plugins/spree/script/generate +3 -0
- data/starter-app/vendor/plugins/spree/script/performance/benchmarker +3 -0
- data/starter-app/vendor/plugins/spree/script/performance/profiler +3 -0
- data/starter-app/vendor/plugins/spree/script/plugin +3 -0
- data/starter-app/vendor/plugins/spree/script/process/inspector +3 -0
- data/starter-app/vendor/plugins/spree/script/process/reaper +3 -0
- data/starter-app/vendor/plugins/spree/script/process/spawner +3 -0
- data/starter-app/vendor/plugins/spree/script/runner +3 -0
- data/starter-app/vendor/plugins/spree/script/server +3 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/addresses.yml +29 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/categories.yml +40 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/line_items.yml +32 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/orders.yml +17 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/products.yml +63 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/products_tags.yml +10 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/roles.yml +6 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/roles_users.yml +3 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/skus.yml +5 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/tags.yml +7 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/tax_treatments.yml +7 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/txns.yml +13 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/users.yml +40 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/variations.yml +16 -0
- data/starter-app/vendor/plugins/spree/test/functional/account_controller_test.rb +129 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/base_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/option_groups_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/option_values_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/orders_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/overview_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/products_controller_test.rb +125 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/users_controller_test.rb +58 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/variations_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/application_controller_test.rb +30 -0
- data/starter-app/vendor/plugins/spree/test/functional/cart_controller_test.rb +76 -0
- data/starter-app/vendor/plugins/spree/test/functional/checkout_controller_test.rb +20 -0
- data/starter-app/vendor/plugins/spree/test/integration/authentication_test.rb +53 -0
- data/starter-app/vendor/plugins/spree/test/integration/product_admin_test.rb +135 -0
- data/starter-app/vendor/plugins/spree/test/integration/user_stories_test.rb +59 -0
- data/starter-app/vendor/plugins/spree/test/integration/variations_test.rb +24 -0
- data/starter-app/vendor/plugins/spree/test/test_helper.rb +45 -0
- data/starter-app/vendor/plugins/spree/test/unit/address_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/cart_item_test.rb +55 -0
- data/starter-app/vendor/plugins/spree/test/unit/cart_test.rb +35 -0
- data/starter-app/vendor/plugins/spree/test/unit/category_test.rb +52 -0
- data/starter-app/vendor/plugins/spree/test/unit/line_item_test.rb +61 -0
- data/starter-app/vendor/plugins/spree/test/unit/option_group_test.rb +12 -0
- data/starter-app/vendor/plugins/spree/test/unit/order_test.rb +49 -0
- data/starter-app/vendor/plugins/spree/test/unit/product_test.rb +107 -0
- data/starter-app/vendor/plugins/spree/test/unit/role_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/sales_tax_test.rb +46 -0
- data/starter-app/vendor/plugins/spree/test/unit/sku_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/tag_test.rb +9 -0
- data/starter-app/vendor/plugins/spree/test/unit/tax_treatment_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/txn_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/variation_test.rb +9 -0
- data/starter-app/vendor/plugins/spree/uninstall.rb +1 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/test_helper.rb +2 -0
- data/test/test_railscart.rb +11 -0
- metadata +628 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
sqlite:
|
2
|
+
:adapter: sqlite
|
3
|
+
:dbfile: attachment_fu_plugin.sqlite.db
|
4
|
+
sqlite3:
|
5
|
+
:adapter: sqlite3
|
6
|
+
:dbfile: attachment_fu_plugin.sqlite3.db
|
7
|
+
postgresql:
|
8
|
+
:adapter: postgresql
|
9
|
+
:username: postgres
|
10
|
+
:password: postgres
|
11
|
+
:database: attachment_fu_plugin_test
|
12
|
+
:min_messages: ERROR
|
13
|
+
mysql:
|
14
|
+
:adapter: mysql
|
15
|
+
:host: localhost
|
16
|
+
:username: rails
|
17
|
+
:password:
|
18
|
+
:database: attachment_fu_plugin_test
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
|
2
|
+
|
3
|
+
class OrphanAttachmentTest < Test::Unit::TestCase
|
4
|
+
include BaseAttachmentTests
|
5
|
+
attachment_model OrphanAttachment
|
6
|
+
|
7
|
+
def test_should_create_image_from_uploaded_file
|
8
|
+
assert_created do
|
9
|
+
attachment = upload_file :filename => '/files/rails.png'
|
10
|
+
assert_valid attachment
|
11
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
12
|
+
assert attachment.image?
|
13
|
+
assert !attachment.size.zero?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_should_create_file_from_uploaded_file
|
18
|
+
assert_created do
|
19
|
+
attachment = upload_file :filename => '/files/foo.txt'
|
20
|
+
assert_valid attachment
|
21
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
22
|
+
assert attachment.image?
|
23
|
+
assert !attachment.size.zero?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_should_create_image_from_uploaded_file_with_custom_content_type
|
28
|
+
assert_created do
|
29
|
+
attachment = upload_file :content_type => 'foo/bar', :filename => '/files/rails.png'
|
30
|
+
assert_valid attachment
|
31
|
+
assert !attachment.image?
|
32
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
33
|
+
assert !attachment.size.zero?
|
34
|
+
#assert_equal 1784, attachment.size
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_should_create_thumbnail
|
39
|
+
attachment = upload_file :filename => '/files/rails.png'
|
40
|
+
|
41
|
+
assert_raise Technoweenie::AttachmentFu::ThumbnailError do
|
42
|
+
attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 50, 50)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_should_create_thumbnail_with_geometry_string
|
47
|
+
attachment = upload_file :filename => '/files/rails.png'
|
48
|
+
|
49
|
+
assert_raise Technoweenie::AttachmentFu::ThumbnailError do
|
50
|
+
attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 'x50')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class MinimalAttachmentTest < OrphanAttachmentTest
|
56
|
+
attachment_model MinimalAttachment
|
57
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
class Attachment < ActiveRecord::Base
|
2
|
+
@@saves = 0
|
3
|
+
cattr_accessor :saves
|
4
|
+
has_attachment :processor => :rmagick
|
5
|
+
validates_as_attachment
|
6
|
+
after_attachment_saved do |record|
|
7
|
+
self.saves += 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class SmallAttachment < Attachment
|
12
|
+
has_attachment :max_size => 1.kilobyte
|
13
|
+
end
|
14
|
+
|
15
|
+
class BigAttachment < Attachment
|
16
|
+
has_attachment :size => 1.megabyte..2.megabytes
|
17
|
+
end
|
18
|
+
|
19
|
+
class PdfAttachment < Attachment
|
20
|
+
has_attachment :content_type => 'pdf'
|
21
|
+
end
|
22
|
+
|
23
|
+
class DocAttachment < Attachment
|
24
|
+
has_attachment :content_type => %w(pdf doc txt)
|
25
|
+
end
|
26
|
+
|
27
|
+
class ImageAttachment < Attachment
|
28
|
+
has_attachment :content_type => :image, :resize_to => [50,50]
|
29
|
+
end
|
30
|
+
|
31
|
+
class ImageOrPdfAttachment < Attachment
|
32
|
+
has_attachment :content_type => ['pdf', :image], :resize_to => 'x50'
|
33
|
+
end
|
34
|
+
|
35
|
+
class ImageWithThumbsAttachment < Attachment
|
36
|
+
has_attachment :thumbnails => { :thumb => [50, 50], :geometry => 'x50' }, :resize_to => [55,55]
|
37
|
+
after_resize do |record, img|
|
38
|
+
record.aspect_ratio = img.columns.to_f / img.rows.to_f
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class FileAttachment < ActiveRecord::Base
|
43
|
+
has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files', :processor => :rmagick
|
44
|
+
validates_as_attachment
|
45
|
+
end
|
46
|
+
|
47
|
+
class ImageFileAttachment < FileAttachment
|
48
|
+
has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files',
|
49
|
+
:content_type => :image, :resize_to => [50,50]
|
50
|
+
end
|
51
|
+
|
52
|
+
class ImageWithThumbsFileAttachment < FileAttachment
|
53
|
+
has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files',
|
54
|
+
:thumbnails => { :thumb => [50, 50], :geometry => 'x50' }, :resize_to => [55,55]
|
55
|
+
after_resize do |record, img|
|
56
|
+
record.aspect_ratio = img.columns.to_f / img.rows.to_f
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class ImageWithThumbsClassFileAttachment < FileAttachment
|
61
|
+
# use file_system_path to test backwards compatibility
|
62
|
+
has_attachment :file_system_path => 'vendor/plugins/attachment_fu/test/files',
|
63
|
+
:thumbnails => { :thumb => [50, 50] }, :resize_to => [55,55],
|
64
|
+
:thumbnail_class => 'ImageThumbnail'
|
65
|
+
end
|
66
|
+
|
67
|
+
class ImageThumbnail < FileAttachment
|
68
|
+
has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files/thumbnails'
|
69
|
+
end
|
70
|
+
|
71
|
+
# no parent
|
72
|
+
class OrphanAttachment < ActiveRecord::Base
|
73
|
+
has_attachment :processor => :rmagick
|
74
|
+
validates_as_attachment
|
75
|
+
end
|
76
|
+
|
77
|
+
# no filename, no size, no content_type
|
78
|
+
class MinimalAttachment < ActiveRecord::Base
|
79
|
+
has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files', :processor => :rmagick
|
80
|
+
validates_as_attachment
|
81
|
+
|
82
|
+
def filename
|
83
|
+
"#{id}.file"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
begin
|
88
|
+
class ImageScienceAttachment < ActiveRecord::Base
|
89
|
+
has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files',
|
90
|
+
:processor => :image_science, :thumbnails => { :thumb => [50, 51], :geometry => '31>' }, :resize_to => 55
|
91
|
+
end
|
92
|
+
rescue MissingSourceFile
|
93
|
+
puts $!.message
|
94
|
+
puts "no ImageScience"
|
95
|
+
end
|
96
|
+
|
97
|
+
begin
|
98
|
+
class MiniMagickAttachment < ActiveRecord::Base
|
99
|
+
has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files',
|
100
|
+
:processor => :mini_magick, :thumbnails => { :thumb => [50, 51], :geometry => '31>' }, :resize_to => 55
|
101
|
+
end
|
102
|
+
rescue MissingSourceFile
|
103
|
+
puts $!.message
|
104
|
+
puts "no Mini Magick"
|
105
|
+
end
|
106
|
+
|
107
|
+
begin
|
108
|
+
class MiniMagickAttachment < ActiveRecord::Base
|
109
|
+
has_attachment :path_prefix => 'vendor/plugins/attachment_fu/test/files',
|
110
|
+
:processor => :mini_magick, :thumbnails => { :thumb => [50, 51], :geometry => '31>' }, :resize_to => 55
|
111
|
+
end
|
112
|
+
rescue MissingSourceFile
|
113
|
+
end
|
114
|
+
|
115
|
+
begin
|
116
|
+
class S3Attachment < ActiveRecord::Base
|
117
|
+
has_attachment :storage => :s3, :processor => :rmagick, :s3_config_path => File.join(File.dirname(__FILE__), '../amazon_s3.yml')
|
118
|
+
validates_as_attachment
|
119
|
+
end
|
120
|
+
|
121
|
+
class S3WithPathPrefixAttachment < S3Attachment
|
122
|
+
has_attachment :storage => :s3, :path_prefix => 'some/custom/path/prefix', :processor => :rmagick
|
123
|
+
validates_as_attachment
|
124
|
+
end
|
125
|
+
rescue Technoweenie::AttachmentFu::Backends::S3Backend::ConfigFileNotFoundError
|
126
|
+
puts "S3 error: #{$!}"
|
127
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
foo
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/geometry')) unless Object.const_defined?(:Geometry)
|
3
|
+
|
4
|
+
class GeometryTest < Test::Unit::TestCase
|
5
|
+
def test_should_resize
|
6
|
+
assert_geometry 50, 64,
|
7
|
+
"50x50" => [39, 50],
|
8
|
+
"60x60" => [47, 60],
|
9
|
+
"100x100" => [78, 100]
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_resize_no_width
|
13
|
+
assert_geometry 50, 64,
|
14
|
+
"x50" => [39, 50],
|
15
|
+
"x60" => [47, 60],
|
16
|
+
"x100" => [78, 100]
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_should_resize_no_height
|
20
|
+
assert_geometry 50, 64,
|
21
|
+
"50" => [50, 64],
|
22
|
+
"60" => [60, 77],
|
23
|
+
"100" => [100, 128]
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_should_resize_with_percent
|
27
|
+
assert_geometry 50, 64,
|
28
|
+
"50x50%" => [25, 32],
|
29
|
+
"60x60%" => [30, 38],
|
30
|
+
"120x112%" => [60, 72]
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_should_resize_with_percent_and_no_width
|
34
|
+
assert_geometry 50, 64,
|
35
|
+
"x50%" => [50, 32],
|
36
|
+
"x60%" => [50, 38],
|
37
|
+
"x112%" => [50, 72]
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_should_resize_with_percent_and_no_height
|
41
|
+
assert_geometry 50, 64,
|
42
|
+
"50%" => [25, 32],
|
43
|
+
"60%" => [30, 38],
|
44
|
+
"120%" => [60, 77]
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_should_resize_with_less
|
48
|
+
assert_geometry 50, 64,
|
49
|
+
"50x50<" => [50, 64],
|
50
|
+
"60x60<" => [50, 64],
|
51
|
+
"100x100<" => [78, 100],
|
52
|
+
"100x112<" => [88, 112],
|
53
|
+
"40x70<" => [50, 64]
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_should_resize_with_less_and_no_width
|
57
|
+
assert_geometry 50, 64,
|
58
|
+
"x50<" => [50, 64],
|
59
|
+
"x60<" => [50, 64],
|
60
|
+
"x100<" => [78, 100]
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_should_resize_with_less_and_no_height
|
64
|
+
assert_geometry 50, 64,
|
65
|
+
"50<" => [50, 64],
|
66
|
+
"60<" => [60, 77],
|
67
|
+
"100<" => [100, 128]
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_should_resize_with_greater
|
71
|
+
assert_geometry 50, 64,
|
72
|
+
"50x50>" => [39, 50],
|
73
|
+
"60x60>" => [47, 60],
|
74
|
+
"100x100>" => [50, 64],
|
75
|
+
"100x112>" => [50, 64],
|
76
|
+
"40x70>" => [40, 51]
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_should_resize_with_greater_and_no_width
|
80
|
+
assert_geometry 50, 64,
|
81
|
+
"x40>" => [31, 40],
|
82
|
+
"x60>" => [47, 60],
|
83
|
+
"x100>" => [50, 64]
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_should_resize_with_greater_and_no_height
|
87
|
+
assert_geometry 50, 64,
|
88
|
+
"40>" => [40, 51],
|
89
|
+
"60>" => [50, 64],
|
90
|
+
"100>" => [50, 64]
|
91
|
+
end
|
92
|
+
|
93
|
+
protected
|
94
|
+
def assert_geometry(width, height, values)
|
95
|
+
values.each do |geo, result|
|
96
|
+
# run twice to verify the Geometry string isn't modified after a run
|
97
|
+
geo = Geometry.from_s(geo)
|
98
|
+
2.times { assert_equal result, [width, height] / geo }
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
|
2
|
+
|
3
|
+
class ImageScienceTest < Test::Unit::TestCase
|
4
|
+
attachment_model ImageScienceAttachment
|
5
|
+
|
6
|
+
if Object.const_defined?(:ImageScience)
|
7
|
+
def test_should_resize_image
|
8
|
+
attachment = upload_file :filename => '/files/rails.png'
|
9
|
+
assert_valid attachment
|
10
|
+
assert attachment.image?
|
11
|
+
# test image science thumbnail
|
12
|
+
assert_equal 42, attachment.width
|
13
|
+
assert_equal 55, attachment.height
|
14
|
+
|
15
|
+
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
|
16
|
+
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
|
17
|
+
|
18
|
+
# test exact resize dimensions
|
19
|
+
assert_equal 50, thumb.width
|
20
|
+
assert_equal 51, thumb.height
|
21
|
+
|
22
|
+
# test geometry string
|
23
|
+
assert_equal 31, geo.width
|
24
|
+
assert_equal 41, geo.height
|
25
|
+
end
|
26
|
+
else
|
27
|
+
def test_flunk
|
28
|
+
puts "ImageScience not loaded, tests not running"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
|
2
|
+
|
3
|
+
class MiniMagickTest < Test::Unit::TestCase
|
4
|
+
attachment_model MiniMagickAttachment
|
5
|
+
|
6
|
+
if Object.const_defined?(:MiniMagick)
|
7
|
+
def test_should_resize_image
|
8
|
+
attachment = upload_file :filename => '/files/rails.png'
|
9
|
+
assert_valid attachment
|
10
|
+
assert attachment.image?
|
11
|
+
# test MiniMagick thumbnail
|
12
|
+
assert_equal 43, attachment.width
|
13
|
+
assert_equal 55, attachment.height
|
14
|
+
|
15
|
+
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
|
16
|
+
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
|
17
|
+
|
18
|
+
# test exact resize dimensions
|
19
|
+
assert_equal 50, thumb.width
|
20
|
+
assert_equal 51, thumb.height
|
21
|
+
|
22
|
+
# test geometry string
|
23
|
+
assert_equal 31, geo.width
|
24
|
+
assert_equal 40, geo.height
|
25
|
+
end
|
26
|
+
else
|
27
|
+
def test_flunk
|
28
|
+
puts "MiniMagick not loaded, tests not running"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,241 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper'))
|
2
|
+
|
3
|
+
class RmagickTest < Test::Unit::TestCase
|
4
|
+
attachment_model Attachment
|
5
|
+
|
6
|
+
if Object.const_defined?(:Magick)
|
7
|
+
def test_should_create_image_from_uploaded_file
|
8
|
+
assert_created do
|
9
|
+
attachment = upload_file :filename => '/files/rails.png'
|
10
|
+
assert_valid attachment
|
11
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
12
|
+
assert attachment.image?
|
13
|
+
assert !attachment.size.zero?
|
14
|
+
#assert_equal 1784, attachment.size
|
15
|
+
assert_equal 50, attachment.width
|
16
|
+
assert_equal 64, attachment.height
|
17
|
+
assert_equal '50x64', attachment.image_size
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_create_image_from_uploaded_file_with_custom_content_type
|
22
|
+
assert_created do
|
23
|
+
attachment = upload_file :content_type => 'foo/bar', :filename => '/files/rails.png'
|
24
|
+
assert_valid attachment
|
25
|
+
assert !attachment.image?
|
26
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
27
|
+
assert !attachment.size.zero?
|
28
|
+
#assert_equal 1784, attachment.size
|
29
|
+
assert_nil attachment.width
|
30
|
+
assert_nil attachment.height
|
31
|
+
assert_equal [], attachment.thumbnails
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_should_create_thumbnail
|
36
|
+
attachment = upload_file :filename => '/files/rails.png'
|
37
|
+
|
38
|
+
assert_created do
|
39
|
+
basename, ext = attachment.filename.split '.'
|
40
|
+
thumbnail = attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 50, 50)
|
41
|
+
assert_valid thumbnail
|
42
|
+
assert !thumbnail.size.zero?
|
43
|
+
#assert_in_delta 4673, thumbnail.size, 2
|
44
|
+
assert_equal 50, thumbnail.width
|
45
|
+
assert_equal 50, thumbnail.height
|
46
|
+
assert_equal [thumbnail.id], attachment.thumbnails.collect(&:id)
|
47
|
+
assert_equal attachment.id, thumbnail.parent_id if thumbnail.respond_to?(:parent_id)
|
48
|
+
assert_equal "#{basename}_thumb.#{ext}", thumbnail.filename
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_should_create_thumbnail_with_geometry_string
|
53
|
+
attachment = upload_file :filename => '/files/rails.png'
|
54
|
+
|
55
|
+
assert_created do
|
56
|
+
basename, ext = attachment.filename.split '.'
|
57
|
+
thumbnail = attachment.create_or_update_thumbnail(attachment.create_temp_file, 'thumb', 'x50')
|
58
|
+
assert_valid thumbnail
|
59
|
+
assert !thumbnail.size.zero?
|
60
|
+
#assert_equal 3915, thumbnail.size
|
61
|
+
assert_equal 39, thumbnail.width
|
62
|
+
assert_equal 50, thumbnail.height
|
63
|
+
assert_equal [thumbnail], attachment.thumbnails
|
64
|
+
assert_equal attachment.id, thumbnail.parent_id if thumbnail.respond_to?(:parent_id)
|
65
|
+
assert_equal "#{basename}_thumb.#{ext}", thumbnail.filename
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_should_resize_image(klass = ImageAttachment)
|
70
|
+
attachment_model klass
|
71
|
+
assert_equal [50, 50], attachment_model.attachment_options[:resize_to]
|
72
|
+
attachment = upload_file :filename => '/files/rails.png'
|
73
|
+
assert_valid attachment
|
74
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
75
|
+
assert attachment.image?
|
76
|
+
assert !attachment.size.zero?
|
77
|
+
#assert_in_delta 4673, attachment.size, 2
|
78
|
+
assert_equal 50, attachment.width
|
79
|
+
assert_equal 50, attachment.height
|
80
|
+
end
|
81
|
+
|
82
|
+
test_against_subclass :test_should_resize_image, ImageAttachment
|
83
|
+
|
84
|
+
def test_should_resize_image_with_geometry(klass = ImageOrPdfAttachment)
|
85
|
+
attachment_model klass
|
86
|
+
assert_equal 'x50', attachment_model.attachment_options[:resize_to]
|
87
|
+
attachment = upload_file :filename => '/files/rails.png'
|
88
|
+
assert_valid attachment
|
89
|
+
assert !attachment.db_file.new_record? if attachment.respond_to?(:db_file)
|
90
|
+
assert attachment.image?
|
91
|
+
assert !attachment.size.zero?
|
92
|
+
#assert_equal 3915, attachment.size
|
93
|
+
assert_equal 39, attachment.width
|
94
|
+
assert_equal 50, attachment.height
|
95
|
+
end
|
96
|
+
|
97
|
+
test_against_subclass :test_should_resize_image_with_geometry, ImageOrPdfAttachment
|
98
|
+
|
99
|
+
def test_should_give_correct_thumbnail_filenames(klass = ImageWithThumbsFileAttachment)
|
100
|
+
attachment_model klass
|
101
|
+
assert_created 3 do
|
102
|
+
attachment = upload_file :filename => '/files/rails.png'
|
103
|
+
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
|
104
|
+
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
|
105
|
+
|
106
|
+
[attachment, thumb, geo].each { |record| assert_valid record }
|
107
|
+
|
108
|
+
assert_match /rails\.png$/, attachment.full_filename
|
109
|
+
assert_match /rails_geometry\.png$/, attachment.full_filename(:geometry)
|
110
|
+
assert_match /rails_thumb\.png$/, attachment.full_filename(:thumb)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
test_against_subclass :test_should_give_correct_thumbnail_filenames, ImageWithThumbsFileAttachment
|
115
|
+
|
116
|
+
def test_should_automatically_create_thumbnails(klass = ImageWithThumbsAttachment)
|
117
|
+
attachment_model klass
|
118
|
+
assert_created 3 do
|
119
|
+
attachment = upload_file :filename => '/files/rails.png'
|
120
|
+
assert_valid attachment
|
121
|
+
assert !attachment.size.zero?
|
122
|
+
#assert_equal 1784, attachment.size
|
123
|
+
assert_equal 55, attachment.width
|
124
|
+
assert_equal 55, attachment.height
|
125
|
+
assert_equal 2, attachment.thumbnails.length
|
126
|
+
assert_equal 1.0, attachment.aspect_ratio
|
127
|
+
|
128
|
+
thumb = attachment.thumbnails.detect { |t| t.filename =~ /_thumb/ }
|
129
|
+
assert !thumb.new_record?, thumb.errors.full_messages.join("\n")
|
130
|
+
assert !thumb.size.zero?
|
131
|
+
#assert_in_delta 4673, thumb.size, 2
|
132
|
+
assert_equal 50, thumb.width
|
133
|
+
assert_equal 50, thumb.height
|
134
|
+
assert_equal 1.0, thumb.aspect_ratio
|
135
|
+
|
136
|
+
geo = attachment.thumbnails.detect { |t| t.filename =~ /_geometry/ }
|
137
|
+
assert !geo.new_record?, geo.errors.full_messages.join("\n")
|
138
|
+
assert !geo.size.zero?
|
139
|
+
#assert_equal 3915, geo.size
|
140
|
+
assert_equal 50, geo.width
|
141
|
+
assert_equal 50, geo.height
|
142
|
+
assert_equal 1.0, geo.aspect_ratio
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
test_against_subclass :test_should_automatically_create_thumbnails, ImageWithThumbsAttachment
|
147
|
+
|
148
|
+
# same as above method, but test it on a file model
|
149
|
+
test_against_class :test_should_automatically_create_thumbnails, ImageWithThumbsFileAttachment
|
150
|
+
test_against_subclass :test_should_automatically_create_thumbnails_on_class, ImageWithThumbsFileAttachment
|
151
|
+
|
152
|
+
def test_should_use_thumbnail_subclass(klass = ImageWithThumbsClassFileAttachment)
|
153
|
+
attachment_model klass
|
154
|
+
attachment = nil
|
155
|
+
assert_difference ImageThumbnail, :count do
|
156
|
+
attachment = upload_file :filename => '/files/rails.png'
|
157
|
+
assert_valid attachment
|
158
|
+
end
|
159
|
+
assert_kind_of ImageThumbnail, attachment.thumbnails.first
|
160
|
+
assert_equal attachment.id, attachment.thumbnails.first.parent.id
|
161
|
+
assert_kind_of FileAttachment, attachment.thumbnails.first.parent
|
162
|
+
assert_equal 'rails_thumb.png', attachment.thumbnails.first.filename
|
163
|
+
assert_equal attachment.thumbnails.first.full_filename, attachment.full_filename(attachment.thumbnails.first.thumbnail),
|
164
|
+
"#full_filename does not use thumbnail class' path."
|
165
|
+
assert_equal attachment.destroy attachment
|
166
|
+
end
|
167
|
+
|
168
|
+
test_against_subclass :test_should_use_thumbnail_subclass, ImageWithThumbsClassFileAttachment
|
169
|
+
|
170
|
+
def test_should_remove_old_thumbnail_files_when_updating(klass = ImageWithThumbsFileAttachment)
|
171
|
+
attachment_model klass
|
172
|
+
attachment = nil
|
173
|
+
assert_created 3 do
|
174
|
+
attachment = upload_file :filename => '/files/rails.png'
|
175
|
+
end
|
176
|
+
|
177
|
+
old_filenames = [attachment.full_filename] + attachment.thumbnails.collect(&:full_filename)
|
178
|
+
|
179
|
+
assert_not_created do
|
180
|
+
use_temp_file "files/rails.png" do |file|
|
181
|
+
attachment.filename = 'rails2.png'
|
182
|
+
attachment.temp_path = File.join(fixture_path, file)
|
183
|
+
attachment.save
|
184
|
+
new_filenames = [attachment.reload.full_filename] + attachment.thumbnails.collect { |t| t.reload.full_filename }
|
185
|
+
new_filenames.each { |f| assert File.exists?(f), "#{f} does not exist" }
|
186
|
+
old_filenames.each { |f| assert !File.exists?(f), "#{f} still exists" }
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
test_against_subclass :test_should_remove_old_thumbnail_files_when_updating, ImageWithThumbsFileAttachment
|
192
|
+
|
193
|
+
def test_should_delete_file_when_in_file_system_when_attachment_record_destroyed(klass = ImageWithThumbsFileAttachment)
|
194
|
+
attachment_model klass
|
195
|
+
attachment = upload_file :filename => '/files/rails.png'
|
196
|
+
filenames = [attachment.full_filename] + attachment.thumbnails.collect(&:full_filename)
|
197
|
+
filenames.each { |f| assert File.exists?(f), "#{f} never existed to delete on destroy" }
|
198
|
+
attachment.destroy
|
199
|
+
filenames.each { |f| assert !File.exists?(f), "#{f} still exists" }
|
200
|
+
end
|
201
|
+
|
202
|
+
test_against_subclass :test_should_delete_file_when_in_file_system_when_attachment_record_destroyed, ImageWithThumbsFileAttachment
|
203
|
+
|
204
|
+
def test_should_overwrite_old_thumbnail_records_when_updating(klass = ImageWithThumbsAttachment)
|
205
|
+
attachment_model klass
|
206
|
+
attachment = nil
|
207
|
+
assert_created 3 do
|
208
|
+
attachment = upload_file :filename => '/files/rails.png'
|
209
|
+
end
|
210
|
+
assert_not_created do # no new db_file records
|
211
|
+
use_temp_file "files/rails.png" do |file|
|
212
|
+
attachment.filename = 'rails2.png'
|
213
|
+
attachment.temp_path = File.join(fixture_path, file)
|
214
|
+
attachment.save!
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
test_against_subclass :test_should_overwrite_old_thumbnail_records_when_updating, ImageWithThumbsAttachment
|
220
|
+
|
221
|
+
def test_should_overwrite_old_thumbnail_records_when_renaming(klass = ImageWithThumbsAttachment)
|
222
|
+
attachment_model klass
|
223
|
+
attachment = nil
|
224
|
+
assert_created 3 do
|
225
|
+
attachment = upload_file :class => klass, :filename => '/files/rails.png'
|
226
|
+
end
|
227
|
+
assert_not_created do # no new db_file records
|
228
|
+
attachment.filename = 'rails2.png'
|
229
|
+
attachment.save
|
230
|
+
assert !attachment.reload.size.zero?
|
231
|
+
assert_equal 'rails2.png', attachment.filename
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
test_against_subclass :test_should_overwrite_old_thumbnail_records_when_renaming, ImageWithThumbsAttachment
|
236
|
+
else
|
237
|
+
def test_flunk
|
238
|
+
puts "RMagick not installed, no tests running"
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|