railscart 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/License.txt +26 -0
- data/Manifest.txt +462 -0
- data/README.txt +1 -0
- data/Rakefile +4 -0
- data/bin/railscart +114 -0
- data/config/hoe.rb +78 -0
- data/config/requirements.rb +19 -0
- data/lib/railscart.rb +5 -0
- data/lib/railscart/version.rb +9 -0
- data/log/debug.log +0 -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 +101 -0
- data/starter-app/app/views/layouts/application.rhtml +20 -0
- data/starter-app/config/boot.rb +45 -0
- data/starter-app/config/database.yml +23 -0
- data/starter-app/config/environment.rb +119 -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_add_sessions.rb +16 -0
- data/starter-app/db/migrate/002_create_tags_and_taggings.rb +28 -0
- data/starter-app/db/migrate/003_railscart_to_version_19.rb +9 -0
- data/starter-app/db/migrate/004_railscart_to_version_20.rb +9 -0
- data/starter-app/db/migrate/005_create_users.rb +17 -0
- data/starter-app/db/migrate/006_create_roles.rb +20 -0
- data/starter-app/db/sample/addresses.yml +29 -0
- data/starter-app/db/sample/categories.yml +35 -0
- data/starter-app/db/sample/countries.yml +4 -0
- data/starter-app/db/sample/line_items.yml +32 -0
- data/starter-app/db/sample/option_groups.yml +16 -0
- data/starter-app/db/sample/option_values.yml +13 -0
- data/starter-app/db/sample/options.yml +3 -0
- data/starter-app/db/sample/orders.yml +17 -0
- data/starter-app/db/sample/products.yml +70 -0
- data/starter-app/db/sample/roles.yml +3 -0
- data/starter-app/db/sample/skus.yml +35 -0
- data/starter-app/db/sample/states.yml +204 -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 +13 -0
- data/starter-app/db/sample/users.yml +10 -0
- data/starter-app/db/sample/variations.yml +20 -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/rc_sample_data.rake +31 -0
- data/starter-app/lib/tasks/sample/images/ror_bag.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_baseball_jersey.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_jr_spaghetti.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_mug.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_ringer_tshirt.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_stein.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_tote.jpg +0 -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 +186 -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/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/.tmp_cds_test.html +306 -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 +148 -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 +117 -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 +135 -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/railscart/.rakeTasks +7 -0
- data/starter-app/vendor/plugins/railscart/CHANGELOG +1 -0
- data/starter-app/vendor/plugins/railscart/LICENSE +26 -0
- data/starter-app/vendor/plugins/railscart/README +2 -0
- data/starter-app/vendor/plugins/railscart/Rakefile +10 -0
- data/starter-app/vendor/plugins/railscart/VERSION +1 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/account_controller.rb +48 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/base_controller.rb +7 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/categories_controller.rb +107 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_groups_controller.rb +36 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_values_controller.rb +42 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/options_controller.rb +52 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/orders_controller.rb +194 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/overview_controller.rb +14 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/products_controller.rb +147 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/reports_controller.rb +53 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/users_controller.rb +45 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/variations_controller.rb +73 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/cart_controller.rb +45 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/checkout_controller.rb +179 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/rails_cart/base_controller.rb +41 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/store_controller.rb +20 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/account_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/base_helper.rb +15 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/categories_helper.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_groups_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_values_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/orders_helper.rb +11 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/overview_helper.rb +12 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/users_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/variations_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/cart_helper.rb +6 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/checkout_helper.rb +17 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/rails_cart/base_helper.rb +67 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/search_helper.rb +10 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/store_helper.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/models/address.rb +17 -0
- data/starter-app/vendor/plugins/railscart/app/models/cart.rb +37 -0
- data/starter-app/vendor/plugins/railscart/app/models/cart_item.rb +28 -0
- data/starter-app/vendor/plugins/railscart/app/models/category.rb +66 -0
- data/starter-app/vendor/plugins/railscart/app/models/country.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/models/line_item.rb +24 -0
- data/starter-app/vendor/plugins/railscart/app/models/option.rb +4 -0
- data/starter-app/vendor/plugins/railscart/app/models/option_group.rb +6 -0
- data/starter-app/vendor/plugins/railscart/app/models/option_value.rb +4 -0
- data/starter-app/vendor/plugins/railscart/app/models/order.rb +86 -0
- data/starter-app/vendor/plugins/railscart/app/models/order_mailer.rb +20 -0
- data/starter-app/vendor/plugins/railscart/app/models/payment.rb +49 -0
- data/starter-app/vendor/plugins/railscart/app/models/product.rb +76 -0
- data/starter-app/vendor/plugins/railscart/app/models/search_criteria.rb +27 -0
- data/starter-app/vendor/plugins/railscart/app/models/sku.rb +7 -0
- data/starter-app/vendor/plugins/railscart/app/models/state.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/models/tax_treatment.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/models/txn.rb +7 -0
- data/starter-app/vendor/plugins/railscart/app/models/variation.rb +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/account/index.rhtml +3 -0
- data/starter-app/vendor/plugins/railscart/app/views/account/login.rhtml +12 -0
- data/starter-app/vendor/plugins/railscart/app/views/account/signup.rhtml +16 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/_form.rhtml +27 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/edit.rhtml +9 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/list.rhtml +47 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/_form.rhtml +19 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/_form.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/list.rhtml +22 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/_form.rhtml +7 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/edit.rhtml +26 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/list.rhtml +23 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/orders/_address.rhtml +37 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/orders/index.rhtml +99 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/orders/show.rhtml +43 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/overview/index.rhtml +0 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/_form.rhtml +55 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/_menu.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/_new_variation.rhtml +0 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/index.rhtml +66 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/new.rhtml +13 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/show.rhtml +26 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/reports/index.rhtml +29 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/reports/sales_total.rhtml +28 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/_form.rhtml +29 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/_menu.rhtml +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/index.rhtml +26 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/new.rhtml +6 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/show.rhtml +9 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_form.rhtml +33 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_option_values.rhtml +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/list.rhtml +23 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/new.rhtml +14 -0
- data/starter-app/vendor/plugins/railscart/app/views/cart/index.rhtml +49 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_address.rhtml +51 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_address_ro.rhtml +18 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_cart_item.rhtml +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_extra.rhtml +1 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/addresses.rhtml +49 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/cvv.rhtml +15 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/empty_cart.rhtml +4 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/final_confirmation.rhtml +92 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/incomplete.rhtml +7 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/thank_you.rhtml +11 -0
- data/starter-app/vendor/plugins/railscart/app/views/layouts/admin.rhtml +69 -0
- data/starter-app/vendor/plugins/railscart/app/views/layouts/products.rhtml +20 -0
- data/starter-app/vendor/plugins/railscart/app/views/layouts/simple.rhtml +37 -0
- data/starter-app/vendor/plugins/railscart/app/views/order_mailer/cancel.rhtml +15 -0
- data/starter-app/vendor/plugins/railscart/app/views/order_mailer/confirm.rhtml +18 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_order_details.rhtml +35 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_paginate.rhtml +34 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_report_criteria.rhtml +32 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_tax_treatments.rhtml +12 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_variations.rhtml +60 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/_menu.rhtml +7 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/_products.rhtml +10 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/list.rhtml +16 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/show.rhtml +71 -0
- data/starter-app/vendor/plugins/railscart/assets/.htaccess +40 -0
- data/starter-app/vendor/plugins/railscart/assets/404.html +30 -0
- data/starter-app/vendor/plugins/railscart/assets/500.html +30 -0
- data/starter-app/vendor/plugins/railscart/assets/dispatch.cgi +10 -0
- data/starter-app/vendor/plugins/railscart/assets/dispatch.fcgi +24 -0
- data/starter-app/vendor/plugins/railscart/assets/dispatch.rb +10 -0
- data/starter-app/vendor/plugins/railscart/assets/favicon.ico +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/amex_cid.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/creditcard.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/discover_cid.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/master_cid.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_bag.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_baseball_jersey.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_jr_spaghetti.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_mug.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_ringer_tshirt.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_stein.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_tote.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/rails.png +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/progress.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo142x65.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo245x112.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/spinner.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/spinner.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/visa_cid.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/application.js +2 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/controls.js +833 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/dragdrop.js +942 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/effects.js +1088 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/lowpro.js +307 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/prototype.js +2515 -0
- data/starter-app/vendor/plugins/railscart/assets/robots.txt +1 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/cart/_controller.css +71 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/checkout/_controller.css +31 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/fullscreen.css +63 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/orders/_controller.css +3 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/products/_controller.css +13 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart-admin.css +295 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart.css +66 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/store/_controller.css +23 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/001_create_addresses.rb +22 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/002_create_cart_items.rb +14 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/003_create_carts.rb +12 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/004_create_categories.rb +15 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/005_create_categories_products.rb +12 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/006_create_line_items.rb +17 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/007_create_option_groups.rb +12 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/008_create_option_values.rb +11 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/009_create_options.rb +11 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/010_create_orders.rb +24 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/011_create_products.rb +22 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/012_ignore_users.rb +9 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/013_create_txns.rb +21 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/014_ignore_roles.rb +9 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/015_create_variations.rb +14 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/016_create_tax_treatments.rb +23 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/017_create_skus.rb +13 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/018_create_countries.rb +11 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/019_create_states.rb +13 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/020_modify_users.rb +9 -0
- data/starter-app/vendor/plugins/railscart/init.rb +16 -0
- data/starter-app/vendor/plugins/railscart/install.rb +3 -0
- data/starter-app/vendor/plugins/railscart/lib/constants/enumerable_constants.rb +207 -0
- data/starter-app/vendor/plugins/railscart/lib/format.rb +12 -0
- data/starter-app/vendor/plugins/railscart/lib/gateway/bogus_gateway.rb +63 -0
- data/starter-app/vendor/plugins/railscart/lib/shipping/flat_rate.rb +10 -0
- data/starter-app/vendor/plugins/railscart/lib/tasks/rc_bootstrap.rake +24 -0
- data/starter-app/vendor/plugins/railscart/lib/tax/sales_tax.rb +26 -0
- data/starter-app/vendor/plugins/railscart/routes.rb +3 -0
- data/starter-app/vendor/plugins/railscart/script/about +3 -0
- data/starter-app/vendor/plugins/railscart/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/railscart/script/console +3 -0
- data/starter-app/vendor/plugins/railscart/script/destroy +3 -0
- data/starter-app/vendor/plugins/railscart/script/generate +3 -0
- data/starter-app/vendor/plugins/railscart/script/performance/benchmarker +3 -0
- data/starter-app/vendor/plugins/railscart/script/performance/profiler +3 -0
- data/starter-app/vendor/plugins/railscart/script/plugin +3 -0
- data/starter-app/vendor/plugins/railscart/script/process/inspector +3 -0
- data/starter-app/vendor/plugins/railscart/script/process/reaper +3 -0
- data/starter-app/vendor/plugins/railscart/script/process/spawner +3 -0
- data/starter-app/vendor/plugins/railscart/script/runner +3 -0
- data/starter-app/vendor/plugins/railscart/script/server +3 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/addresses.yml +29 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/categories.yml +40 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/line_items.yml +32 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/orders.yml +17 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/products.yml +63 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/products_tags.yml +10 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/roles.yml +6 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/roles_users.yml +3 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/skus.yml +5 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/tags.yml +7 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/tax_treatments.yml +7 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/txns.yml +13 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/users.yml +40 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/variations.yml +16 -0
- data/starter-app/vendor/plugins/railscart/test/functional/account_controller_test.rb +129 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/base_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/option_groups_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/option_values_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/orders_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/overview_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/products_controller_test.rb +125 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/users_controller_test.rb +58 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/variations_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/application_controller_test.rb +30 -0
- data/starter-app/vendor/plugins/railscart/test/functional/cart_controller_test.rb +76 -0
- data/starter-app/vendor/plugins/railscart/test/functional/checkout_controller_test.rb +20 -0
- data/starter-app/vendor/plugins/railscart/test/integration/authentication_test.rb +53 -0
- data/starter-app/vendor/plugins/railscart/test/integration/product_admin_test.rb +135 -0
- data/starter-app/vendor/plugins/railscart/test/integration/user_stories_test.rb +59 -0
- data/starter-app/vendor/plugins/railscart/test/integration/variations_test.rb +24 -0
- data/starter-app/vendor/plugins/railscart/test/test_helper.rb +45 -0
- data/starter-app/vendor/plugins/railscart/test/unit/address_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/cart_item_test.rb +55 -0
- data/starter-app/vendor/plugins/railscart/test/unit/cart_test.rb +35 -0
- data/starter-app/vendor/plugins/railscart/test/unit/category_test.rb +52 -0
- data/starter-app/vendor/plugins/railscart/test/unit/line_item_test.rb +61 -0
- data/starter-app/vendor/plugins/railscart/test/unit/option_group_test.rb +12 -0
- data/starter-app/vendor/plugins/railscart/test/unit/order_test.rb +49 -0
- data/starter-app/vendor/plugins/railscart/test/unit/product_test.rb +107 -0
- data/starter-app/vendor/plugins/railscart/test/unit/role_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/sales_tax_test.rb +46 -0
- data/starter-app/vendor/plugins/railscart/test/unit/sku_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/tag_test.rb +9 -0
- data/starter-app/vendor/plugins/railscart/test/unit/tax_treatment_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/txn_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/variation_test.rb +9 -0
- data/starter-app/vendor/plugins/railscart/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
- data/website/index.html +93 -0
- data/website/index.txt +39 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.rhtml +48 -0
- metadata +557 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
|
2
|
+
|
3
|
+
unless defined?(RAILS_ROOT)
|
4
|
+
root_path = File.join(File.dirname(__FILE__), '..')
|
5
|
+
|
6
|
+
unless RUBY_PLATFORM =~ /mswin32/
|
7
|
+
require 'pathname'
|
8
|
+
root_path = Pathname.new(root_path).cleanpath(true).to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
RAILS_ROOT = root_path
|
12
|
+
end
|
13
|
+
|
14
|
+
unless defined?(Rails::Initializer)
|
15
|
+
if File.directory?("#{RAILS_ROOT}/vendor/rails")
|
16
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
17
|
+
else
|
18
|
+
require 'rubygems'
|
19
|
+
|
20
|
+
environment_without_comments = IO.readlines(File.dirname(__FILE__) + '/environment.rb').reject { |l| l =~ /^#/ }.join
|
21
|
+
environment_without_comments =~ /[^#]RAILS_GEM_VERSION = '([\d.]+)'/
|
22
|
+
rails_gem_version = $1
|
23
|
+
|
24
|
+
if version = defined?(RAILS_GEM_VERSION) ? RAILS_GEM_VERSION : rails_gem_version
|
25
|
+
rails_gem = Gem.cache.search('rails', "=#{version}").first
|
26
|
+
|
27
|
+
if rails_gem
|
28
|
+
gem "rails", "=#{version}"
|
29
|
+
require rails_gem.full_gem_path + '/lib/initializer'
|
30
|
+
else
|
31
|
+
STDERR.puts %(Cannot find gem for Rails =#{version}:
|
32
|
+
Install the missing gem with 'gem install -v=#{version} rails', or
|
33
|
+
change environment.rb to define RAILS_GEM_VERSION with your desired version.
|
34
|
+
)
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
else
|
38
|
+
gem "rails"
|
39
|
+
require 'initializer'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Rails::Initializer.run(:set_load_path)
|
44
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Be sure to restart your web server when you modify this file.
|
2
|
+
|
3
|
+
# Uncomment below to force Rails into production mode when
|
4
|
+
# you don't control web/app server and can't set it the proper way
|
5
|
+
# ENV['RAILS_ENV'] ||= 'production'
|
6
|
+
|
7
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
+
RAILS_GEM_VERSION = '1.2.3'
|
9
|
+
|
10
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
12
|
+
|
13
|
+
Rails::Initializer.run do |config|
|
14
|
+
# Settings in config/environments/* take precedence those specified here
|
15
|
+
|
16
|
+
# Skip frameworks you're not going to use (only works if using vendor/rails)
|
17
|
+
# config.frameworks -= [ :action_web_service, :action_mailer ]
|
18
|
+
|
19
|
+
# Add additional load paths for your own custom dirs
|
20
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
21
|
+
|
22
|
+
# Force all environments to use the same logger level
|
23
|
+
# (by default production uses :info, the others :debug)
|
24
|
+
# config.log_level = :debug
|
25
|
+
|
26
|
+
# Use the database for sessions instead of the file system
|
27
|
+
# (create the session table with 'rake db:sessions:create')
|
28
|
+
# config.action_controller.session_store = :active_record_store
|
29
|
+
|
30
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
31
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
32
|
+
# like if you have constraints or database-specific column types
|
33
|
+
# config.active_record.schema_format = :sql
|
34
|
+
|
35
|
+
# Activate observers that should always be running
|
36
|
+
# config.active_record.observers = :cacher, :garbage_collector
|
37
|
+
|
38
|
+
# Make Active Record use UTC-base instead of local time
|
39
|
+
# config.active_record.default_timezone = :utc
|
40
|
+
|
41
|
+
# See Rails::Configuration for more options
|
42
|
+
end
|
43
|
+
|
44
|
+
# Add new inflection rules using the following format
|
45
|
+
# (all these examples are active by default):
|
46
|
+
# Inflector.inflections do |inflect|
|
47
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
48
|
+
# inflect.singular /^(ox)en/i, '\1'
|
49
|
+
# inflect.irregular 'person', 'people'
|
50
|
+
# inflect.uncountable %w( fish sheep )
|
51
|
+
# end
|
52
|
+
|
53
|
+
# Include your application configuration below
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Tell ActionMailer not to deliver emails to the real world.
|
17
|
+
# The :test delivery method accumulates sent emails in the
|
18
|
+
# ActionMailer::Base.deliveries array.
|
19
|
+
config.action_mailer.delivery_method = :test
|
@@ -0,0 +1,22 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
+
|
4
|
+
# Sample of regular route:
|
5
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
6
|
+
# Keep in mind you can assign values other than :controller and :action
|
7
|
+
|
8
|
+
# Sample of named route:
|
9
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
10
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
11
|
+
|
12
|
+
# You can have the root of your site routed by hooking up ''
|
13
|
+
# -- just remember to delete public/index.html.
|
14
|
+
# map.connect '', :controller => "welcome"
|
15
|
+
|
16
|
+
# Allow downloading Web Service WSDL as a file with an extension
|
17
|
+
# instead of a file named 'wsdl'
|
18
|
+
map.connect ':controller/service.wsdl', :action => 'wsdl'
|
19
|
+
|
20
|
+
# Install the default route as the lowest priority.
|
21
|
+
map.connect ':controller/:action/:id'
|
22
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
2
|
+
create_table :authors, :force => true do |t|
|
3
|
+
t.column :name, :string
|
4
|
+
end
|
5
|
+
|
6
|
+
create_table :edits, :force => true do |t|
|
7
|
+
t.column :author_id, :integer
|
8
|
+
t.column :article_id, :integer
|
9
|
+
t.column :text, :string
|
10
|
+
end
|
11
|
+
|
12
|
+
create_table :articles, :force => true do |t|
|
13
|
+
t.column :author_id, :integer
|
14
|
+
t.column :name, :string
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
testing:
|
2
|
+
id: 1
|
3
|
+
name: Testing Rails Applications
|
4
|
+
author_id: 1
|
5
|
+
|
6
|
+
deploying:
|
7
|
+
id: 2
|
8
|
+
name: Deploying Rails Applications
|
9
|
+
author_id: 2
|
10
|
+
|
11
|
+
donkies:
|
12
|
+
id: 3
|
13
|
+
name: What about the donkies?
|
14
|
+
author_id: 2
|
15
|
+
|
16
|
+
whales:
|
17
|
+
id: 4
|
18
|
+
name: Won't somebody think of the whales?
|
19
|
+
author_id: 2
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Author < ActiveRecord::Base
|
2
|
+
has_many :edits
|
3
|
+
end
|
4
|
+
|
5
|
+
class Edit < ActiveRecord::Base
|
6
|
+
belongs_to :author
|
7
|
+
belongs_to :article
|
8
|
+
end
|
9
|
+
|
10
|
+
class Article < ActiveRecord::Base
|
11
|
+
has_many :edits
|
12
|
+
has_many :editors, :through => :edits, :source => :author
|
13
|
+
belongs_to :author
|
14
|
+
|
15
|
+
def self.find_with_scope(options={}, &block)
|
16
|
+
with_scope(:find => options, &block)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
+
require 'test_help'
|
4
|
+
|
5
|
+
class Test::Unit::TestCase
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
10
|
+
#
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
+
#
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
+
# is recommended.
|
18
|
+
self.use_transactional_fixtures = true
|
19
|
+
|
20
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
21
|
+
# would need people(:david). If you don't want to migrate your existing
|
22
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
23
|
+
# instantiated fixtures translates to a database query per test method),
|
24
|
+
# then set this back to true.
|
25
|
+
self.use_instantiated_fixtures = false
|
26
|
+
|
27
|
+
# Add more helper methods to be used by all tests here...
|
28
|
+
|
29
|
+
def setup
|
30
|
+
RAILS_DEFAULT_LOGGER.debug "\n\e[0;31mRUNNING TEST CASE: #{name}\e[m\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
|
2
|
+
$:.unshift(File.dirname(__FILE__) + '/../../../lib')
|
3
|
+
require 'paginating_find'
|
4
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
5
|
+
require File.join(File.dirname(__FILE__), '/../fixtures/models')
|
6
|
+
load(File.dirname(__FILE__) + "/../../db/schema.rb")
|
7
|
+
load(File.dirname(__FILE__) + "/../../../init.rb")
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/abstract_test.rb'
|
2
|
+
|
3
|
+
class GroupTest < Test::Unit::TestCase
|
4
|
+
def test_should_paginate_with_group
|
5
|
+
one = Article.create(:name => "one", :author_id => 1)
|
6
|
+
two = Article.create(:name => "two", :author_id => 1)
|
7
|
+
three = Article.create(:name => "three", :author_id => 1)
|
8
|
+
four = Article.create(:name => "four", :author_id => 2)
|
9
|
+
results = Article.find(:all, :group => "author_id", :page => {:size => 2})
|
10
|
+
assert_equal 2, results.size
|
11
|
+
assert results.to_a.include?(one)
|
12
|
+
assert !results.to_a.include?(two)
|
13
|
+
assert !results.to_a.include?(three)
|
14
|
+
assert results.to_a.include?(four)
|
15
|
+
assert_equal 1, results.page_count
|
16
|
+
assert_equal 2, results.page_size
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_should_paginate_with_group_and_order
|
20
|
+
one = Article.create(:name => "one", :author_id => 1)
|
21
|
+
two = Article.create(:name => "two", :author_id => 1)
|
22
|
+
three = Article.create(:name => "three", :author_id => 1)
|
23
|
+
four = Article.create(:name => "four", :author_id => 2)
|
24
|
+
results = Article.find(:all, :group => "author_id", :order => "name DESC", :page => {:size => 2})
|
25
|
+
assert_equal 2, results.size
|
26
|
+
assert_equal 1, results.page_count
|
27
|
+
assert_equal 2, results.page_size
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_should_work_with_having_tacked_onto_group
|
31
|
+
one = Article.create(:name => "one", :author_id => 1)
|
32
|
+
two = Article.create(:name => "two", :author_id => 1)
|
33
|
+
three = Article.create(:name => "three", :author_id => 1)
|
34
|
+
four = Article.create(:name => "four", :author_id => 2)
|
35
|
+
results = Article.find(:all, :group => "author_id HAVING author_id=1", :order => "name DESC", :page => {:size => 2})
|
36
|
+
assert_equal 1, results.size
|
37
|
+
assert_equal 1, results.page_count
|
38
|
+
assert_equal 2, results.page_size
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/abstract_test.rb'
|
2
|
+
|
3
|
+
class PaginatingFindTest < Test::Unit::TestCase
|
4
|
+
fixtures :authors, :edits, :articles
|
5
|
+
|
6
|
+
def test_should_not_bonk_on_marshal_dump
|
7
|
+
results = Article.find(:all, :page => {:size => 2})
|
8
|
+
Marshal.dump(results)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_should_preserve_enumerator_stats_on_marshal_load
|
12
|
+
results = Article.find(:all, :page => {:size => 2})
|
13
|
+
loaded = Marshal.load(Marshal.dump(results))
|
14
|
+
assert_equal 2, loaded.page_size
|
15
|
+
assert_equal Article.count, loaded.size
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_should_auto_paginate
|
19
|
+
h = ArticleHelper.new(112)
|
20
|
+
h.find_articles(:all, :page => {:size => 10, :auto => true}) do |results|
|
21
|
+
results.each {} # enumerate all 112 results
|
22
|
+
assert_equal results.page_count, results.stop_page
|
23
|
+
assert_equal results.page_count, results.page
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_should_paginate
|
28
|
+
h = ArticleHelper.new(112)
|
29
|
+
h.find_articles(:all, :page => {:size => 10}) do |results|
|
30
|
+
results.each {} # enumerate first 10 results
|
31
|
+
results.next_page! # move to next page
|
32
|
+
results.page = 2
|
33
|
+
results.each {} # enumerate next 10 results
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_should_not_paginate
|
38
|
+
results = Article.find(:all)
|
39
|
+
assert !results.respond_to?(:page_count)
|
40
|
+
assert !results.respond_to?(:page_size)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_should_paginate_with_conditions
|
44
|
+
h = ArticleHelper.new(20)
|
45
|
+
h.find_articles(:all, :conditions => "name = 1", :order => "name ASC", :page => {:size => 10}) do |results|
|
46
|
+
assert_equal 10, results.page_size
|
47
|
+
assert_equal 1, results.size
|
48
|
+
results.each {}
|
49
|
+
assert_equal 1, results.page
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_should_respect_limit
|
54
|
+
h = ArticleHelper.new(80, 52)
|
55
|
+
h.find_articles(:all, :limit => 52, :page => {:size => 10}) do |results|
|
56
|
+
assert_equal 52, results.size
|
57
|
+
assert_equal 10, results.page_size
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_should_not_query_for_count
|
62
|
+
h = ArticleHelper.new(80, 50)
|
63
|
+
h.find_articles(:all, :page => {:size => 10, :count => 50}) do |results|
|
64
|
+
assert_equal 50, results.size
|
65
|
+
assert_equal 10, results.page_size
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_should_use_limit_instead_of_count
|
70
|
+
h = ArticleHelper.new(80, 41)
|
71
|
+
h.find_articles(:all, :limit => 41, :page => {:size => 10, :count => 50}) do |results|
|
72
|
+
assert_equal 41, results.size
|
73
|
+
assert_equal 10, results.page_size
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_should_use_count_instead_of_limit
|
78
|
+
h = ArticleHelper.new(80, 41)
|
79
|
+
h.find_articles(:all, :limit => 50, :page => {:size => 10, :count => 41}) do |results|
|
80
|
+
assert_equal 41, results.size
|
81
|
+
assert_equal 10, results.page_size
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_should_respect_include
|
86
|
+
results = Article.find(:all,
|
87
|
+
:conditions => ["authors.id = ?", authors(:alex).id],
|
88
|
+
:include => [:author],
|
89
|
+
:page => {:size => 10})
|
90
|
+
assert_equal 1, results.size
|
91
|
+
assert_equal 10, results.page_size
|
92
|
+
assert_equal authors(:alex), results.to_a.first.author
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_should_correctly_count_through_associations
|
96
|
+
editors = articles(:testing).editors.find(:all,
|
97
|
+
:page => {:size => 20,
|
98
|
+
:first => 1,
|
99
|
+
:current => 1 })
|
100
|
+
assert_equal 20, editors.page_size
|
101
|
+
assert_equal articles(:testing).editors.count, editors.size
|
102
|
+
assert_equal articles(:testing).editors.count, editors.to_a.size
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_should_respect_scope
|
106
|
+
Article.find_with_scope({ :conditions => "name = 1" }) do
|
107
|
+
h = ArticleHelper.new(20)
|
108
|
+
h.find_articles(:all, :page => {:size => 10}) do |results|
|
109
|
+
assert_equal 1, results.size
|
110
|
+
assert_equal 1, results.to_a.size
|
111
|
+
assert_equal 10, results.page_size
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_should_respect_scope_with_include
|
117
|
+
h = ArticleHelper.new(20)
|
118
|
+
Article.find_with_scope({:conditions => "articles.name >= 1 and articles.name <= 3" }) do
|
119
|
+
h.find_articles(:all, :include => [:author, :edits], :page => {:size => 10, :current => 1, :first => 1}, :order => "articles.name ASC") do |results|
|
120
|
+
assert_equal 3, results.size
|
121
|
+
assert_equal 3, results.to_a.size
|
122
|
+
assert_equal 10, results.page_size
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_should_respect_nested_scope
|
128
|
+
h = ArticleHelper.new(20)
|
129
|
+
Article.find_with_scope({ :conditions => "name = 1" }) do
|
130
|
+
Article.find_with_scope({ :conditions => "name = 2" }) do
|
131
|
+
h.find_articles(:all, :page => {:size => 10}) do |results|
|
132
|
+
assert_equal 0, results.size
|
133
|
+
assert_equal 0, results.to_a.size
|
134
|
+
assert_equal 10, results.page_size
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
# =)
|
141
|
+
def test_should_respect_out_of_scope_scope
|
142
|
+
results = nil
|
143
|
+
(1..20).each { |n| Article.create(:name => n, :author_id => 1) }
|
144
|
+
Article.find_with_scope({ :conditions => "name >= 1 and name <= 15" }) do
|
145
|
+
results = Article.find(:all, :page => {:size => 10, :auto => true})
|
146
|
+
end
|
147
|
+
assert_equal 10, results.page_size
|
148
|
+
assert_equal 15, results.size
|
149
|
+
assert_equal 15, results.to_a.size
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_should_respect_out_of_scope_scope_with_include
|
153
|
+
results = nil
|
154
|
+
(1..20).each { |n| Article.create(:name => n, :author_id => 1) }
|
155
|
+
Article.find_with_scope({ :conditions => "articles.name >= 1 and articles.name <= 15 and authors.id = 1", :include => [:author, :edits]}) do
|
156
|
+
results = Article.find(:all, :page => {:size => 10, :auto => true})
|
157
|
+
end
|
158
|
+
assert_equal 10, results.page_size
|
159
|
+
assert_equal 15, results.size
|
160
|
+
assert_equal 15, results.to_a.size
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
class ArticleHelper
|
166
|
+
def initialize(how_many, limit=nil)
|
167
|
+
@how_many = how_many
|
168
|
+
@limit=limit
|
169
|
+
end
|
170
|
+
|
171
|
+
# Create n number of articles, and query them using the specified
|
172
|
+
# arguments. Check that the correct number of pages were returned
|
173
|
+
# and yield the results.
|
174
|
+
#
|
175
|
+
def find_articles(*args)
|
176
|
+
(1..@how_many).each { |n| Article.create(:name => n, :author_id => 1) }
|
177
|
+
results = Article.find(*args)
|
178
|
+
if results.size > results.page_size
|
179
|
+
page_count, num_on_last_page = how_many.divmod(results.page_size)
|
180
|
+
page_count = page_count + 1 if num_on_last_page > 0
|
181
|
+
else
|
182
|
+
page_count = 1
|
183
|
+
end
|
184
|
+
if (page_count != results.page_count)
|
185
|
+
raise "Expected #{page_count} pages but there were #{results.page_count}"
|
186
|
+
end
|
187
|
+
yield results if block_given?
|
188
|
+
results
|
189
|
+
end
|
190
|
+
|
191
|
+
def how_many
|
192
|
+
@limit ? @limit : @how_many
|
193
|
+
end
|
194
|
+
end
|