solidus_starter_frontend 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +57 -0
- data/.erb-lint.yml +22 -0
- data/.eslintrc +5 -0
- data/.gem_release.yml +5 -0
- data/.github/pull_request_template.md +28 -0
- data/.github/stale.yml +17 -0
- data/.gitignore +17 -0
- data/.hound.yml +16 -0
- data/.rspec +2 -0
- data/.rubocop.yml +19 -0
- data/.rubocop_todo.yml +229 -0
- data/.scss-lint.yml +4 -0
- data/Gemfile +34 -0
- data/LICENSE +26 -0
- data/README.md +69 -0
- data/Rakefile +6 -0
- data/app/assets/config/solidus_starter_frontend_manifest.js +2 -0
- data/app/assets/javascripts/spree/frontend.js +6 -0
- data/app/assets/javascripts/spree/frontend/cart.js +26 -0
- data/app/assets/javascripts/spree/frontend/checkout.js +34 -0
- data/app/assets/javascripts/spree/frontend/checkout/address.js +124 -0
- data/app/assets/javascripts/spree/frontend/checkout/payment.js +44 -0
- data/app/assets/javascripts/spree/frontend/locale_selector.js +9 -0
- data/app/assets/javascripts/spree/frontend/product.js +21 -0
- data/app/assets/javascripts/spree/frontend/solidus_starter_frontend.js +9 -0
- data/app/assets/javascripts/spree/frontend/utils.js.erb +18 -0
- data/app/assets/stylesheets/spree/frontend.css +8 -0
- data/app/assets/stylesheets/spree/frontend/base/_base.scss +29 -0
- data/app/assets/stylesheets/spree/frontend/base/_reset.scss +179 -0
- data/app/assets/stylesheets/spree/frontend/base/_responsive.scss +21 -0
- data/app/assets/stylesheets/spree/frontend/components/account/_account_order.scss +23 -0
- data/app/assets/stylesheets/spree/frontend/components/account/_account_summary.scss +17 -0
- data/app/assets/stylesheets/spree/frontend/components/auth/_auth_container.scss +11 -0
- data/app/assets/stylesheets/spree/frontend/components/auth/_auth_form.scss +5 -0
- data/app/assets/stylesheets/spree/frontend/components/brand/_logo.scss +4 -0
- data/app/assets/stylesheets/spree/frontend/components/buttons/_button_inline.scss +8 -0
- data/app/assets/stylesheets/spree/frontend/components/buttons/_button_primary.scss +26 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_adjustments.scss +6 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_amount_row.scss +11 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_empty.scss +10 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_footer.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_header.scss +12 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_item.scss +86 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_link.scss +22 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_page.scss +15 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_secondary_actions.scss +19 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_coupon_code.scss +8 -0
- data/app/assets/stylesheets/spree/frontend/components/cart/_item_info.scss +19 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout_header.scss +19 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout_summary.scss +31 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_existing_cards.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_payment_method_controls.scss +5 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_payment_method_selector.scss +14 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_progress_steps.scss +38 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_proposed_shipment.scss +18 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_shipment_items.scss +50 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/_shipping_methods.scss +9 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/payments/_gateway_payment_method.scss +11 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_address_step.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_confirm_step.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_delivery_step.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_payment_step.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/_address_inputs.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_checkbox_input.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_radio_input.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_select_input.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_text.scss +32 -0
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_textarea_input.scss +25 -0
- data/app/assets/stylesheets/spree/frontend/components/general/_flash.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_aside.scss +4 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_breadcrumbs.scss +16 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_category_navigation.scss +3 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_footer.scss +8 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_header.scss +12 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_horizontal_input_group.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/components/layout/_top_bar.scss +44 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_auth_link.scss +11 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_categories.scss +29 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_locale_selector.scss +21 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_taxonomies.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/components/navigation/_taxonomy.scss +28 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_address_overview.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_coupon_codes.scss +4 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_line_items.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_details.scss +18 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_item.scss +85 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_page.scss +41 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_shipments.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/orders/_payment_info.scss +29 -0
- data/app/assets/stylesheets/spree/frontend/components/presentation/_hero.scss +18 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_card.scss +35 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_image.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_info.scss +14 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_page.scss +31 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_properties.scss +23 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_submit.scss +9 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_taxons.scss +27 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_thumbnails.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_product_variants.scss +20 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_products.scss +13 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_products_by_taxon.scss +6 -0
- data/app/assets/stylesheets/spree/frontend/components/products/_products_grid.scss +18 -0
- data/app/assets/stylesheets/spree/frontend/components/search/_filter.scss +32 -0
- data/app/assets/stylesheets/spree/frontend/components/search/_search_bar.scss +34 -0
- data/app/assets/stylesheets/spree/frontend/components/typography/_hero_title.scss +6 -0
- data/app/assets/stylesheets/spree/frontend/components/typography/_subtitle.scss +7 -0
- data/app/assets/stylesheets/spree/frontend/placeholders/main.scss +5 -0
- data/app/assets/stylesheets/spree/frontend/screen.scss +89 -0
- data/app/assets/stylesheets/spree/frontend/solidus_starter_frontend.css +7 -0
- data/app/assets/stylesheets/spree/frontend/variables/_colors.scss +20 -0
- data/app/controllers/concerns/solidus_starter_frontend/auth_views.rb +16 -0
- data/app/controllers/concerns/solidus_starter_frontend/taxonomies.rb +16 -0
- data/app/controllers/spree/checkout_controller.rb +249 -0
- data/app/controllers/spree/coupon_codes_controller.rb +35 -0
- data/app/controllers/spree/home_controller.rb +13 -0
- data/app/controllers/spree/locale_controller.rb +20 -0
- data/app/controllers/spree/orders_controller.rb +126 -0
- data/app/controllers/spree/products_controller.rb +51 -0
- data/app/controllers/spree/store_controller.rb +31 -0
- data/app/controllers/spree/taxons_controller.rb +30 -0
- data/app/helpers/spree/orders_helper.rb +18 -0
- data/app/helpers/spree/taxon_filters_helper.rb +13 -0
- data/app/views/spree/address/_form_hidden.html.erb +12 -0
- data/app/views/spree/checkout/_terms_and_conditions.en.html.erb +1 -0
- data/app/views/spree/checkout/edit.html.erb +16 -0
- data/app/views/spree/checkout/existing_payment/_gateway.html.erb +9 -0
- data/app/views/spree/checkout/payment/_check.html.erb +0 -0
- data/app/views/spree/checkout/payment/_gateway.html.erb +43 -0
- data/app/views/spree/components/auth/_change_form.html.erb +40 -0
- data/app/views/spree/components/auth/_forgot_form.html.erb +28 -0
- data/app/views/spree/components/auth/_guest_form.html.erb +31 -0
- data/app/views/spree/components/auth/_login_form.html.erb +42 -0
- data/app/views/spree/components/auth/_signup_form.html.erb +48 -0
- data/app/views/spree/components/brand/_logo.html.erb +3 -0
- data/app/views/spree/components/buttons/_button_inline.html.erb +23 -0
- data/app/views/spree/components/buttons/_button_primary.html.erb +29 -0
- data/app/views/spree/components/cart/_cart_adjustment.html.erb +15 -0
- data/app/views/spree/components/cart/_cart_adjustments.html.erb +47 -0
- data/app/views/spree/components/cart/_cart_amount_row.html.erb +12 -0
- data/app/views/spree/components/cart/_cart_empty.html.erb +9 -0
- data/app/views/spree/components/cart/_cart_footer.html.erb +15 -0
- data/app/views/spree/components/cart/_cart_header.html.erb +17 -0
- data/app/views/spree/components/cart/_cart_item.html.erb +52 -0
- data/app/views/spree/components/cart/_cart_items.html.erb +23 -0
- data/app/views/spree/components/cart/_cart_link.html.erb +9 -0
- data/app/views/spree/components/cart/_cart_secondary_actions.html.erb +17 -0
- data/app/views/spree/components/cart/_item_info.html.erb +26 -0
- data/app/views/spree/components/checkout/_checkout_header.html.erb +8 -0
- data/app/views/spree/components/checkout/_checkout_step.html.erb +21 -0
- data/app/views/spree/components/checkout/_checkout_summary.html.erb +70 -0
- data/app/views/spree/components/checkout/_existing_cards.html.erb +39 -0
- data/app/views/spree/components/checkout/_payment_method_controls.html.erb +10 -0
- data/app/views/spree/components/checkout/_payment_method_selector.html.erb +14 -0
- data/app/views/spree/components/checkout/_proposed_shipment.erb +18 -0
- data/app/views/spree/components/checkout/_shipment_items.html.erb +22 -0
- data/app/views/spree/components/checkout/_shipping_methods.html.erb +20 -0
- data/app/views/spree/components/checkout/_unshippable_items.html.erb +7 -0
- data/app/views/spree/components/checkout/steps/_address_step.html.erb +60 -0
- data/app/views/spree/components/checkout/steps/_confirm_step.html.erb +31 -0
- data/app/views/spree/components/checkout/steps/_delivery_step.html.erb +31 -0
- data/app/views/spree/components/checkout/steps/_payment_step.html.erb +25 -0
- data/app/views/spree/components/forms/_address_inputs.html.erb +152 -0
- data/app/views/spree/components/forms/inputs/_checkbox_input.html.erb +29 -0
- data/app/views/spree/components/forms/inputs/_collection_select.html.erb +42 -0
- data/app/views/spree/components/forms/inputs/_radio_input.html.erb +29 -0
- data/app/views/spree/components/forms/inputs/_select_input.html.erb +31 -0
- data/app/views/spree/components/forms/inputs/_text.html.erb +54 -0
- data/app/views/spree/components/forms/inputs/_textarea_input.html.erb +42 -0
- data/app/views/spree/components/layout/_category_navigation.html.erb +3 -0
- data/app/views/spree/components/layout/_footer.html.erb +7 -0
- data/app/views/spree/components/layout/_header.html.erb +8 -0
- data/app/views/spree/components/layout/_top_bar.html.erb +8 -0
- data/app/views/spree/components/navigation/_auth_link.html.erb +1 -0
- data/app/views/spree/components/navigation/_breadcrumbs.html.erb +47 -0
- data/app/views/spree/components/navigation/_categories.html.erb +12 -0
- data/app/views/spree/components/navigation/_locale_selector.html.erb +25 -0
- data/app/views/spree/components/navigation/_taxonomies.html.erb +17 -0
- data/app/views/spree/components/navigation/_taxons.html.erb +17 -0
- data/app/views/spree/components/navigation/_taxons_tree.html.erb +29 -0
- data/app/views/spree/components/orders/_address_overview.html.erb +40 -0
- data/app/views/spree/components/orders/_coupon_code.html.erb +22 -0
- data/app/views/spree/components/orders/_line_items.html.erb +55 -0
- data/app/views/spree/components/orders/_order_details.html.erb +35 -0
- data/app/views/spree/components/orders/_order_item.html.erb +33 -0
- data/app/views/spree/components/orders/_order_items.html.erb +5 -0
- data/app/views/spree/components/orders/_order_shipments.html.erb +25 -0
- data/app/views/spree/components/orders/_payment_info.html.erb +31 -0
- data/app/views/spree/components/presentation/_hero.html.erb +14 -0
- data/app/views/spree/components/products/_product-card.html.erb +36 -0
- data/app/views/spree/components/products/_product_availability.html.erb +19 -0
- data/app/views/spree/components/products/_product_form.html.erb +21 -0
- data/app/views/spree/components/products/_product_image.html.erb +6 -0
- data/app/views/spree/components/products/_product_info.html.erb +9 -0
- data/app/views/spree/components/products/_product_promotions.html.erb +25 -0
- data/app/views/spree/components/products/_product_properties.html.erb +19 -0
- data/app/views/spree/components/products/_product_submit.html.erb +39 -0
- data/app/views/spree/components/products/_product_taxons.html.erb +15 -0
- data/app/views/spree/components/products/_product_thumbnails.html.erb +19 -0
- data/app/views/spree/components/products/_product_variants.html.erb +36 -0
- data/app/views/spree/components/products/_products-grid.html.erb +13 -0
- data/app/views/spree/components/products/_products.html.erb +28 -0
- data/app/views/spree/components/products/_products_by_taxon.html.erb +7 -0
- data/app/views/spree/components/products/_variants_list.html.erb +12 -0
- data/app/views/spree/components/search/_filter.html.erb +42 -0
- data/app/views/spree/components/search/_filters.html.erb +20 -0
- data/app/views/spree/components/search/_form.html.erb +12 -0
- data/app/views/spree/components/search/_products_search.html.erb +36 -0
- data/app/views/spree/components/search/_search_bar.html.erb +36 -0
- data/app/views/spree/components/typography/_hero_title.html.erb +11 -0
- data/app/views/spree/components/typography/_subtitle.html.erb +11 -0
- data/app/views/spree/home/index.html.erb +7 -0
- data/app/views/spree/layouts/spree_application.html.erb +27 -0
- data/app/views/spree/orders/edit.html.erb +21 -0
- data/app/views/spree/orders/show.html.erb +29 -0
- data/app/views/spree/products/index.html.erb +22 -0
- data/app/views/spree/products/show.html.erb +18 -0
- data/app/views/spree/shared/_image.html.erb +12 -0
- data/app/views/spree/shared/_link_to_cart.html.erb +1 -0
- data/app/views/spree/shared/_login_bar_items.html.erb +1 -0
- data/app/views/spree/shared/_shipment_tracking.html.erb +11 -0
- data/app/views/spree/shared/unauthorized.html.erb +0 -0
- data/app/views/spree/taxons/show.html.erb +17 -0
- data/bin/console +17 -0
- data/bin/r +13 -0
- data/bin/rails +7 -0
- data/bin/rake +7 -0
- data/bin/rspec +29 -0
- data/bin/sandbox +84 -0
- data/bin/sandbox_rails +18 -0
- data/bin/setup +8 -0
- data/bin/solidus_compare +155 -0
- data/config/initializers/assets.rb +1 -0
- data/config/initializers/canonical_rails.rb +16 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +33 -0
- data/config/solidus_compare.yml +33 -0
- data/docs/development.md +28 -0
- data/exe/solidus_starter_frontend +9 -0
- data/lib/generators/solidus_starter_frontend/install/install_generator.rb +15 -0
- data/lib/generators/solidus_starter_frontend/solidus_starter_frontend_generator.rb +30 -0
- data/lib/generators/solidus_starter_frontend/views/override_generator.rb +50 -0
- data/lib/solidus_starter_frontend.rb +12 -0
- data/lib/solidus_starter_frontend/config.rb +7 -0
- data/lib/solidus_starter_frontend/engine.rb +34 -0
- data/lib/solidus_starter_frontend/factories.rb +4 -0
- data/lib/solidus_starter_frontend/solidus_support_extensions.rb +9 -0
- data/lib/solidus_starter_frontend/version.rb +5 -0
- data/lib/solidus_starter_frontend_configuration.rb +8 -0
- data/lib/views/auth/spree/checkout/registration.html.erb +7 -0
- data/lib/views/auth/spree/components/navigation/_auth_link.html.erb +5 -0
- data/lib/views/auth/spree/user_passwords/edit.html.erb +7 -0
- data/lib/views/auth/spree/user_passwords/new.html.erb +5 -0
- data/lib/views/auth/spree/user_registrations/new.html.erb +7 -0
- data/lib/views/auth/spree/user_sessions/guest.html.erb +5 -0
- data/lib/views/auth/spree/user_sessions/new.html.erb +7 -0
- data/lib/views/auth/spree/users/edit.html.erb +45 -0
- data/lib/views/auth/spree/users/show.html.erb +55 -0
- data/solidus_starter_frontend.gemspec +43 -0
- data/spec/controllers/controller_helpers_spec.rb +29 -0
- data/spec/controllers/locale_controller_spec.rb +57 -0
- data/spec/controllers/spree/checkout_controller_spec.rb +563 -0
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +37 -0
- data/spec/controllers/spree/current_order_tracking_spec.rb +33 -0
- data/spec/controllers/spree/home_controller_spec.rb +29 -0
- data/spec/controllers/spree/orders_controller_ability_spec.rb +90 -0
- data/spec/controllers/spree/orders_controller_spec.rb +241 -0
- data/spec/controllers/spree/orders_controller_transitions_spec.rb +33 -0
- data/spec/controllers/spree/products_controller_spec.rb +38 -0
- data/spec/controllers/spree/taxons_controller_spec.rb +14 -0
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/generators/solidus/views/override_generator_spec.rb +50 -0
- data/spec/helpers/base_helper_spec.rb +13 -0
- data/spec/helpers/order_helper_spec.rb +14 -0
- data/spec/helpers/taxon_filters_helper_spec.rb +12 -0
- data/spec/spec_helper.rb +64 -0
- data/spec/support/shared_contexts/checkout_setup.rb +12 -0
- data/spec/support/shared_contexts/custom_products.rb +28 -0
- data/spec/support/shared_contexts/locales.rb +16 -0
- data/spec/system/address_spec.rb +87 -0
- data/spec/system/automatic_promotion_adjustments_spec.rb +49 -0
- data/spec/system/caching/products_spec.rb +48 -0
- data/spec/system/caching/taxons_spec.rb +35 -0
- data/spec/system/cart_spec.rb +81 -0
- data/spec/system/checkout_confirm_insufficient_stock_spec.rb +71 -0
- data/spec/system/checkout_spec.rb +699 -0
- data/spec/system/checkout_unshippable_spec.rb +37 -0
- data/spec/system/coupon_code_spec.rb +267 -0
- data/spec/system/currency_spec.rb +20 -0
- data/spec/system/first_order_promotion_spec.rb +59 -0
- data/spec/system/free_shipping_promotions_spec.rb +60 -0
- data/spec/system/locale_spec.rb +26 -0
- data/spec/system/order_spec.rb +57 -0
- data/spec/system/products_spec.rb +302 -0
- data/spec/system/promotion_code_invalidation_spec.rb +54 -0
- data/spec/system/quantity_promotions_spec.rb +130 -0
- data/spec/system/taxons_spec.rb +158 -0
- data/spec/system/template_rendering_spec.rb +20 -0
- data/spec/views/spree/checkout/_summary_spec.rb +11 -0
- metadata +542 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe 'orders', type: :system do
|
6
|
+
let(:order) { Spree::TestingSupport::OrderWalkthrough.up_to(:complete) }
|
7
|
+
let(:user) { create(:user) }
|
8
|
+
|
9
|
+
before do
|
10
|
+
order.update_attribute(:user_id, user.id)
|
11
|
+
allow_any_instance_of(Spree::OrdersController).to receive_messages(try_spree_current_user: user)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "can visit an order" do
|
15
|
+
# Regression test for current_user call on orders/show
|
16
|
+
visit spree.order_path(order)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should display line item price" do
|
20
|
+
# Regression test for https://github.com/spree/spree/issues/2772
|
21
|
+
line_item = order.line_items.first
|
22
|
+
line_item.target_shipment = create(:shipment)
|
23
|
+
line_item.price = 19.00
|
24
|
+
line_item.save!
|
25
|
+
|
26
|
+
visit spree.order_path(order)
|
27
|
+
|
28
|
+
# Tests view spree/shared/_order_details
|
29
|
+
within '.order-item__price-single' do
|
30
|
+
expect(page).to have_content "19.00"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have credit card info if paid with credit card" do
|
35
|
+
create(:payment, order: order)
|
36
|
+
visit spree.order_path(order)
|
37
|
+
within '.payment-info' do
|
38
|
+
expect(page).to have_content "Ending in 1111"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should have payment method name visible if not paid with credit card" do
|
43
|
+
create(:check_payment, order: order)
|
44
|
+
visit spree.order_path(order)
|
45
|
+
within '.payment-info' do
|
46
|
+
expect(page).to have_content "Check"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return the correct title when displaying a completed order" do
|
51
|
+
visit spree.order_path(order)
|
52
|
+
|
53
|
+
within '#order_summary' do
|
54
|
+
expect(page).to have_content("#{I18n.t('spree.order')} #{order.number}")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,302 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe 'Visiting Products', type: :system, inaccessible: true do
|
6
|
+
include_context "custom products"
|
7
|
+
|
8
|
+
let(:store_name) do
|
9
|
+
((first_store = Spree::Store.first) && first_store.name).to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
visit spree.root_path
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'should be able to show the shopping cart after adding a product to it' do
|
17
|
+
click_link 'Ruby on Rails Ringer T-Shirt'
|
18
|
+
expect(page).to have_content('$19.99')
|
19
|
+
|
20
|
+
click_button 'add-to-cart-button'
|
21
|
+
expect(page).to have_content('Shopping Cart')
|
22
|
+
end
|
23
|
+
|
24
|
+
# Regression spec for Spree [PR#7442](https://github.com/spree/spree/pull/7442)
|
25
|
+
context 'when generating product links' do
|
26
|
+
let(:product) { Spree::Product.available.first }
|
27
|
+
|
28
|
+
it 'should not use the *_url helper to generate the product links' do
|
29
|
+
visit spree.root_path
|
30
|
+
expect(page).not_to have_xpath(".//a[@href='#{spree.product_url(product, host: current_host)}']")
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should use *_path helper to generate the product links' do
|
34
|
+
visit spree.root_path
|
35
|
+
expect(page).to have_xpath(".//a[@href='#{spree.product_path(product)}']")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'meta tags and title' do
|
40
|
+
let(:jersey) { Spree::Product.find_by(name: 'Ruby on Rails Baseball Jersey') }
|
41
|
+
let(:metas) do
|
42
|
+
{
|
43
|
+
meta_description: 'Brand new Ruby on Rails Jersey',
|
44
|
+
meta_title: 'Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel',
|
45
|
+
meta_keywords: 'ror, jersey, ruby'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should return the correct title when displaying a single product' do
|
50
|
+
click_link jersey.name
|
51
|
+
expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
|
52
|
+
within('h1.product-info__title') do
|
53
|
+
expect(page).to have_content('Ruby on Rails Baseball Jersey')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'displays metas' do
|
58
|
+
jersey.update metas
|
59
|
+
click_link jersey.name
|
60
|
+
expect(page).to have_meta(:description, 'Brand new Ruby on Rails Jersey')
|
61
|
+
expect(page).to have_meta(:keywords, 'ror, jersey, ruby')
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'displays title if set' do
|
65
|
+
jersey.update metas
|
66
|
+
click_link jersey.name
|
67
|
+
expect(page).to have_title('Ruby on Rails Baseball Jersey Buy High Quality Geek Apparel')
|
68
|
+
end
|
69
|
+
|
70
|
+
it "doesn't use meta_title as heading on page" do
|
71
|
+
jersey.update metas
|
72
|
+
click_link jersey.name
|
73
|
+
within('h1') do
|
74
|
+
expect(page).to have_content(jersey.name)
|
75
|
+
expect(page).not_to have_content(jersey.meta_title)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'uses product name in title when meta_title set to empty string' do
|
80
|
+
jersey.update meta_title: ''
|
81
|
+
click_link jersey.name
|
82
|
+
expect(page).to have_title('Ruby on Rails Baseball Jersey - ' + store_name)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe 'schema.org markup' do
|
87
|
+
let(:product) { Spree::Product.available.first }
|
88
|
+
|
89
|
+
it 'has correct schema.org/Offer attributes' do
|
90
|
+
expect(page).to have_css("#product_#{product.id} [itemprop='price'][content='19.99']")
|
91
|
+
expect(page).to have_css("#product_#{product.id} [itemprop='priceCurrency'][content='USD']")
|
92
|
+
click_link product.name
|
93
|
+
expect(page).to have_css("[itemprop='price'][content='19.99']")
|
94
|
+
expect(page).to have_css("[itemprop='priceCurrency'][content='USD']")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context 'using Russian Rubles as a currency' do
|
99
|
+
before do
|
100
|
+
stub_spree_preferences(currency: 'RUB')
|
101
|
+
end
|
102
|
+
|
103
|
+
let!(:product) do
|
104
|
+
product = Spree::Product.find_by(name: 'Ruby on Rails Ringer T-Shirt')
|
105
|
+
product.price = 19.99
|
106
|
+
product.tap(&:save)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Regression tests for https://github.com/spree/spree/issues/2737
|
110
|
+
context 'uses руб as the currency symbol' do
|
111
|
+
it 'on products page' do
|
112
|
+
visit spree.root_path
|
113
|
+
within("#product_#{product.id}") do
|
114
|
+
within('.price') do
|
115
|
+
expect(page).to have_content('19.99 ₽')
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'on product page' do
|
121
|
+
visit spree.product_path(product)
|
122
|
+
within('.price') do
|
123
|
+
expect(page).to have_content('19.99 ₽')
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'when adding a product to the cart', js: true do
|
128
|
+
visit spree.product_path(product)
|
129
|
+
click_button 'Add To Cart'
|
130
|
+
find('.logo').click
|
131
|
+
within('.cart-info') do
|
132
|
+
expect(page).to have_content('19.99 ₽')
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
it "when on the 'address' state of the cart", js: true do
|
137
|
+
visit spree.product_path(product)
|
138
|
+
click_button 'Add To Cart'
|
139
|
+
click_button 'Checkout'
|
140
|
+
within('#item-total') do
|
141
|
+
expect(page).to have_content('19.99 ₽')
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
it 'should be able to search for a product' do
|
148
|
+
fill_in 'keywords', with: 'shirt'
|
149
|
+
click_button 'Search'
|
150
|
+
|
151
|
+
expect(page.all('ul.products-grid li').size).to eq(1)
|
152
|
+
end
|
153
|
+
|
154
|
+
context 'a product with variants' do
|
155
|
+
let(:product) do
|
156
|
+
Spree::Product.find_by(name: 'Ruby on Rails Baseball Jersey')
|
157
|
+
end
|
158
|
+
let(:option_value) { create(:option_value) }
|
159
|
+
let!(:variant) { product.variants.create!(price: 5.59) }
|
160
|
+
|
161
|
+
before do
|
162
|
+
# Need to have two images to trigger the error
|
163
|
+
image = File.open(File.expand_path('../fixtures/thinking-cat.jpg', __dir__))
|
164
|
+
product.images.create!(attachment: image)
|
165
|
+
product.images.create!(attachment: image)
|
166
|
+
|
167
|
+
product.option_types << option_value.option_type
|
168
|
+
variant.option_values << option_value
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'displays price of first variant listed', js: true do
|
172
|
+
click_link product.name
|
173
|
+
within('#product-price') do
|
174
|
+
expect(page).to have_content variant.price
|
175
|
+
expect(page).not_to have_content I18n.t('spree.out_of_stock')
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
it "doesn't display out of stock for master product" do
|
180
|
+
product.master.stock_items.update_all count_on_hand: 0, backorderable: false
|
181
|
+
|
182
|
+
click_link product.name
|
183
|
+
within('#product-price') do
|
184
|
+
expect(page).not_to have_content I18n.t('spree.out_of_stock')
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
context 'a product with variants, images only for the variants' do
|
190
|
+
let(:product) do
|
191
|
+
Spree::Product.find_by(name: 'Ruby on Rails Baseball Jersey')
|
192
|
+
end
|
193
|
+
|
194
|
+
before do
|
195
|
+
image = File.open(File.expand_path('../fixtures/thinking-cat.jpg', __dir__))
|
196
|
+
v1 = product.variants.create!(price: 9.99)
|
197
|
+
v2 = product.variants.create!(price: 10.99)
|
198
|
+
v1.images.create!(attachment: image)
|
199
|
+
v2.images.create!(attachment: image)
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'should not display no image available' do
|
203
|
+
visit spree.root_path
|
204
|
+
expect(page).to have_xpath("//img[contains(@src,'thinking-cat')]")
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
it 'should be able to hide products without price' do
|
209
|
+
expect(page.all('ul.products-grid li').size).to eq(9)
|
210
|
+
stub_spree_preferences(show_products_without_price: false)
|
211
|
+
stub_spree_preferences(currency: 'CAN')
|
212
|
+
visit spree.root_path
|
213
|
+
expect(page.all('ul.products-grid li').size).to eq(0)
|
214
|
+
end
|
215
|
+
|
216
|
+
context 'when filtering' do
|
217
|
+
before { visit spree.products_path }
|
218
|
+
|
219
|
+
it 'should be able to display products priced under 10 dollars' do
|
220
|
+
within(:css, '.taxonomies') { click_link 'Ruby on Rails' }
|
221
|
+
check 'Price_Range_Under_$10.00'
|
222
|
+
within(:css, '#sidebar_products_search') { click_button 'Search' }
|
223
|
+
expect(page).to have_content('No products found')
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'should be able to display products priced between 15 and 18 dollars' do
|
227
|
+
within(:css, '.taxonomies') { click_link 'Ruby on Rails' }
|
228
|
+
check 'Price_Range_$15.00_-_$18.00'
|
229
|
+
within(:css, '#sidebar_products_search') { click_button 'Search' }
|
230
|
+
|
231
|
+
expect(page.all('ul.products-grid li').size).to eq(3)
|
232
|
+
tmp = page.all('ul.products-grid li a').map(&:text).flatten.compact
|
233
|
+
tmp.delete('')
|
234
|
+
expect(tmp.sort!).to eq(
|
235
|
+
['Ruby on Rails Mug', 'Ruby on Rails Stein', 'Ruby on Rails Tote']
|
236
|
+
)
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'should be able to display products priced between 15 and 18 dollars across multiple pages' do
|
240
|
+
stub_spree_preferences(products_per_page: 2)
|
241
|
+
within(:css, '.taxonomies') { click_link 'Ruby on Rails' }
|
242
|
+
check 'Price_Range_$15.00_-_$18.00'
|
243
|
+
within(:css, '#sidebar_products_search') { click_button 'Search' }
|
244
|
+
|
245
|
+
expect(page.all('ul.products-grid li').size).to eq(2)
|
246
|
+
products = page.all('ul.products-grid li a[itemprop=name]')
|
247
|
+
expect(products.count).to eq(2)
|
248
|
+
|
249
|
+
find('nav.pagination .next a').click
|
250
|
+
products = page.all('ul.products-grid li a[itemprop=name]')
|
251
|
+
expect(products.count).to eq(1)
|
252
|
+
end
|
253
|
+
|
254
|
+
it 'should be able to display products priced 18 dollars and above' do
|
255
|
+
within(:css, '.taxonomies') { click_link 'Ruby on Rails' }
|
256
|
+
check 'Price_Range_$18.00_-_$20.00'
|
257
|
+
check 'Price_Range_$20.00_or_over'
|
258
|
+
within(:css, '#sidebar_products_search') { click_button 'Search' }
|
259
|
+
expect(page.all('ul.products-grid li').size).to eq(4)
|
260
|
+
tmp = page.all('ul.products-grid li a').map(&:text).flatten.compact
|
261
|
+
tmp.delete('')
|
262
|
+
expect(tmp.sort!).to eq(['Ruby on Rails Bag',
|
263
|
+
'Ruby on Rails Baseball Jersey',
|
264
|
+
'Ruby on Rails Jr. Spaghetti',
|
265
|
+
'Ruby on Rails Ringer T-Shirt'])
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
it 'should be able to put a product without a description in the cart' do
|
270
|
+
product = FactoryBot.create(:base_product, description: nil, name: 'Sample', price: '19.99')
|
271
|
+
visit spree.product_path(product)
|
272
|
+
expect(page).to have_content 'This product has no description'
|
273
|
+
click_button 'add-to-cart-button'
|
274
|
+
expect(page).to have_content 'This product has no description'
|
275
|
+
end
|
276
|
+
|
277
|
+
it "shouldn't be able to put a product without a current price in the cart" do
|
278
|
+
product = FactoryBot.create(:base_product, description: nil, name: 'Sample', price: '19.99')
|
279
|
+
stub_spree_preferences(currency: 'CAN')
|
280
|
+
stub_spree_preferences(show_products_without_price: true)
|
281
|
+
visit spree.product_path(product)
|
282
|
+
expect(page).to have_content 'This product is not available in the selected currency'
|
283
|
+
expect(page).not_to have_content 'add-to-cart-button'
|
284
|
+
end
|
285
|
+
|
286
|
+
it 'should be able to list products without a price' do
|
287
|
+
product = FactoryBot.create(:base_product, description: nil, name: 'Sample', price: '19.99')
|
288
|
+
stub_spree_preferences(currency: 'CAN')
|
289
|
+
stub_spree_preferences(show_products_without_price: true)
|
290
|
+
visit spree.products_path
|
291
|
+
expect(page).to have_content(product.name)
|
292
|
+
end
|
293
|
+
|
294
|
+
it 'should return the correct title when displaying a single product' do
|
295
|
+
product = Spree::Product.find_by(name: 'Ruby on Rails Baseball Jersey')
|
296
|
+
click_link product.name
|
297
|
+
|
298
|
+
within('h1.product-info__title') do
|
299
|
+
expect(page).to have_content('Ruby on Rails Baseball Jersey')
|
300
|
+
end
|
301
|
+
end
|
302
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe 'Promotion Code Invalidation', type: :system, js: true do
|
6
|
+
let!(:promotion) do
|
7
|
+
FactoryBot.create(
|
8
|
+
:promotion_with_item_adjustment,
|
9
|
+
code: "PROMO",
|
10
|
+
per_code_usage_limit: 1,
|
11
|
+
adjustment_rate: 5
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
before do
|
16
|
+
create(:store)
|
17
|
+
FactoryBot.create(:product, name: "DL-44")
|
18
|
+
FactoryBot.create(:product, name: "E-11")
|
19
|
+
|
20
|
+
visit spree.root_path
|
21
|
+
click_link "DL-44"
|
22
|
+
click_button "Add To Cart"
|
23
|
+
|
24
|
+
visit spree.root_path
|
25
|
+
click_link "E-11"
|
26
|
+
click_button "Add To Cart"
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'adding the promotion to a cart with two applicable items' do
|
30
|
+
fill_in "Coupon code", with: "PROMO"
|
31
|
+
click_button "Apply Code"
|
32
|
+
|
33
|
+
expect(page).to have_content("The coupon code was successfully applied to your order")
|
34
|
+
|
35
|
+
within("#cart_adjustments") do
|
36
|
+
expect(page).to have_content("-$10.00")
|
37
|
+
end
|
38
|
+
|
39
|
+
# Remove an item
|
40
|
+
fill_in "order_line_items_attributes_0_quantity", with: 0
|
41
|
+
click_button "Update"
|
42
|
+
within("#cart_adjustments") do
|
43
|
+
expect(page).to have_content("-$5.00")
|
44
|
+
end
|
45
|
+
|
46
|
+
# Add it back
|
47
|
+
visit spree.root_path
|
48
|
+
click_link "DL-44"
|
49
|
+
click_button "Add To Cart"
|
50
|
+
within("#cart_adjustments") do
|
51
|
+
expect(page).to have_content("-$10.00")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe 'Quantity Promotions', type: :system, js: true do
|
6
|
+
let(:action) do
|
7
|
+
Spree::Promotion::Actions::CreateQuantityAdjustments.create(
|
8
|
+
calculator: calculator,
|
9
|
+
preferred_group_size: 2
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:promotion) { FactoryBot.create(:promotion, code: 'PROMO') }
|
14
|
+
let(:calculator) { FactoryBot.create(:calculator, preferred_amount: 5) }
|
15
|
+
|
16
|
+
before do
|
17
|
+
create(:store)
|
18
|
+
FactoryBot.create(:product, name: "DL-44")
|
19
|
+
FactoryBot.create(:product, name: "E-11")
|
20
|
+
promotion.actions << action
|
21
|
+
|
22
|
+
visit spree.root_path
|
23
|
+
click_link "DL-44"
|
24
|
+
click_button "Add To Cart"
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'adding and removing items from the cart' do
|
28
|
+
# Attempt to use the code with too few items.
|
29
|
+
fill_in "coupon_code", with: "PROMO"
|
30
|
+
click_button "Apply Code"
|
31
|
+
expect(page).to have_content("This coupon code could not be applied to the cart at this time")
|
32
|
+
|
33
|
+
# Add another item to our cart.
|
34
|
+
visit spree.root_path
|
35
|
+
click_link "DL-44"
|
36
|
+
click_button "Add To Cart"
|
37
|
+
|
38
|
+
# Using the code should now succeed.
|
39
|
+
fill_in "coupon_code", with: "PROMO"
|
40
|
+
click_button "Apply Code"
|
41
|
+
expect(page).to have_content("The coupon code was successfully applied to your order")
|
42
|
+
within("#cart_adjustments") do
|
43
|
+
expect(page).to have_content("-$10.00")
|
44
|
+
end
|
45
|
+
|
46
|
+
# Reduce quantity by 1, making promotion not apply.
|
47
|
+
fill_in "order_line_items_attributes_0_quantity", with: 1
|
48
|
+
click_button "Update"
|
49
|
+
expect(page).to_not have_content("#cart_adjustments")
|
50
|
+
|
51
|
+
# Bump quantity to 3, making promotion apply "once."
|
52
|
+
fill_in "order_line_items_attributes_0_quantity", with: 3
|
53
|
+
click_button "Update"
|
54
|
+
within("#cart_adjustments") do
|
55
|
+
expect(page).to have_content("-$10.00")
|
56
|
+
end
|
57
|
+
|
58
|
+
# Bump quantity to 4, making promotion apply "twice."
|
59
|
+
fill_in "order_line_items_attributes_0_quantity", with: 4
|
60
|
+
click_button "Update"
|
61
|
+
within("#cart_adjustments") do
|
62
|
+
expect(page).to have_content("-$20.00")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Catches an earlier issue with quantity calculation.
|
67
|
+
it 'adding odd numbers of items to the cart' do
|
68
|
+
# Bump quantity to 3
|
69
|
+
fill_in "order_line_items_attributes_0_quantity", with: 3
|
70
|
+
click_button "Update"
|
71
|
+
|
72
|
+
# Apply the promo code and see a $10 discount (for 2 of the 3 items)
|
73
|
+
fill_in "coupon_code", with: "PROMO"
|
74
|
+
click_button "Apply Code"
|
75
|
+
expect(page).to have_content("The coupon code was successfully applied to your order")
|
76
|
+
within("#cart_adjustments") do
|
77
|
+
expect(page).to have_content("-$10.00")
|
78
|
+
end
|
79
|
+
|
80
|
+
# Add a different product to our cart with quantity of 2.
|
81
|
+
visit spree.root_path
|
82
|
+
click_link "E-11"
|
83
|
+
fill_in "quantity", with: "2"
|
84
|
+
click_button "Add To Cart"
|
85
|
+
|
86
|
+
# We now have 5 items total, so discount should increase.
|
87
|
+
within("#cart_adjustments") do
|
88
|
+
expect(page).to have_content("-$20.00")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "with a group size of 3" do
|
93
|
+
let(:action) do
|
94
|
+
Spree::Promotion::Actions::CreateQuantityAdjustments.create(
|
95
|
+
calculator: calculator,
|
96
|
+
preferred_group_size: 3
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
before { FactoryBot.create(:product, name: 'DC-15A') }
|
101
|
+
|
102
|
+
it 'odd number of changes to quantities' do
|
103
|
+
fill_in "order_line_items_attributes_0_quantity", with: 3
|
104
|
+
click_button "Update"
|
105
|
+
|
106
|
+
# Apply the promo code and see a $15 discount
|
107
|
+
fill_in "coupon_code", with: "PROMO"
|
108
|
+
click_button "Apply Code"
|
109
|
+
expect(page).to have_content("The coupon code was successfully applied to your order")
|
110
|
+
within("#cart_adjustments") do
|
111
|
+
expect(page).to have_content("-$15.00")
|
112
|
+
end
|
113
|
+
|
114
|
+
# Add two different products to our cart
|
115
|
+
visit spree.root_path
|
116
|
+
click_link "E-11"
|
117
|
+
click_button "Add To Cart"
|
118
|
+
within("#cart_adjustments") do
|
119
|
+
expect(page).to have_content("-$15.00")
|
120
|
+
end
|
121
|
+
|
122
|
+
# Reduce quantity of first item to 2
|
123
|
+
fill_in "order_line_items_attributes_0_quantity", with: 2
|
124
|
+
click_button "Update"
|
125
|
+
within("#cart_adjustments") do
|
126
|
+
expect(page).to have_content("-$15.00")
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|