nimbleshop_core 0.0.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +13 -0
- data/Rakefile +15 -0
- data/app/assets/images/engines/nimbleshop_authorizedotnet/american_express.png +0 -0
- data/app/assets/images/engines/nimbleshop_authorizedotnet/authorize_net_big.png +0 -0
- data/app/assets/images/engines/nimbleshop_authorizedotnet/authorizedotnet_big.png +0 -0
- data/app/assets/images/engines/nimbleshop_authorizedotnet/discover.png +0 -0
- data/app/assets/images/engines/nimbleshop_authorizedotnet/mastercard.png +0 -0
- data/app/assets/images/engines/nimbleshop_authorizedotnet/visa.png +0 -0
- data/app/assets/images/engines/nimbleshop_cod/cod_small.png +0 -0
- data/app/assets/images/engines/nimbleshop_paypalwp/paypal_big.png +0 -0
- data/app/assets/images/engines/nimbleshop_paypalwp/paypal_small.png +0 -0
- data/app/assets/images/engines/nimbleshop_splitable/splitable.png +0 -0
- data/app/assets/images/engines/nimbleshop_splitable/splitable_big.png +0 -0
- data/app/assets/images/engines/nimbleshop_splitable/splitable_small.png +0 -0
- data/app/assets/javascripts/admin/products/edit.js.coffee +19 -0
- data/app/assets/javascripts/admin/shipping_methods/edit.js.coffee +6 -0
- data/app/assets/javascripts/admin.js +25 -0
- data/app/assets/javascripts/fadeout_success.js.coffee +2 -0
- data/app/assets/javascripts/payment_method.js.coffee +19 -0
- data/app/assets/javascripts/product-group-condition.js.coffee +33 -0
- data/app/assets/javascripts/remove_deletion_of_product_pictures.js.coffee +5 -0
- data/app/assets/javascripts/shipit.js.coffee +10 -0
- data/app/assets/javascripts/twitter_bootstrap.js.coffee +4 -0
- data/app/assets/stylesheets/admin.css +9 -0
- data/app/assets/stylesheets/admin_bootstrap_and_overrides.css.less +38 -0
- data/app/assets/stylesheets/admin_custom.css +104 -0
- data/app/assets/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- data/app/assets/twitter/bootstrap/glyphicons-halflings.png +0 -0
- data/app/controllers/admin/custom_fields_controller.rb +56 -0
- data/app/controllers/admin/link_groups_controller.rb +76 -0
- data/app/controllers/admin/main_controller.rb +9 -0
- data/app/controllers/admin/navigations_controller.rb +49 -0
- data/app/controllers/admin/orders_controller.rb +47 -0
- data/app/controllers/admin/payment_methods_controller.rb +26 -0
- data/app/controllers/admin/product_groups_controller.rb +70 -0
- data/app/controllers/admin/products_controller.rb +71 -0
- data/app/controllers/admin/shipments_controller.rb +19 -0
- data/app/controllers/admin/shipping_methods_controller.rb +93 -0
- data/app/controllers/admin/shipping_zones_controller.rb +62 -0
- data/app/controllers/admin/shops_controller.rb +33 -0
- data/app/controllers/admin_controller.rb +38 -0
- data/app/helpers/admin_helper.rb +83 -0
- data/app/helpers/nimbleshop_helper.rb +43 -0
- data/app/helpers/payment_method_helper.rb +52 -0
- data/app/mailers/admin_mailer.rb +22 -0
- data/app/mailers/mailer.rb +31 -0
- data/app/models/address.rb +69 -0
- data/app/models/country_shipping_zone.rb +36 -0
- data/app/models/creditcard.rb +95 -0
- data/app/models/custom_field.rb +8 -0
- data/app/models/custom_field_answer/field.rb +101 -0
- data/app/models/custom_field_answer.rb +17 -0
- data/app/models/line_item.rb +48 -0
- data/app/models/link.rb +3 -0
- data/app/models/link_group.rb +8 -0
- data/app/models/navigation.rb +7 -0
- data/app/models/order.rb +158 -0
- data/app/models/payment_method.rb +20 -0
- data/app/models/payment_transaction.rb +11 -0
- data/app/models/picture.rb +30 -0
- data/app/models/product.rb +76 -0
- data/app/models/product_group.rb +65 -0
- data/app/models/product_group_condition.rb +8 -0
- data/app/models/regional_shipping_zone.rb +25 -0
- data/app/models/shipment.rb +19 -0
- data/app/models/shipment_carrier.rb +3 -0
- data/app/models/shipping_cost_calculator.rb +9 -0
- data/app/models/shipping_method.rb +103 -0
- data/app/models/shipping_zone.rb +9 -0
- data/app/models/shop.rb +26 -0
- data/app/models/tax_calculator.rb +18 -0
- data/app/observers/order_observer.rb +53 -0
- data/app/uploaders/picture_uploader.rb +65 -0
- data/app/views/admin/custom_fields/_form.html.erb +45 -0
- data/app/views/admin/custom_fields/edit.html.erb +7 -0
- data/app/views/admin/custom_fields/index.html.erb +31 -0
- data/app/views/admin/custom_fields/new.html.erb +7 -0
- data/app/views/admin/link_groups/_form.html.erb +31 -0
- data/app/views/admin/link_groups/_link_group.html.erb +50 -0
- data/app/views/admin/link_groups/_link_group_title.html.erb +5 -0
- data/app/views/admin/link_groups/edit.html.erb +8 -0
- data/app/views/admin/link_groups/index.html.erb +29 -0
- data/app/views/admin/link_groups/new.html.erb +9 -0
- data/app/views/admin/mailer/new_order_notification.text.erb +31 -0
- data/app/views/admin/main/index.html.erb +5 -0
- data/app/views/admin/navigations/new.html.erb +29 -0
- data/app/views/admin/orders/_line_item.html.erb +11 -0
- data/app/views/admin/orders/_line_items.html.erb +39 -0
- data/app/views/admin/orders/_payment_info.html.erb +20 -0
- data/app/views/admin/orders/_shipping_info.html.erb +40 -0
- data/app/views/admin/orders/index.html.erb +33 -0
- data/app/views/admin/orders/show.html.erb +40 -0
- data/app/views/admin/payment_methods/index.html.erb +6 -0
- data/app/views/admin/product_groups/_condition.html.mustache +20 -0
- data/app/views/admin/product_groups/_form.html.erb +72 -0
- data/app/views/admin/product_groups/edit.html.erb +7 -0
- data/app/views/admin/product_groups/index.html.erb +30 -0
- data/app/views/admin/product_groups/new.html.erb +7 -0
- data/app/views/admin/product_groups/show.html.erb +9 -0
- data/app/views/admin/products/_custom_field_answer.html.erb +9 -0
- data/app/views/admin/products/_form.html.erb +69 -0
- data/app/views/admin/products/_handle_pictures.html.erb +32 -0
- data/app/views/admin/products/_pictures.html.erb +33 -0
- data/app/views/admin/products/edit.html.erb +26 -0
- data/app/views/admin/products/index.html.erb +34 -0
- data/app/views/admin/products/new.html.erb +9 -0
- data/app/views/admin/shipping_methods/_form.html.erb +58 -0
- data/app/views/admin/shipping_methods/_shipping_method.html.erb +31 -0
- data/app/views/admin/shipping_methods/edit.html.erb +18 -0
- data/app/views/admin/shipping_methods/new.html.erb +7 -0
- data/app/views/admin/shipping_zones/_form.html.erb +31 -0
- data/app/views/admin/shipping_zones/_shipping_method.html.erb +13 -0
- data/app/views/admin/shipping_zones/_shipping_zone.html.erb +47 -0
- data/app/views/admin/shipping_zones/edit.html.erb +8 -0
- data/app/views/admin/shipping_zones/index.html.erb +16 -0
- data/app/views/admin/shipping_zones/new.html.erb +8 -0
- data/app/views/admin/shops/edit.html.erb +119 -0
- data/app/views/layouts/_admin_footer.html.erb +23 -0
- data/app/views/layouts/_admin_sidebar.html.erb +0 -0
- data/app/views/layouts/_container.html.erb +33 -0
- data/app/views/layouts/_top_nav_bar.html.erb +30 -0
- data/app/views/layouts/admin.html.erb +35 -0
- data/app/views/layouts/payment_method.html.erb +12 -0
- data/app/views/mailer/order_notification_to_buyer.text.erb +31 -0
- data/app/views/mailer/shipment_notification_to_buyer.text.erb +34 -0
- data/config/initializers/001_settings_application.rb +10 -0
- data/config/initializers/002_load_core_extensions.rb +8 -0
- data/config/initializers/field_with_error.rb +2 -0
- data/config/initializers/strip_and_nullify.rb +13 -0
- data/config/initializers/time_formats.rb +1 -0
- data/config/locales/en.yml +61 -0
- data/config/routes.rb +56 -0
- data/db/development.sqlite3 +0 -0
- data/db/migrate/20111022144421_create_product_groups.rb +12 -0
- data/db/migrate/20111022144426_create_products.rb +16 -0
- data/db/migrate/20111022144653_create_orders.rb +21 -0
- data/db/migrate/20111022144725_create_line_items.rb +15 -0
- data/db/migrate/20111022234951_create_shops.rb +20 -0
- data/db/migrate/20111026193227_create_link_groups.rb +12 -0
- data/db/migrate/20111026193435_create_navigations.rb +10 -0
- data/db/migrate/20111031135810_create_links.rb +10 -0
- data/db/migrate/20111106193938_create_custom_fields.rb +10 -0
- data/db/migrate/20111106195112_create_custom_field_answers.rb +14 -0
- data/db/migrate/20111106201548_create_product_group_conditions.rb +12 -0
- data/db/migrate/20111107035350_create_creditcard_transactions.rb +15 -0
- data/db/migrate/20111109190754_create_addresses.rb +24 -0
- data/db/migrate/20111125173344_create_pictures.rb +16 -0
- data/db/migrate/20111201024408_create_shipping_methods.rb +16 -0
- data/db/migrate/20111202143154_create_shipping_zones.rb +17 -0
- data/db/migrate/20111203034020_create_payment_methods.rb +14 -0
- data/db/migrate/20111221190000_create_preferences.rb +14 -0
- data/db/migrate/20120105234047_create_shipments.rb +11 -0
- data/db/migrate/20120105234553_create_shipment_carriers.rb +11 -0
- data/db/migrate/20120606165355_create_delayed_jobs.rb +22 -0
- data/db/production.sqlite3 +0 -0
- data/db/schema.rb +265 -0
- data/db/seeds.rb +1 -0
- data/db/test.sqlite3 +0 -0
- data/lib/assets/javascripts/loading_state_for_buttons.js.coffee +3 -0
- data/lib/assets/javascripts/show_help_on_hover.js.coffee +2 -0
- data/lib/assets/javascripts/utils/autoresize.js.coffee +3 -0
- data/lib/assets/javascripts/utils/focus.js.coffee +3 -0
- data/lib/assets/javascripts/utils/formatNumber.js.coffee +25 -0
- data/lib/assets/javascripts/utils/formatPrice.js.coffee +24 -0
- data/lib/generators/nimbleshop/app/app_generator.rb +84 -0
- data/lib/generators/nimbleshop/app/templates/config/application.yml +61 -0
- data/lib/generators/nimbleshop/app/templates/config/initializers/airbrake.rb +3 -0
- data/lib/generators/nimbleshop/app/templates/config/initializers/cache_images.rb +4 -0
- data/lib/generators/nimbleshop/app/templates/config/initializers/carrierwave.rb +36 -0
- data/lib/generators/nimbleshop/app/templates/config/initializers/delayed_job.rb +15 -0
- data/lib/generators/nimbleshop/app/templates/config/initializers/setup_email.rb +24 -0
- data/lib/nimbleshop/core_ext/activerecord_base.rb +18 -0
- data/lib/nimbleshop/core_ext/filelessio.rb +4 -0
- data/lib/nimbleshop/core_ext/force_ssl.rb +26 -0
- data/lib/nimbleshop/core_ext/mustache_templater_handler.rb +10 -0
- data/lib/nimbleshop/engine.rb +23 -0
- data/lib/nimbleshop/permalink/builder.rb +46 -0
- data/lib/nimbleshop/processor/base.rb +51 -0
- data/lib/nimbleshop/processor.rb +3 -0
- data/lib/nimbleshop/product_group_search/base_field.rb +19 -0
- data/lib/nimbleshop/product_group_search/core_field_strategy.rb +31 -0
- data/lib/nimbleshop/product_group_search/custom_field_strategy.rb +39 -0
- data/lib/nimbleshop/product_group_search/date_field.rb +16 -0
- data/lib/nimbleshop/product_group_search/extension.rb +46 -0
- data/lib/nimbleshop/product_group_search/number_field.rb +17 -0
- data/lib/nimbleshop/product_group_search/text_field.rb +33 -0
- data/lib/nimbleshop/product_group_search.rb +74 -0
- data/lib/nimbleshop/sampledata/data.rb +246 -0
- data/lib/nimbleshop/sampledata/pictures/product1/pic1.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product2/pic1.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product2/pic2.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product3/pic1.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product3/pic2.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product3/pic3.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product3/pic4.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product3/pic5.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product4/pic1.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product4/pic2.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product5/pic1.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product5/pic2.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic1.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic10.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic11.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic12.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic13.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic14.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic15.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic16.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic17.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic2.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic3.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic4.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic5.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic6.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic7.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic8.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product6/pic9.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product7/pic1.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product7/pic2.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product7/pic3.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product8/pic1.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product8/pic2.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product8/pic3.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product8/pic4.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product8/pic5.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product8/pic6.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product8/pic7.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product8/pic8.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product9/pic1.jpg +0 -0
- data/lib/nimbleshop/sampledata/pictures/product9/pic2.jpg +0 -0
- data/lib/nimbleshop/util.rb +60 -0
- data/lib/nimbleshop/version.rb +18 -0
- data/lib/nimbleshop_core.rb +23 -0
- data/lib/tasks/localhost2public.rake +8 -0
- data/lib/tasks/setup.rake +26 -0
- data/test/factories/address_factory.rb +31 -0
- data/test/factories/creditcard_factory.rb +30 -0
- data/test/factories/custom_field_answer_factory.rb +6 -0
- data/test/factories/custom_field_factory.rb +21 -0
- data/test/factories/line_item_factory.rb +7 -0
- data/test/factories/link_factory.rb +6 -0
- data/test/factories/link_group_factory.rb +5 -0
- data/test/factories/navigation_factory.rb +6 -0
- data/test/factories/order_factory.rb +49 -0
- data/test/factories/payment_method_factory.rb +6 -0
- data/test/factories/payment_transaction_factory.rb +42 -0
- data/test/factories/picture_factory.rb +11 -0
- data/test/factories/product_group_condition_factory.rb +40 -0
- data/test/factories/product_group_factory.rb +5 -0
- data/test/factories/products_factory.rb +11 -0
- data/test/factories/shipment_carrier_factory.rb +6 -0
- data/test/factories/shipment_factory.rb +6 -0
- data/test/factories/shipping_method_factory.rb +15 -0
- data/test/factories/shipping_zone_factory.rb +5 -0
- data/test/factories/shop_factory.rb +8 -0
- data/test/fixtures/files/avatar.png +0 -0
- data/test/fixtures/link_groups.yml +13 -0
- data/test/fixtures/payment_methods.yml +39 -0
- data/test/fixtures/shops.yml +15 -0
- data/test/helpers/admin_helper_test.rb +37 -0
- data/test/helpers/nimbleshop_helper_test.rb +17 -0
- data/test/integration/admin/link_groups_acceptance_test.rb +39 -0
- data/test/integration/admin/orders_acceptance_test.rb +63 -0
- data/test/integration/admin/payment_methods_acceptance_test.rb +13 -0
- data/test/integration/admin/product_groups_acceptance_test.rb +89 -0
- data/test/integration/admin/products_acceptance_test.rb +105 -0
- data/test/integration/admin/shipping_methods_acceptance_test.rb +63 -0
- data/test/integration/admin/shipping_zones_acceptance_test.rb +16 -0
- data/test/integration/admin/shops_acceptance_test.rb +44 -0
- data/test/integration/checkout/cart_acceptance_test.rb +113 -0
- data/test/integration/checkout/payment_confirmation_acceptance_test.rb +24 -0
- data/test/integration/checkout/paypal_acceptance_test.rb +34 -0
- data/test/integration/checkout/shipping_address_acceptance_test.rb +91 -0
- data/test/integration/checkout/shipping_method_acceptance_test.rb +51 -0
- data/test/integration/homepage_acceptance_test.rb +24 -0
- data/test/integration/products_acceptance_test.rb +12 -0
- data/test/integration/static_pages_acceptance_test.rb +13 -0
- data/test/mailers/mailer_test.rb +25 -0
- data/test/rails_app/Gemfile +27 -0
- data/test/rails_app/Gemfile.lock +218 -0
- data/test/rails_app/Rakefile +10 -0
- data/test/rails_app/app/controllers/application_controller.rb +6 -0
- data/test/rails_app/app/helpers/application_helper.rb +3 -0
- data/test/rails_app/app/views/layouts/application.html.erb +10 -0
- data/test/rails_app/config/application.rb +25 -0
- data/test/rails_app/config/application.yml +61 -0
- data/test/rails_app/config/boot.rb +5 -0
- data/test/rails_app/config/database.yml +18 -0
- data/test/rails_app/config/environment.rb +5 -0
- data/test/rails_app/config/environments/development.rb +18 -0
- data/test/rails_app/config/environments/production.rb +33 -0
- data/test/rails_app/config/environments/test.rb +33 -0
- data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/test/rails_app/config/initializers/inflections.rb +2 -0
- data/test/rails_app/config/initializers/secret_token.rb +2 -0
- data/test/rails_app/config/routes.rb +10 -0
- data/test/rails_app/config.ru +4 -0
- data/test/rails_app/db/development.sqlite3 +0 -0
- data/test/rails_app/db/migrate/20100401102949_create_tables.rb +74 -0
- data/test/rails_app/db/schema.rb +52 -0
- data/test/rails_app/log/development.log +94 -0
- data/test/rails_app/log/test.log +0 -0
- data/test/rails_app/public/404.html +26 -0
- data/test/rails_app/public/422.html +26 -0
- data/test/rails_app/public/500.html +26 -0
- data/test/rails_app/public/favicon.ico +0 -0
- data/test/rails_app/script/rails +10 -0
- data/test/support/address_test_helper.rb +24 -0
- data/test/support/checkout_test_helper.rb +40 -0
- data/test/support/dbify_sql_helper.rb +12 -0
- data/test/support/images/cookware.jpg +0 -0
- data/test/support/must_be_like.rb +24 -0
- data/test/support/shipping_method_test_helper.rb +5 -0
- data/test/support/wait_for_ajax.rb +4 -0
- data/test/test_helper.rb +65 -0
- data/test/unit/address_test.rb +33 -0
- data/test/unit/country_shipping_zone_test.rb +17 -0
- data/test/unit/creditcard_test.rb +33 -0
- data/test/unit/custom_field_answer/field_test.rb +93 -0
- data/test/unit/order_test.rb +70 -0
- data/test/unit/payment_method/authorizedotnet_test.rb +21 -0
- data/test/unit/payment_method/paypalwp_test.rb +17 -0
- data/test/unit/payment_method/splitable_test.rb +18 -0
- data/test/unit/picture_test.rb +24 -0
- data/test/unit/processor/authorize_net_test.rb +236 -0
- data/test/unit/processor/paypal_test.rb +40 -0
- data/test/unit/processor/splitable_test.rb +123 -0
- data/test/unit/product_group_condition_test.rb +188 -0
- data/test/unit/product_group_test.rb +109 -0
- data/test/unit/product_test.rb +60 -0
- data/test/unit/shipping_cost_calculator_test.rb +19 -0
- data/test/unit/shipping_method_test.rb +197 -0
- data/test/unit/shop_test.rb +11 -0
- data/test/unit/tax_calculator_test.rb +13 -0
- data/test/vcr_cassettes/authorize_net/authorize-failure.yml +38 -0
- data/test/vcr_cassettes/authorize_net/authorize-success.yml +38 -0
- data/test/vcr_cassettes/authorize_net/capture-failure.yml +38 -0
- data/test/vcr_cassettes/authorize_net/capture-success.yml +38 -0
- data/test/vcr_cassettes/authorize_net/purchase-failure.yml +38 -0
- data/test/vcr_cassettes/authorize_net/purchase-success.yml +38 -0
- data/test/vcr_cassettes/authorize_net/refund-failure.yml +38 -0
- data/test/vcr_cassettes/authorize_net/refund-success.yml +38 -0
- data/test/vcr_cassettes/authorize_net/void-authorize.yml +38 -0
- data/test/vcr_cassettes/authorize_net/void-failure.yml +38 -0
- data/test/vcr_cassettes/authorize_net/void-success.yml +38 -0
- data/test/vcr_cassettes/splitable/split-create-failure.yml +48 -0
- data/test/vcr_cassettes/splitable/split-create-success.yml +50 -0
- data/test/vcr_cassettes/splitable/split-draft-create-failure.yml +50 -0
- data/test/vcr_cassettes/splitable/split-draft-create-success.yml +50 -0
- data/vendor/assets/javascripts/accounting.js +406 -0
- data/vendor/assets/javascripts/autoresize.js +275 -0
- data/vendor/assets/javascripts/jquery-1.7.1.js +9267 -0
- data/vendor/assets/javascripts/jquery-form.js +980 -0
- data/vendor/assets/javascripts/jquery-json.js +193 -0
- data/vendor/assets/javascripts/jquery-ui-1.8.16.js +11768 -0
- data/vendor/assets/javascripts/jquery-ujs.js +374 -0
- data/vendor/assets/javascripts/mustache.js +436 -0
- data/vendor/assets/javascripts/nested_form.js +51 -0
- metadata +740 -0
@@ -0,0 +1,94 @@
|
|
1
|
+
Connecting to database specified by database.yml
|
2
|
+
|
3
|
+
|
4
|
+
Started GET "/" for 127.0.0.1 at 2012-07-02 11:04:08 -0400
|
5
|
+
Processing by NimbleshopSimply::ProductsController#index as HTML
|
6
|
+
Completed 500 Internal Server Error in 153ms
|
7
|
+
|
8
|
+
ActiveRecord::StatementInvalid (Could not find table 'link_groups'):
|
9
|
+
activerecord (3.2.6) lib/active_record/connection_adapters/sqlite_adapter.rb:472:in `table_structure'
|
10
|
+
activerecord (3.2.6) lib/active_record/connection_adapters/sqlite_adapter.rb:346:in `columns'
|
11
|
+
activerecord (3.2.6) lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
|
12
|
+
activerecord (3.2.6) lib/active_record/model_schema.rb:228:in `yield'
|
13
|
+
activerecord (3.2.6) lib/active_record/model_schema.rb:228:in `default'
|
14
|
+
activerecord (3.2.6) lib/active_record/model_schema.rb:228:in `columns'
|
15
|
+
activerecord (3.2.6) lib/active_record/model_schema.rb:237:in `columns_hash'
|
16
|
+
activerecord (3.2.6) lib/active_record/locking/optimistic.rb:129:in `locking_enabled?'
|
17
|
+
activerecord (3.2.6) lib/active_record/relation.rb:170:in `exec_queries'
|
18
|
+
activerecord (3.2.6) lib/active_record/relation.rb:160:in `block in to_a'
|
19
|
+
activerecord (3.2.6) lib/active_record/explain.rb:40:in `logging_query_plan'
|
20
|
+
activerecord (3.2.6) lib/active_record/relation.rb:159:in `to_a'
|
21
|
+
activerecord (3.2.6) lib/active_record/relation/finder_methods.rb:159:in `all'
|
22
|
+
activerecord (3.2.6) lib/active_record/querying.rb:5:in `all'
|
23
|
+
/Users/nsingh/dev/nimbleshop_inc/nimbleshop/nimbleshop_simply/app/controllers/nimbleshop_simply/products_controller.rb:15:in `index'
|
24
|
+
actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
|
25
|
+
actionpack (3.2.6) lib/abstract_controller/base.rb:167:in `process_action'
|
26
|
+
actionpack (3.2.6) lib/action_controller/metal/rendering.rb:10:in `process_action'
|
27
|
+
actionpack (3.2.6) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
|
28
|
+
activesupport (3.2.6) lib/active_support/callbacks.rb:425:in `_run__174074954306394748__process_action__1494994247518375506__callbacks'
|
29
|
+
activesupport (3.2.6) lib/active_support/callbacks.rb:405:in `__run_callback'
|
30
|
+
activesupport (3.2.6) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
|
31
|
+
activesupport (3.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
|
32
|
+
actionpack (3.2.6) lib/abstract_controller/callbacks.rb:17:in `process_action'
|
33
|
+
actionpack (3.2.6) lib/action_controller/metal/rescue.rb:29:in `process_action'
|
34
|
+
actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
|
35
|
+
activesupport (3.2.6) lib/active_support/notifications.rb:123:in `block in instrument'
|
36
|
+
activesupport (3.2.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
|
37
|
+
activesupport (3.2.6) lib/active_support/notifications.rb:123:in `instrument'
|
38
|
+
actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
|
39
|
+
actionpack (3.2.6) lib/action_controller/metal/params_wrapper.rb:206:in `process_action'
|
40
|
+
activerecord (3.2.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
|
41
|
+
actionpack (3.2.6) lib/abstract_controller/base.rb:121:in `process'
|
42
|
+
actionpack (3.2.6) lib/abstract_controller/rendering.rb:45:in `process'
|
43
|
+
actionpack (3.2.6) lib/action_controller/metal.rb:203:in `dispatch'
|
44
|
+
actionpack (3.2.6) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
|
45
|
+
actionpack (3.2.6) lib/action_controller/metal.rb:246:in `block in action'
|
46
|
+
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:73:in `call'
|
47
|
+
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
|
48
|
+
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:36:in `call'
|
49
|
+
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
|
50
|
+
journey (1.0.4) lib/journey/router.rb:56:in `each'
|
51
|
+
journey (1.0.4) lib/journey/router.rb:56:in `call'
|
52
|
+
actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:600:in `call'
|
53
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
|
54
|
+
rack (1.4.1) lib/rack/etag.rb:23:in `call'
|
55
|
+
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
|
56
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/head.rb:14:in `call'
|
57
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
|
58
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/flash.rb:242:in `call'
|
59
|
+
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
|
60
|
+
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
|
61
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/cookies.rb:338:in `call'
|
62
|
+
activerecord (3.2.6) lib/active_record/query_cache.rb:64:in `call'
|
63
|
+
activerecord (3.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
|
64
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
|
65
|
+
activesupport (3.2.6) lib/active_support/callbacks.rb:405:in `_run__3216496320059555918__call__3071394449871022641__callbacks'
|
66
|
+
activesupport (3.2.6) lib/active_support/callbacks.rb:405:in `__run_callback'
|
67
|
+
activesupport (3.2.6) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
|
68
|
+
activesupport (3.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
|
69
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
|
70
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/reloader.rb:65:in `call'
|
71
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
|
72
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
|
73
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
|
74
|
+
railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'
|
75
|
+
railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'
|
76
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'
|
77
|
+
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
|
78
|
+
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
|
79
|
+
activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
|
80
|
+
rack (1.4.1) lib/rack/lock.rb:15:in `call'
|
81
|
+
actionpack (3.2.6) lib/action_dispatch/middleware/static.rb:62:in `call'
|
82
|
+
railties (3.2.6) lib/rails/engine.rb:479:in `call'
|
83
|
+
railties (3.2.6) lib/rails/application.rb:220:in `call'
|
84
|
+
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
|
85
|
+
railties (3.2.6) lib/rails/rack/log_tailer.rb:17:in `call'
|
86
|
+
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
|
87
|
+
/Users/nsingh/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
|
88
|
+
/Users/nsingh/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
|
89
|
+
/Users/nsingh/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
|
90
|
+
|
91
|
+
|
92
|
+
Rendered /Users/nsingh/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.erb (3.6ms)
|
93
|
+
Rendered /Users/nsingh/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
|
94
|
+
Rendered /Users/nsingh/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (15.9ms)
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/404.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/422.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>The change you wanted was rejected.</h1>
|
23
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style type="text/css">
|
6
|
+
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
+
div.dialog {
|
8
|
+
width: 25em;
|
9
|
+
padding: 0 4em;
|
10
|
+
margin: 4em auto 0 auto;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-right-color: #999;
|
13
|
+
border-bottom-color: #999;
|
14
|
+
}
|
15
|
+
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body>
|
20
|
+
<!-- This file lives in public/500.html -->
|
21
|
+
<div class="dialog">
|
22
|
+
<h1>We're sorry, but something went wrong.</h1>
|
23
|
+
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
+
</div>
|
25
|
+
</body>
|
26
|
+
</html>
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENV_PATH = File.expand_path('../../config/environment', __FILE__)
|
5
|
+
BOOT_PATH = File.expand_path('../../config/boot', __FILE__)
|
6
|
+
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
7
|
+
ROOT_PATH = File.expand_path('../..', __FILE__)
|
8
|
+
|
9
|
+
require BOOT_PATH
|
10
|
+
require 'rails/commands'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module AddressSpecHelper
|
2
|
+
def complete_address_form(kind_of_address, attrs = {})
|
3
|
+
|
4
|
+
%w(first_name last_name address1 address2 city zipcode).each do | attr |
|
5
|
+
fill_in "order_#{kind_of_address}_address_attributes_#{attr}", with: attrs[attr.to_sym]
|
6
|
+
end
|
7
|
+
|
8
|
+
select 'United States', from: "order_#{kind_of_address}_address_attributes_country_code"
|
9
|
+
select 'Alabama', from: "order_#{kind_of_address}_address_attributes_state_code"
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def fill_good_address
|
14
|
+
address = build(:shipping_address)
|
15
|
+
fill_in 'First name', with: address[:first_name]
|
16
|
+
fill_in 'Last name', with: address[:last_name]
|
17
|
+
fill_in 'Address1', with: address[:address1]
|
18
|
+
fill_in 'Address2', with: 'Highway'
|
19
|
+
fill_in 'City', with: address[:city]
|
20
|
+
select 'United States', from: 'Country'
|
21
|
+
select 'Alabama', from: 'State/Province'
|
22
|
+
fill_in 'Zipcode', with: address[:zipcode]
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module CheckoutTestHelper
|
2
|
+
|
3
|
+
def add_item_to_cart(name)
|
4
|
+
click_link name
|
5
|
+
click_button 'Add to cart'
|
6
|
+
end
|
7
|
+
|
8
|
+
def enter_valid_email_address
|
9
|
+
fill_in 'Your email address', with: 'john@example.com'
|
10
|
+
end
|
11
|
+
|
12
|
+
def enter_valid_shipping_address
|
13
|
+
{first_name: 'Neeaj',
|
14
|
+
last_name: 'Singh',
|
15
|
+
address1: '100 N. Miami Ave',
|
16
|
+
address2: 'Suite #500',
|
17
|
+
city: 'Miami',
|
18
|
+
zipcode: '33333'}.each do |key, value|
|
19
|
+
fill_in "order_shipping_address_attributes_#{key}", with: value
|
20
|
+
end
|
21
|
+
|
22
|
+
select 'United States', from: "order_shipping_address_attributes_country_code"
|
23
|
+
select 'Florida', from: "order_shipping_address_attributes_state_code"
|
24
|
+
end
|
25
|
+
|
26
|
+
def enter_valid_billing_address
|
27
|
+
{first_name: 'Neil',
|
28
|
+
last_name: 'Singh',
|
29
|
+
address1: '100 N. Pines Ave',
|
30
|
+
address2: 'Suite #400',
|
31
|
+
city: 'Pembroke Pines',
|
32
|
+
zipcode: '33332'}.each do |key, value|
|
33
|
+
fill_in "order_billing_address_attributes_#{key}", with: value
|
34
|
+
end
|
35
|
+
|
36
|
+
select 'United States', from: "order_billing_address_attributes_country_code"
|
37
|
+
select 'Florida', from: "order_billing_address_attributes_state_code"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
Binary file
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module M
|
2
|
+
|
3
|
+
def assert_must_be_like a, b
|
4
|
+
assert_equal a.gsub(/\s+/, ' ').strip, b.gsub(/\s+/, ' ').strip
|
5
|
+
end
|
6
|
+
|
7
|
+
def assert_sanitized_equal a, b
|
8
|
+
a1 = a.gsub(/\W/, ' ').gsub(/\s/, '').strip
|
9
|
+
b2 = b.gsub(/\W/, ' ').gsub(/\s/, '').strip
|
10
|
+
assert_equal a1, b2
|
11
|
+
end
|
12
|
+
|
13
|
+
def assert_sorted_equal a, b
|
14
|
+
assert_equal a.sort, b.sort
|
15
|
+
end
|
16
|
+
|
17
|
+
def assert_must_have_same_records a, b
|
18
|
+
assert_sorted_equal a.map(&:id), b.map(&:id)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class ActiveSupport::TestCase
|
23
|
+
include M
|
24
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler.setup(:test)
|
3
|
+
|
4
|
+
ENV["RAILS_ENV"] = "test"
|
5
|
+
require File.expand_path("../../../myshop/config/environment.rb", __FILE__)
|
6
|
+
require 'rails/test_help'
|
7
|
+
require 'capybara/rails'
|
8
|
+
|
9
|
+
require 'factory_girl'
|
10
|
+
Dir["#{File.dirname(__FILE__)}/factories/**"].each { |f| require File.expand_path(f) }
|
11
|
+
|
12
|
+
require 'active_record/fixtures'
|
13
|
+
|
14
|
+
DatabaseCleaner.strategy = :truncation
|
15
|
+
Capybara.default_wait_time = 5
|
16
|
+
|
17
|
+
VCR.configure do | c |
|
18
|
+
c.ignore_hosts '127.0.0.1', 'localhost'
|
19
|
+
c.cassette_library_dir = 'test/vcr_cassettes'
|
20
|
+
c.hook_into :webmock # or :fakeweb
|
21
|
+
end
|
22
|
+
|
23
|
+
class ActiveSupport::TestCase
|
24
|
+
include FactoryGirl::Syntax::Methods
|
25
|
+
self.use_transactional_fixtures = false
|
26
|
+
setup do
|
27
|
+
DatabaseCleaner.start
|
28
|
+
ActiveRecord::Fixtures.create_fixtures("#{File.dirname(__FILE__)}/fixtures", ['shops', 'link_groups', 'payment_methods'])
|
29
|
+
end
|
30
|
+
teardown do
|
31
|
+
DatabaseCleaner.clean
|
32
|
+
end
|
33
|
+
|
34
|
+
def playcasette(casette)
|
35
|
+
VCR.use_cassette(casette) { yield }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class ActionDispatch::IntegrationTest
|
40
|
+
include Capybara::DSL
|
41
|
+
self.use_transactional_fixtures = false
|
42
|
+
setup do
|
43
|
+
DatabaseCleaner.start
|
44
|
+
ActiveRecord::Fixtures.create_fixtures("#{File.dirname(__FILE__)}/fixtures", ['shops', 'link_groups', 'payment_methods'])
|
45
|
+
end
|
46
|
+
|
47
|
+
teardown do
|
48
|
+
DatabaseCleaner.clean
|
49
|
+
Capybara.reset_sessions!
|
50
|
+
Capybara.use_default_driver
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
# Require ruby files in support dir.
|
57
|
+
Dir["#{File.dirname(__FILE__)}/support/**"].each do |f|
|
58
|
+
require File.expand_path(f) unless File.directory? f
|
59
|
+
end
|
60
|
+
|
61
|
+
module RegionalShippingMethodTestHelper
|
62
|
+
def create_regional_shipping_method
|
63
|
+
create(:country_shipping_method, name: 'Ground', base_price: 3.99, minimum_order_amount: 1, maximum_order_amount: 99999).regions[0]
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class AddressTest < ActiveRecord::TestCase
|
4
|
+
|
5
|
+
test "#country_name" do
|
6
|
+
address = create(:address, country_code: 'IN', state_code: 'AP')
|
7
|
+
assert_equal 'India', address.country_name
|
8
|
+
end
|
9
|
+
|
10
|
+
test "#state_name" do
|
11
|
+
address = create(:address, country_code: 'US', state_code: 'MD')
|
12
|
+
assert_equal 'United States', address.country_name
|
13
|
+
assert_equal 'Maryland', address.state_name
|
14
|
+
end
|
15
|
+
|
16
|
+
test "state code is required" do
|
17
|
+
address = build(:address, country_code: 'BR', state_code: nil, state_name: nil)
|
18
|
+
refute address.valid?
|
19
|
+
assert_equal "State code is required", address.errors.full_messages.first
|
20
|
+
end
|
21
|
+
|
22
|
+
test "state code must be valid" do
|
23
|
+
address = build(:address, country_code: 'BR', state_code: 'XX')
|
24
|
+
refute address.valid?
|
25
|
+
assert_equal "State code XX is not a valid state", address.errors.full_messages.first
|
26
|
+
end
|
27
|
+
|
28
|
+
test "#to_credit_card_attributes" do
|
29
|
+
options = Address.new.to_credit_card_attributes
|
30
|
+
assert_equal ["address1", "address2", "first_name", "last_name", "state", "zipcode"], options.keys.sort
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CountryShippingZoneTest < ActiveRecord::TestCase
|
4
|
+
|
5
|
+
test "assigns name from carmen" do
|
6
|
+
assert_equal "United States", create(:country_shipping_zone).name
|
7
|
+
end
|
8
|
+
|
9
|
+
test "should create all regions for canada" do
|
10
|
+
regions = Carmen::Country.coded("CA").subregions.length
|
11
|
+
|
12
|
+
assert_difference 'RegionalShippingZone.count', regions do
|
13
|
+
create(:country_shipping_zone, country_code: 'CA')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class CreditcardTest < ActiveModel::TestCase
|
4
|
+
|
5
|
+
test 'active merchant should not validate an invalid card' do
|
6
|
+
card = Creditcard.new
|
7
|
+
refute card.valid?
|
8
|
+
end
|
9
|
+
|
10
|
+
test 'active merchant should validate a valid card' do
|
11
|
+
card = build(:creditcard)
|
12
|
+
assert card.valid?
|
13
|
+
end
|
14
|
+
|
15
|
+
test 'error message when number is nil' do
|
16
|
+
card = build(:creditcard, number: nil)
|
17
|
+
refute card.valid?
|
18
|
+
assert_equal 'Please enter credit card number', card.errors.full_messages.first
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'error message when number is not numeric' do
|
22
|
+
card = build(:creditcard, number: 'a')
|
23
|
+
refute card.valid?
|
24
|
+
assert_equal 'Please check the credit card number you entered', card.errors.full_messages.first
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'error message when cvv is nil' do
|
28
|
+
card = build(:creditcard, cvv: nil)
|
29
|
+
refute card.valid?
|
30
|
+
assert_equal 'Please enter CVV', card.errors.full_messages.first
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class CustomFieldAnswerFieldNumberTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
setup do
|
6
|
+
@custom_field = CustomField.new(field_type: 'number')
|
7
|
+
end
|
8
|
+
|
9
|
+
test "when custom_field set during build" do
|
10
|
+
answer = CustomFieldAnswer.new(custom_field: @custom_field, value: 234)
|
11
|
+
assert_equal 234, answer.number_value
|
12
|
+
end
|
13
|
+
|
14
|
+
test "when custom_field set after build" do
|
15
|
+
answer = CustomFieldAnswer.new(value: 234)
|
16
|
+
answer.custom_field = @custom_field
|
17
|
+
assert_equal 234, answer.number_value
|
18
|
+
end
|
19
|
+
|
20
|
+
test "when custom_field_id set after build" do
|
21
|
+
answer = CustomFieldAnswer.new(value: 234)
|
22
|
+
answer.custom_field_id = create(:number_custom_field).id
|
23
|
+
assert_equal 234, answer.number_value
|
24
|
+
end
|
25
|
+
|
26
|
+
test "when custom_field_id set during build" do
|
27
|
+
answer = CustomFieldAnswer.new(value: 234, custom_field_id: create(:number_custom_field).id)
|
28
|
+
answer.custom_field_id = create(:number_custom_field)
|
29
|
+
assert_equal 234, answer.number_value
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class CustomFieldAnswerFieldTextTest < ActiveSupport::TestCase
|
35
|
+
|
36
|
+
setup do
|
37
|
+
@custom_field = CustomField.new(field_type: 'text')
|
38
|
+
end
|
39
|
+
|
40
|
+
test "when custom field set during build" do
|
41
|
+
answer = CustomFieldAnswer.new(custom_field: @custom_field, value: 'string')
|
42
|
+
assert_equal 'string', answer.value
|
43
|
+
end
|
44
|
+
|
45
|
+
test "when custom field set after build" do
|
46
|
+
answer = CustomFieldAnswer.new(value: 'string')
|
47
|
+
answer.custom_field = @custom_field
|
48
|
+
assert_equal 'string', answer.value
|
49
|
+
end
|
50
|
+
|
51
|
+
test "when custom_field_id set during build" do
|
52
|
+
answer = CustomFieldAnswer.new(custom_field_id: create(:text_custom_field).id, value: 'string')
|
53
|
+
assert_equal 'string', answer.value
|
54
|
+
end
|
55
|
+
|
56
|
+
test "when custom_field_id set after build" do
|
57
|
+
answer = CustomFieldAnswer.new(value: 'string')
|
58
|
+
answer.custom_field_id = create(:text_custom_field).id
|
59
|
+
assert_equal 'string', answer.value
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
class CustomFieldAnswerFieldDateTest < ActiveSupport::TestCase
|
66
|
+
|
67
|
+
setup do
|
68
|
+
@custom_field = CustomField.new(field_type: 'date')
|
69
|
+
end
|
70
|
+
|
71
|
+
test "when custom field set during build" do
|
72
|
+
answer = CustomFieldAnswer.new(custom_field: @custom_field, value: '2/4/2009')
|
73
|
+
assert_equal '02/04/2009', answer.datetime_value.strftime("%m/%d/%Y")
|
74
|
+
end
|
75
|
+
|
76
|
+
test "when custom field set after build" do
|
77
|
+
answer = CustomFieldAnswer.new(value: '2/4/2009')
|
78
|
+
answer.custom_field = @custom_field
|
79
|
+
assert_equal '02/04/2009', answer.datetime_value.strftime("%m/%d/%Y")
|
80
|
+
end
|
81
|
+
|
82
|
+
test "when custom_field_id set during build" do
|
83
|
+
answer = CustomFieldAnswer.new(custom_field_id: create(:date_custom_field).id, value: '2/4/2009')
|
84
|
+
assert_equal '02/04/2009', answer.datetime_value.strftime("%m/%d/%Y")
|
85
|
+
end
|
86
|
+
|
87
|
+
test "when custom_field_id set after build" do
|
88
|
+
answer = CustomFieldAnswer.new(value: '2/4/2009')
|
89
|
+
answer.custom_field_id = create(:date_custom_field).id
|
90
|
+
assert_equal '02/04/2009', answer.datetime_value.strftime("%m/%d/%Y")
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class OrderAddressTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test "shipping and billing address is nil" do
|
6
|
+
order = Order.new(billing_address: nil, shipping_address: nil)
|
7
|
+
assert_equal nil, order.final_billing_address
|
8
|
+
end
|
9
|
+
|
10
|
+
test "billing address is same as shipping address" do
|
11
|
+
shipping_address = ShippingAddress.new(use_for_billing: true)
|
12
|
+
order = Order.new(shipping_address: shipping_address, billing_address: BillingAddress.new)
|
13
|
+
assert_equal shipping_address, order.final_billing_address
|
14
|
+
end
|
15
|
+
|
16
|
+
test "billing address is different from shipping address" do
|
17
|
+
shipping_address = ShippingAddress.new(use_for_billing: false)
|
18
|
+
billing_address = BillingAddress.new
|
19
|
+
order = Order.new(shipping_address: shipping_address, billing_address: billing_address)
|
20
|
+
assert_equal billing_address, order.final_billing_address
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
class OrderTest < ActiveSupport::TestCase
|
26
|
+
setup do
|
27
|
+
@order = create :order
|
28
|
+
@product1 = create :product, price: 10
|
29
|
+
@product2 = create :product, price: 30
|
30
|
+
end
|
31
|
+
|
32
|
+
test "factory" do
|
33
|
+
order = create :order_paid_using_authorizedotnet
|
34
|
+
assert_equal 1, order.payment_transactions.size
|
35
|
+
end
|
36
|
+
|
37
|
+
test "#add" do
|
38
|
+
@order.add(@product1)
|
39
|
+
assert_equal 1, @order.line_items.size
|
40
|
+
assert_equal 1, @order.line_items.first.quantity
|
41
|
+
end
|
42
|
+
|
43
|
+
test "#remove" do
|
44
|
+
@order.add(@product1)
|
45
|
+
@order.remove(@product1)
|
46
|
+
assert @order.reload.line_items.empty?
|
47
|
+
assert_equal 0.0, @order.reload.line_items_total.to_f
|
48
|
+
end
|
49
|
+
|
50
|
+
test "#update_quantity" do
|
51
|
+
@order.add(@product1)
|
52
|
+
@order.update_quantity({@product1.id => 20})
|
53
|
+
assert_equal 20, @order.line_items.first.quantity
|
54
|
+
end
|
55
|
+
|
56
|
+
test "#update_quantity when order has 2 items" do
|
57
|
+
@order.add(@product1)
|
58
|
+
@order.add(@product2)
|
59
|
+
@order.update_quantity({@product1.id => 3})
|
60
|
+
assert_equal 60.0, @order.line_items_total.to_f
|
61
|
+
end
|
62
|
+
|
63
|
+
test "#available_shipping_methods" do
|
64
|
+
@order.add(create(:product))
|
65
|
+
assert_equal 1, @order.available_shipping_methods.size
|
66
|
+
assert_equal 58, ShippingMethod.count
|
67
|
+
@order.shipping_address = create(:shipping_address)
|
68
|
+
assert_equal 1, @order.available_shipping_methods.size
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class PaymentMethodAuthorizeNetTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test "validations" do
|
6
|
+
pm = NimbleshopAuthorizedotnet::Authorizedotnet.new(name: 'Authorize.net', description: 'this is description')
|
7
|
+
refute pm.valid?
|
8
|
+
expected = ["Company name on creditcard statement can't be blank", "Login can't be blank", "Transaction key can't be blank"]
|
9
|
+
assert_equal expected, pm.errors.full_messages.sort
|
10
|
+
end
|
11
|
+
|
12
|
+
test "should save the record" do
|
13
|
+
pm = NimbleshopAuthorizedotnet::Authorizedotnet.new(name: 'Authorize.net', description: 'this is description')
|
14
|
+
pm.login_id = 'FWERSDEED093d'
|
15
|
+
pm.transaction_key = 'SDFSDFSFSF423433SDFSFSSFSFSF334'
|
16
|
+
pm.company_name_on_creditcard_statement = 'BigBinary LLC'
|
17
|
+
assert pm.save
|
18
|
+
assert_match /authorize-net/, pm.permalink
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|