solidus_starter_frontend 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +30 -514
- data/.circleci/config.yml +0 -57
- data/.erb-lint.yml +0 -22
- data/.eslintrc +0 -5
- data/.gem_release.yml +0 -5
- data/.github/pull_request_template.md +0 -28
- data/.github/stale.yml +0 -17
- data/.gitignore +0 -17
- data/.hound.yml +0 -16
- data/.rspec +0 -2
- data/.rubocop.yml +0 -19
- data/.rubocop_todo.yml +0 -229
- data/.scss-lint.yml +0 -4
- data/Gemfile +0 -34
- data/LICENSE +0 -26
- data/README.md +0 -69
- data/Rakefile +0 -6
- data/app/assets/config/solidus_starter_frontend_manifest.js +0 -2
- data/app/assets/javascripts/spree/frontend/cart.js +0 -26
- data/app/assets/javascripts/spree/frontend/checkout/address.js +0 -124
- data/app/assets/javascripts/spree/frontend/checkout/payment.js +0 -44
- data/app/assets/javascripts/spree/frontend/checkout.js +0 -34
- data/app/assets/javascripts/spree/frontend/locale_selector.js +0 -9
- data/app/assets/javascripts/spree/frontend/product.js +0 -21
- data/app/assets/javascripts/spree/frontend/solidus_starter_frontend.js +0 -9
- data/app/assets/javascripts/spree/frontend/utils.js.erb +0 -18
- data/app/assets/javascripts/spree/frontend.js +0 -6
- data/app/assets/stylesheets/spree/frontend/base/_base.scss +0 -29
- data/app/assets/stylesheets/spree/frontend/base/_reset.scss +0 -179
- data/app/assets/stylesheets/spree/frontend/base/_responsive.scss +0 -21
- data/app/assets/stylesheets/spree/frontend/components/account/_account_order.scss +0 -23
- data/app/assets/stylesheets/spree/frontend/components/account/_account_summary.scss +0 -17
- data/app/assets/stylesheets/spree/frontend/components/auth/_auth_container.scss +0 -11
- data/app/assets/stylesheets/spree/frontend/components/auth/_auth_form.scss +0 -5
- data/app/assets/stylesheets/spree/frontend/components/brand/_logo.scss +0 -4
- data/app/assets/stylesheets/spree/frontend/components/buttons/_button_inline.scss +0 -8
- data/app/assets/stylesheets/spree/frontend/components/buttons/_button_primary.scss +0 -26
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_adjustments.scss +0 -6
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_amount_row.scss +0 -11
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_empty.scss +0 -10
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_footer.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_header.scss +0 -12
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_item.scss +0 -86
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_link.scss +0 -22
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_page.scss +0 -15
- data/app/assets/stylesheets/spree/frontend/components/cart/_cart_secondary_actions.scss +0 -19
- data/app/assets/stylesheets/spree/frontend/components/cart/_coupon_code.scss +0 -8
- data/app/assets/stylesheets/spree/frontend/components/cart/_item_info.scss +0 -19
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout_header.scss +0 -19
- data/app/assets/stylesheets/spree/frontend/components/checkout/_checkout_summary.scss +0 -31
- data/app/assets/stylesheets/spree/frontend/components/checkout/_existing_cards.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/checkout/_payment_method_controls.scss +0 -5
- data/app/assets/stylesheets/spree/frontend/components/checkout/_payment_method_selector.scss +0 -14
- data/app/assets/stylesheets/spree/frontend/components/checkout/_progress_steps.scss +0 -38
- data/app/assets/stylesheets/spree/frontend/components/checkout/_proposed_shipment.scss +0 -18
- data/app/assets/stylesheets/spree/frontend/components/checkout/_shipment_items.scss +0 -50
- data/app/assets/stylesheets/spree/frontend/components/checkout/_shipping_methods.scss +0 -9
- data/app/assets/stylesheets/spree/frontend/components/checkout/payments/_gateway_payment_method.scss +0 -11
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_address_step.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_confirm_step.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_delivery_step.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/checkout/steps/_payment_step.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/forms/_address_inputs.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_checkbox_input.scss +0 -3
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_radio_input.scss +0 -3
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_select_input.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_text.scss +0 -32
- data/app/assets/stylesheets/spree/frontend/components/forms/inputs/_textarea_input.scss +0 -25
- data/app/assets/stylesheets/spree/frontend/components/general/_flash.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/layout/_aside.scss +0 -4
- data/app/assets/stylesheets/spree/frontend/components/layout/_breadcrumbs.scss +0 -16
- data/app/assets/stylesheets/spree/frontend/components/layout/_category_navigation.scss +0 -3
- data/app/assets/stylesheets/spree/frontend/components/layout/_footer.scss +0 -8
- data/app/assets/stylesheets/spree/frontend/components/layout/_header.scss +0 -12
- data/app/assets/stylesheets/spree/frontend/components/layout/_horizontal_input_group.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/components/layout/_top_bar.scss +0 -44
- data/app/assets/stylesheets/spree/frontend/components/navigation/_auth_link.scss +0 -11
- data/app/assets/stylesheets/spree/frontend/components/navigation/_categories.scss +0 -29
- data/app/assets/stylesheets/spree/frontend/components/navigation/_locale_selector.scss +0 -21
- data/app/assets/stylesheets/spree/frontend/components/navigation/_taxonomies.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/components/navigation/_taxonomy.scss +0 -28
- data/app/assets/stylesheets/spree/frontend/components/orders/_address_overview.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/orders/_coupon_codes.scss +0 -4
- data/app/assets/stylesheets/spree/frontend/components/orders/_line_items.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_details.scss +0 -18
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_item.scss +0 -85
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_page.scss +0 -41
- data/app/assets/stylesheets/spree/frontend/components/orders/_order_shipments.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/orders/_payment_info.scss +0 -29
- data/app/assets/stylesheets/spree/frontend/components/presentation/_hero.scss +0 -18
- data/app/assets/stylesheets/spree/frontend/components/products/_product_card.scss +0 -35
- data/app/assets/stylesheets/spree/frontend/components/products/_product_image.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/components/products/_product_info.scss +0 -14
- data/app/assets/stylesheets/spree/frontend/components/products/_product_page.scss +0 -31
- data/app/assets/stylesheets/spree/frontend/components/products/_product_properties.scss +0 -23
- data/app/assets/stylesheets/spree/frontend/components/products/_product_submit.scss +0 -9
- data/app/assets/stylesheets/spree/frontend/components/products/_product_taxons.scss +0 -27
- data/app/assets/stylesheets/spree/frontend/components/products/_product_thumbnails.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/components/products/_product_variants.scss +0 -20
- data/app/assets/stylesheets/spree/frontend/components/products/_products.scss +0 -13
- data/app/assets/stylesheets/spree/frontend/components/products/_products_by_taxon.scss +0 -6
- data/app/assets/stylesheets/spree/frontend/components/products/_products_grid.scss +0 -18
- data/app/assets/stylesheets/spree/frontend/components/search/_filter.scss +0 -32
- data/app/assets/stylesheets/spree/frontend/components/search/_search_bar.scss +0 -34
- data/app/assets/stylesheets/spree/frontend/components/typography/_hero_title.scss +0 -6
- data/app/assets/stylesheets/spree/frontend/components/typography/_subtitle.scss +0 -7
- data/app/assets/stylesheets/spree/frontend/placeholders/main.scss +0 -5
- data/app/assets/stylesheets/spree/frontend/screen.scss +0 -89
- data/app/assets/stylesheets/spree/frontend/solidus_starter_frontend.css +0 -7
- data/app/assets/stylesheets/spree/frontend/variables/_colors.scss +0 -20
- data/app/assets/stylesheets/spree/frontend.css +0 -8
- data/app/controllers/concerns/solidus_starter_frontend/auth_views.rb +0 -16
- data/app/controllers/concerns/solidus_starter_frontend/taxonomies.rb +0 -16
- data/app/controllers/spree/checkout_controller.rb +0 -249
- data/app/controllers/spree/coupon_codes_controller.rb +0 -35
- data/app/controllers/spree/home_controller.rb +0 -13
- data/app/controllers/spree/locale_controller.rb +0 -20
- data/app/controllers/spree/orders_controller.rb +0 -126
- data/app/controllers/spree/products_controller.rb +0 -51
- data/app/controllers/spree/store_controller.rb +0 -31
- data/app/controllers/spree/taxons_controller.rb +0 -30
- data/app/helpers/spree/orders_helper.rb +0 -18
- data/app/helpers/spree/taxon_filters_helper.rb +0 -13
- data/app/views/spree/address/_form_hidden.html.erb +0 -12
- data/app/views/spree/checkout/_terms_and_conditions.en.html.erb +0 -1
- data/app/views/spree/checkout/edit.html.erb +0 -16
- data/app/views/spree/checkout/existing_payment/_gateway.html.erb +0 -9
- data/app/views/spree/checkout/payment/_check.html.erb +0 -0
- data/app/views/spree/checkout/payment/_gateway.html.erb +0 -43
- data/app/views/spree/components/auth/_change_form.html.erb +0 -40
- data/app/views/spree/components/auth/_forgot_form.html.erb +0 -28
- data/app/views/spree/components/auth/_guest_form.html.erb +0 -31
- data/app/views/spree/components/auth/_login_form.html.erb +0 -42
- data/app/views/spree/components/auth/_signup_form.html.erb +0 -48
- data/app/views/spree/components/brand/_logo.html.erb +0 -3
- data/app/views/spree/components/buttons/_button_inline.html.erb +0 -23
- data/app/views/spree/components/buttons/_button_primary.html.erb +0 -29
- data/app/views/spree/components/cart/_cart_adjustment.html.erb +0 -15
- data/app/views/spree/components/cart/_cart_adjustments.html.erb +0 -47
- data/app/views/spree/components/cart/_cart_amount_row.html.erb +0 -12
- data/app/views/spree/components/cart/_cart_empty.html.erb +0 -9
- data/app/views/spree/components/cart/_cart_footer.html.erb +0 -15
- data/app/views/spree/components/cart/_cart_header.html.erb +0 -17
- data/app/views/spree/components/cart/_cart_item.html.erb +0 -52
- data/app/views/spree/components/cart/_cart_items.html.erb +0 -23
- data/app/views/spree/components/cart/_cart_link.html.erb +0 -9
- data/app/views/spree/components/cart/_cart_secondary_actions.html.erb +0 -17
- data/app/views/spree/components/cart/_item_info.html.erb +0 -26
- data/app/views/spree/components/checkout/_checkout_header.html.erb +0 -8
- data/app/views/spree/components/checkout/_checkout_step.html.erb +0 -21
- data/app/views/spree/components/checkout/_checkout_summary.html.erb +0 -70
- data/app/views/spree/components/checkout/_existing_cards.html.erb +0 -39
- data/app/views/spree/components/checkout/_payment_method_controls.html.erb +0 -10
- data/app/views/spree/components/checkout/_payment_method_selector.html.erb +0 -14
- data/app/views/spree/components/checkout/_proposed_shipment.erb +0 -18
- data/app/views/spree/components/checkout/_shipment_items.html.erb +0 -22
- data/app/views/spree/components/checkout/_shipping_methods.html.erb +0 -20
- data/app/views/spree/components/checkout/_unshippable_items.html.erb +0 -7
- data/app/views/spree/components/checkout/steps/_address_step.html.erb +0 -60
- data/app/views/spree/components/checkout/steps/_confirm_step.html.erb +0 -31
- data/app/views/spree/components/checkout/steps/_delivery_step.html.erb +0 -31
- data/app/views/spree/components/checkout/steps/_payment_step.html.erb +0 -25
- data/app/views/spree/components/forms/_address_inputs.html.erb +0 -152
- data/app/views/spree/components/forms/inputs/_checkbox_input.html.erb +0 -29
- data/app/views/spree/components/forms/inputs/_collection_select.html.erb +0 -42
- data/app/views/spree/components/forms/inputs/_radio_input.html.erb +0 -29
- data/app/views/spree/components/forms/inputs/_select_input.html.erb +0 -31
- data/app/views/spree/components/forms/inputs/_text.html.erb +0 -54
- data/app/views/spree/components/forms/inputs/_textarea_input.html.erb +0 -42
- data/app/views/spree/components/layout/_category_navigation.html.erb +0 -3
- data/app/views/spree/components/layout/_footer.html.erb +0 -7
- data/app/views/spree/components/layout/_header.html.erb +0 -8
- data/app/views/spree/components/layout/_top_bar.html.erb +0 -8
- data/app/views/spree/components/navigation/_auth_link.html.erb +0 -1
- data/app/views/spree/components/navigation/_breadcrumbs.html.erb +0 -47
- data/app/views/spree/components/navigation/_categories.html.erb +0 -12
- data/app/views/spree/components/navigation/_locale_selector.html.erb +0 -25
- data/app/views/spree/components/navigation/_taxonomies.html.erb +0 -17
- data/app/views/spree/components/navigation/_taxons.html.erb +0 -17
- data/app/views/spree/components/navigation/_taxons_tree.html.erb +0 -29
- data/app/views/spree/components/orders/_address_overview.html.erb +0 -40
- data/app/views/spree/components/orders/_coupon_code.html.erb +0 -22
- data/app/views/spree/components/orders/_line_items.html.erb +0 -55
- data/app/views/spree/components/orders/_order_details.html.erb +0 -35
- data/app/views/spree/components/orders/_order_item.html.erb +0 -33
- data/app/views/spree/components/orders/_order_items.html.erb +0 -5
- data/app/views/spree/components/orders/_order_shipments.html.erb +0 -25
- data/app/views/spree/components/orders/_payment_info.html.erb +0 -31
- data/app/views/spree/components/presentation/_hero.html.erb +0 -14
- data/app/views/spree/components/products/_product-card.html.erb +0 -36
- data/app/views/spree/components/products/_product_availability.html.erb +0 -19
- data/app/views/spree/components/products/_product_form.html.erb +0 -21
- data/app/views/spree/components/products/_product_image.html.erb +0 -6
- data/app/views/spree/components/products/_product_info.html.erb +0 -9
- data/app/views/spree/components/products/_product_promotions.html.erb +0 -25
- data/app/views/spree/components/products/_product_properties.html.erb +0 -19
- data/app/views/spree/components/products/_product_submit.html.erb +0 -39
- data/app/views/spree/components/products/_product_taxons.html.erb +0 -15
- data/app/views/spree/components/products/_product_thumbnails.html.erb +0 -19
- data/app/views/spree/components/products/_product_variants.html.erb +0 -36
- data/app/views/spree/components/products/_products-grid.html.erb +0 -13
- data/app/views/spree/components/products/_products.html.erb +0 -28
- data/app/views/spree/components/products/_products_by_taxon.html.erb +0 -7
- data/app/views/spree/components/products/_variants_list.html.erb +0 -12
- data/app/views/spree/components/search/_filter.html.erb +0 -42
- data/app/views/spree/components/search/_filters.html.erb +0 -20
- data/app/views/spree/components/search/_form.html.erb +0 -12
- data/app/views/spree/components/search/_products_search.html.erb +0 -36
- data/app/views/spree/components/search/_search_bar.html.erb +0 -36
- data/app/views/spree/components/typography/_hero_title.html.erb +0 -11
- data/app/views/spree/components/typography/_subtitle.html.erb +0 -11
- data/app/views/spree/home/index.html.erb +0 -7
- data/app/views/spree/layouts/spree_application.html.erb +0 -27
- data/app/views/spree/orders/edit.html.erb +0 -21
- data/app/views/spree/orders/show.html.erb +0 -29
- data/app/views/spree/products/index.html.erb +0 -22
- data/app/views/spree/products/show.html.erb +0 -18
- data/app/views/spree/shared/_image.html.erb +0 -12
- data/app/views/spree/shared/_link_to_cart.html.erb +0 -1
- data/app/views/spree/shared/_login_bar_items.html.erb +0 -1
- data/app/views/spree/shared/_shipment_tracking.html.erb +0 -11
- data/app/views/spree/shared/unauthorized.html.erb +0 -0
- data/app/views/spree/taxons/show.html.erb +0 -17
- data/bin/console +0 -17
- data/bin/r +0 -13
- data/bin/rails +0 -7
- data/bin/rake +0 -7
- data/bin/rspec +0 -29
- data/bin/sandbox +0 -84
- data/bin/sandbox_rails +0 -18
- data/bin/setup +0 -8
- data/bin/solidus_compare +0 -155
- data/config/initializers/assets.rb +0 -1
- data/config/initializers/canonical_rails.rb +0 -16
- data/config/locales/en.yml +0 -5
- data/config/routes.rb +0 -33
- data/config/solidus_compare.yml +0 -33
- data/docs/development.md +0 -28
- data/exe/solidus_starter_frontend +0 -9
- data/lib/generators/solidus_starter_frontend/install/install_generator.rb +0 -15
- data/lib/generators/solidus_starter_frontend/solidus_starter_frontend_generator.rb +0 -30
- data/lib/generators/solidus_starter_frontend/views/override_generator.rb +0 -50
- data/lib/solidus_starter_frontend/config.rb +0 -7
- data/lib/solidus_starter_frontend/engine.rb +0 -34
- data/lib/solidus_starter_frontend/factories.rb +0 -4
- data/lib/solidus_starter_frontend/solidus_support_extensions.rb +0 -9
- data/lib/solidus_starter_frontend/version.rb +0 -5
- data/lib/solidus_starter_frontend.rb +0 -12
- data/lib/solidus_starter_frontend_configuration.rb +0 -8
- data/lib/views/auth/spree/checkout/registration.html.erb +0 -7
- data/lib/views/auth/spree/components/navigation/_auth_link.html.erb +0 -5
- data/lib/views/auth/spree/user_passwords/edit.html.erb +0 -7
- data/lib/views/auth/spree/user_passwords/new.html.erb +0 -5
- data/lib/views/auth/spree/user_registrations/new.html.erb +0 -7
- data/lib/views/auth/spree/user_sessions/guest.html.erb +0 -5
- data/lib/views/auth/spree/user_sessions/new.html.erb +0 -7
- data/lib/views/auth/spree/users/edit.html.erb +0 -45
- data/lib/views/auth/spree/users/show.html.erb +0 -55
- data/solidus_starter_frontend.gemspec +0 -43
- data/spec/controllers/controller_helpers_spec.rb +0 -29
- data/spec/controllers/locale_controller_spec.rb +0 -57
- data/spec/controllers/spree/checkout_controller_spec.rb +0 -563
- data/spec/controllers/spree/checkout_controller_with_views_spec.rb +0 -37
- data/spec/controllers/spree/current_order_tracking_spec.rb +0 -33
- data/spec/controllers/spree/home_controller_spec.rb +0 -29
- data/spec/controllers/spree/orders_controller_ability_spec.rb +0 -90
- data/spec/controllers/spree/orders_controller_spec.rb +0 -241
- data/spec/controllers/spree/orders_controller_transitions_spec.rb +0 -33
- data/spec/controllers/spree/products_controller_spec.rb +0 -38
- data/spec/controllers/spree/taxons_controller_spec.rb +0 -14
- data/spec/fixtures/thinking-cat.jpg +0 -0
- data/spec/generators/solidus/views/override_generator_spec.rb +0 -50
- data/spec/helpers/base_helper_spec.rb +0 -13
- data/spec/helpers/order_helper_spec.rb +0 -14
- data/spec/helpers/taxon_filters_helper_spec.rb +0 -12
- data/spec/spec_helper.rb +0 -64
- data/spec/support/shared_contexts/checkout_setup.rb +0 -12
- data/spec/support/shared_contexts/custom_products.rb +0 -28
- data/spec/support/shared_contexts/locales.rb +0 -16
- data/spec/system/address_spec.rb +0 -87
- data/spec/system/automatic_promotion_adjustments_spec.rb +0 -49
- data/spec/system/caching/products_spec.rb +0 -48
- data/spec/system/caching/taxons_spec.rb +0 -35
- data/spec/system/cart_spec.rb +0 -81
- data/spec/system/checkout_confirm_insufficient_stock_spec.rb +0 -71
- data/spec/system/checkout_spec.rb +0 -699
- data/spec/system/checkout_unshippable_spec.rb +0 -37
- data/spec/system/coupon_code_spec.rb +0 -267
- data/spec/system/currency_spec.rb +0 -20
- data/spec/system/first_order_promotion_spec.rb +0 -59
- data/spec/system/free_shipping_promotions_spec.rb +0 -60
- data/spec/system/locale_spec.rb +0 -26
- data/spec/system/order_spec.rb +0 -57
- data/spec/system/products_spec.rb +0 -302
- data/spec/system/promotion_code_invalidation_spec.rb +0 -54
- data/spec/system/quantity_promotions_spec.rb +0 -130
- data/spec/system/taxons_spec.rb +0 -158
- data/spec/system/template_rendering_spec.rb +0 -20
- data/spec/views/spree/checkout/_summary_spec.rb +0 -11
@@ -1,90 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
module Spree
|
6
|
-
describe OrdersController, type: :controller do
|
7
|
-
ORDER_TOKEN = 'ORDER_TOKEN'
|
8
|
-
|
9
|
-
let!(:store) { create(:store) }
|
10
|
-
let(:order) { Spree::Order.create }
|
11
|
-
let(:variant) { create(:variant) }
|
12
|
-
|
13
|
-
it 'should understand order routes with token' do
|
14
|
-
expect(spree.token_order_path('R123456', 'ABCDEF')).to eq('/orders/R123456/token/ABCDEF')
|
15
|
-
end
|
16
|
-
|
17
|
-
context 'when an order exists in the cookies.signed' do
|
18
|
-
let(:token) { 'some_token' }
|
19
|
-
|
20
|
-
before do
|
21
|
-
allow(controller).to receive_messages current_order: order
|
22
|
-
end
|
23
|
-
|
24
|
-
context '#populate' do
|
25
|
-
it 'should check if user is authorized for :update' do
|
26
|
-
expect(controller).to receive(:authorize!).with(:update, order, token)
|
27
|
-
post :populate, params: { variant_id: variant.id, token: token }
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context '#edit' do
|
32
|
-
it 'should check if user is authorized for :read' do
|
33
|
-
expect(controller).to receive(:authorize!).with(:read, order, token)
|
34
|
-
get :edit, params: { token: token }
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
context '#update' do
|
39
|
-
it 'should check if user is authorized for :update' do
|
40
|
-
allow(order).to receive :update
|
41
|
-
expect(controller).to receive(:authorize!).with(:update, order, token)
|
42
|
-
post :update, params: { order: { email: "foo@bar.com" }, token: token }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context '#empty' do
|
47
|
-
it 'should check if user is authorized for :update' do
|
48
|
-
expect(controller).to receive(:authorize!).with(:update, order, token)
|
49
|
-
post :empty, params: { token: token }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context "#show" do
|
54
|
-
let(:specified_order) { create(:order) }
|
55
|
-
|
56
|
-
it "should check against the specified order" do
|
57
|
-
expect(controller).to receive(:authorize!).with(:read, specified_order, token)
|
58
|
-
get :show, params: { id: specified_order.number, token: token }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
context 'when no authenticated user' do
|
64
|
-
let(:order) { create(:order, number: 'R123') }
|
65
|
-
|
66
|
-
context '#show' do
|
67
|
-
context 'when token parameter present' do
|
68
|
-
it 'always ooverride existing token when passing a new one' do
|
69
|
-
cookies.signed[:guest_token] = "soo wrong"
|
70
|
-
get :show, params: { id: 'R123', token: order.guest_token }
|
71
|
-
expect(cookies.signed[:guest_token]).to eq(order.guest_token)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'should store as guest_token in session' do
|
75
|
-
get :show, params: { id: 'R123', token: order.guest_token }
|
76
|
-
expect(cookies.signed[:guest_token]).to eq(order.guest_token)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'when no token present' do
|
81
|
-
it 'should respond with 404' do
|
82
|
-
expect {
|
83
|
-
get :show, params: { id: 'R123' }
|
84
|
-
}.to raise_error(ActiveRecord::RecordNotFound)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,241 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Spree::OrdersController, type: :controller do
|
6
|
-
let!(:store) { create(:store) }
|
7
|
-
let(:user) { create(:user) }
|
8
|
-
|
9
|
-
context "Order model mock" do
|
10
|
-
let(:order) do
|
11
|
-
Spree::Order.create!
|
12
|
-
end
|
13
|
-
let(:variant) { create(:variant) }
|
14
|
-
|
15
|
-
before do
|
16
|
-
allow(controller).to receive_messages(try_spree_current_user: user)
|
17
|
-
end
|
18
|
-
|
19
|
-
context "#populate" do
|
20
|
-
it "should create a new order when none specified" do
|
21
|
-
post :populate, params: { variant_id: variant.id }
|
22
|
-
expect(response).to be_redirect
|
23
|
-
expect(cookies.signed[:guest_token]).not_to be_blank
|
24
|
-
|
25
|
-
order_by_token = Spree::Order.find_by(guest_token: cookies.signed[:guest_token])
|
26
|
-
assigned_order = assigns[:order]
|
27
|
-
|
28
|
-
expect(assigned_order).to eq order_by_token
|
29
|
-
expect(assigned_order).to be_persisted
|
30
|
-
end
|
31
|
-
|
32
|
-
context "with Variant" do
|
33
|
-
it "should handle population" do
|
34
|
-
expect do
|
35
|
-
post :populate, params: { variant_id: variant.id, quantity: 5 }
|
36
|
-
end.to change { user.orders.count }.by(1)
|
37
|
-
order = user.orders.last
|
38
|
-
expect(response).to redirect_to spree.cart_path
|
39
|
-
expect(order.line_items.size).to eq(1)
|
40
|
-
line_item = order.line_items.first
|
41
|
-
expect(line_item.variant_id).to eq(variant.id)
|
42
|
-
expect(line_item.quantity).to eq(5)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "shows an error when population fails" do
|
46
|
-
request.env["HTTP_REFERER"] = spree.root_path
|
47
|
-
allow_any_instance_of(Spree::LineItem).to(
|
48
|
-
receive(:valid?).and_return(false)
|
49
|
-
)
|
50
|
-
allow_any_instance_of(Spree::LineItem).to(
|
51
|
-
receive_message_chain(:errors, :full_messages).
|
52
|
-
and_return(["Order population failed"])
|
53
|
-
)
|
54
|
-
|
55
|
-
post :populate, params: { variant_id: variant.id, quantity: 5 }
|
56
|
-
|
57
|
-
expect(response).to redirect_to(spree.root_path)
|
58
|
-
expect(flash[:error]).to eq("Order population failed")
|
59
|
-
end
|
60
|
-
|
61
|
-
it "shows an error when quantity is invalid" do
|
62
|
-
request.env["HTTP_REFERER"] = spree.root_path
|
63
|
-
|
64
|
-
post(
|
65
|
-
:populate,
|
66
|
-
params: { variant_id: variant.id, quantity: -1 }
|
67
|
-
)
|
68
|
-
|
69
|
-
expect(response).to redirect_to(spree.root_path)
|
70
|
-
expect(flash[:error]).to eq(
|
71
|
-
I18n.t('spree.please_enter_reasonable_quantity')
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
|
-
context "when quantity is empty string" do
|
76
|
-
it "should populate order with 1 of given variant" do
|
77
|
-
expect do
|
78
|
-
post :populate, params: { variant_id: variant.id, quantity: '' }
|
79
|
-
end.to change { Spree::Order.count }.by(1)
|
80
|
-
order = Spree::Order.last
|
81
|
-
expect(response).to redirect_to spree.cart_path
|
82
|
-
expect(order.line_items.size).to eq(1)
|
83
|
-
line_item = order.line_items.first
|
84
|
-
expect(line_item.variant_id).to eq(variant.id)
|
85
|
-
expect(line_item.quantity).to eq(1)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context "when quantity is nil" do
|
90
|
-
it "should populate order with 1 of given variant" do
|
91
|
-
expect do
|
92
|
-
post :populate, params: { variant_id: variant.id, quantity: nil }
|
93
|
-
end.to change { Spree::Order.count }.by(1)
|
94
|
-
order = Spree::Order.last
|
95
|
-
expect(response).to redirect_to spree.cart_path
|
96
|
-
expect(order.line_items.size).to eq(1)
|
97
|
-
line_item = order.line_items.first
|
98
|
-
expect(line_item.variant_id).to eq(variant.id)
|
99
|
-
expect(line_item.quantity).to eq(1)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context '#edit' do
|
106
|
-
before do
|
107
|
-
allow(controller).to receive :authorize!
|
108
|
-
allow(controller).to receive_messages current_order: order
|
109
|
-
end
|
110
|
-
|
111
|
-
it 'should render cart' do
|
112
|
-
get :edit, params: { id: order.number }
|
113
|
-
|
114
|
-
expect(flash[:error]).to be_nil
|
115
|
-
expect(response).to be_ok
|
116
|
-
end
|
117
|
-
|
118
|
-
context 'with another order number than the current_order' do
|
119
|
-
let(:other_order) { create(:completed_order_with_totals) }
|
120
|
-
|
121
|
-
it 'should display error message' do
|
122
|
-
get :edit, params: { id: other_order.number }
|
123
|
-
|
124
|
-
expect(flash[:error]).to eq "You may only edit your current shopping cart."
|
125
|
-
expect(response).to redirect_to cart_path
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
context "#update" do
|
131
|
-
context "with authorization" do
|
132
|
-
before do
|
133
|
-
allow(controller).to receive :authorize!
|
134
|
-
allow(controller).to receive_messages current_order: order
|
135
|
-
end
|
136
|
-
|
137
|
-
it "should render the edit view (on failure)" do
|
138
|
-
# email validation is only after address state
|
139
|
-
order.update_column(:state, "delivery")
|
140
|
-
put :update, params: { order: { email: "" } }
|
141
|
-
expect(response).to render_template :edit
|
142
|
-
end
|
143
|
-
|
144
|
-
it "should redirect to cart path (on success)" do
|
145
|
-
allow(order).to receive(:update).and_return true
|
146
|
-
put :update
|
147
|
-
expect(response).to redirect_to(spree.cart_path)
|
148
|
-
end
|
149
|
-
|
150
|
-
it "should advance the order if :checkout button is pressed" do
|
151
|
-
allow(order).to receive(:update).and_return true
|
152
|
-
expect(order).to receive(:next)
|
153
|
-
put :update, params: { checkout: true }
|
154
|
-
expect(response).to redirect_to checkout_state_path('address')
|
155
|
-
end
|
156
|
-
|
157
|
-
context 'trying to apply a coupon code' do
|
158
|
-
let(:order) { create(:order_with_line_items, state: 'cart') }
|
159
|
-
let(:coupon_code) { "coupon_code" }
|
160
|
-
|
161
|
-
context "when coupon code is empty" do
|
162
|
-
let(:coupon_code) { "" }
|
163
|
-
|
164
|
-
it 'does not try to apply coupon code' do
|
165
|
-
expect(Spree::PromotionHandler::Coupon).not_to receive :new
|
166
|
-
|
167
|
-
put :update, params: { state: order.state, order: { coupon_code: coupon_code } }
|
168
|
-
|
169
|
-
expect(response).to redirect_to(spree.cart_path)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
context "#empty" do
|
177
|
-
before do
|
178
|
-
allow(controller).to receive :authorize!
|
179
|
-
end
|
180
|
-
|
181
|
-
it "should destroy line items in the current order" do
|
182
|
-
allow(controller).to receive(:current_order).and_return(order)
|
183
|
-
expect(order).to receive(:empty!)
|
184
|
-
put :empty
|
185
|
-
expect(response).to redirect_to(spree.cart_path)
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
# Regression test for https://github.com/spree/spree/issues/2750
|
190
|
-
context "#update" do
|
191
|
-
before do
|
192
|
-
allow(user).to receive :last_incomplete_spree_order
|
193
|
-
allow(controller).to receive :set_current_order
|
194
|
-
end
|
195
|
-
|
196
|
-
it "cannot update a blank order" do
|
197
|
-
put :update, params: { order: { email: "foo" } }
|
198
|
-
expect(flash[:error]).to eq(I18n.t('spree.order_not_found'))
|
199
|
-
expect(response).to redirect_to(spree.root_path)
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
context "line items quantity is 0" do
|
205
|
-
let(:order) { Spree::Order.create(store: store) }
|
206
|
-
let(:variant) { create(:variant) }
|
207
|
-
let!(:line_item) { order.contents.add(variant, 1) }
|
208
|
-
|
209
|
-
before do
|
210
|
-
allow(controller).to receive :authorize!
|
211
|
-
allow(controller).to receive_messages(current_order: order)
|
212
|
-
end
|
213
|
-
|
214
|
-
it "removes line items on update" do
|
215
|
-
expect(order.line_items.count).to eq 1
|
216
|
-
put :update, params: { order: { line_items_attributes: { "0" => { id: line_item.id, quantity: 0 } } } }
|
217
|
-
expect(order.reload.line_items.count).to eq 0
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
describe '#edit' do
|
222
|
-
subject { get :edit }
|
223
|
-
let(:user) { build :user }
|
224
|
-
|
225
|
-
it "builds a new valid order with complete meta-data" do
|
226
|
-
allow(controller).to receive_messages(try_spree_current_user: user)
|
227
|
-
|
228
|
-
subject
|
229
|
-
|
230
|
-
order = controller.instance_variable_get(:@order)
|
231
|
-
|
232
|
-
aggregate_failures do
|
233
|
-
expect(order).to be_valid
|
234
|
-
expect(order).not_to be_persisted
|
235
|
-
expect(order.store).to be_present
|
236
|
-
expect(order.user).to eq(user)
|
237
|
-
expect(order.created_by).to eq(user)
|
238
|
-
end
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
Spree::Order.class_eval do
|
6
|
-
attr_accessor :did_transition
|
7
|
-
end
|
8
|
-
|
9
|
-
module Spree
|
10
|
-
describe OrdersController, type: :controller do
|
11
|
-
# Regression test for https://github.com/spree/spree/issues/2004
|
12
|
-
context "with a transition callback on first state" do
|
13
|
-
let(:order) { Spree::Order.new }
|
14
|
-
|
15
|
-
before do
|
16
|
-
allow(controller).to receive_messages current_order: order
|
17
|
-
expect(controller).to receive(:authorize!).at_least(:once).and_return(true)
|
18
|
-
|
19
|
-
first_state, = Spree::Order.checkout_steps.first
|
20
|
-
Spree::Order.state_machine.after_transition to: first_state do |order|
|
21
|
-
order.did_transition = true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
it "correctly calls the transition callback" do
|
26
|
-
expect(order.did_transition).to be_nil
|
27
|
-
order.line_items << FactoryBot.create(:line_item)
|
28
|
-
put :update, params: { checkout: "checkout" }
|
29
|
-
expect(order.did_transition).to be true
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Spree::ProductsController, type: :controller do
|
6
|
-
let!(:product) { create(:product, available_on: 1.year.from_now) }
|
7
|
-
|
8
|
-
# Regression test for https://github.com/spree/spree/issues/1390
|
9
|
-
it "allows admins to view non-active products" do
|
10
|
-
allow(controller).to receive_messages try_spree_current_user: mock_model(Spree.user_class, has_spree_role?: true, last_incomplete_spree_order: nil, spree_api_key: 'fake')
|
11
|
-
get :show, params: { id: product.to_param }
|
12
|
-
expect(response.status).to eq(200)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "cannot view non-active products" do
|
16
|
-
expect {
|
17
|
-
get :show, params: { id: product.to_param }
|
18
|
-
}.to raise_error(ActiveRecord::RecordNotFound)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should provide the current user to the searcher class" do
|
22
|
-
user = mock_model(Spree.user_class, last_incomplete_spree_order: nil, spree_api_key: 'fake')
|
23
|
-
allow(controller).to receive_messages try_spree_current_user: user
|
24
|
-
expect_any_instance_of(Spree::Config.searcher_class).to receive(:current_user=).with(user)
|
25
|
-
get :index
|
26
|
-
expect(response.status).to eq(200)
|
27
|
-
end
|
28
|
-
|
29
|
-
# Regression test for https://github.com/spree/spree/issues/2249
|
30
|
-
it "doesn't error when given an invalid referer" do
|
31
|
-
current_user = mock_model(Spree.user_class, has_spree_role?: true, last_incomplete_spree_order: nil, generate_spree_api_key!: nil)
|
32
|
-
allow(controller).to receive_messages try_spree_current_user: current_user
|
33
|
-
request.env['HTTP_REFERER'] = "not|a$url"
|
34
|
-
|
35
|
-
# Previously a URI::InvalidURIError exception was being thrown
|
36
|
-
get :show, params: { id: product.to_param }
|
37
|
-
end
|
38
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Spree::TaxonsController, type: :controller do
|
6
|
-
it "should provide the current user to the searcher class" do
|
7
|
-
taxon = create(:taxon, permalink: "test")
|
8
|
-
user = mock_model(Spree.user_class, last_incomplete_spree_order: nil, spree_api_key: 'fake')
|
9
|
-
allow(controller).to receive_messages try_spree_current_user: user
|
10
|
-
expect_any_instance_of(Spree::Config.searcher_class).to receive(:current_user=).with(user)
|
11
|
-
get :show, params: { id: taxon.permalink }
|
12
|
-
expect(response.status).to eq(200)
|
13
|
-
end
|
14
|
-
end
|
Binary file
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'generator_spec'
|
5
|
-
require 'generators/solidus_starter_frontend/views/override_generator'
|
6
|
-
|
7
|
-
RSpec.describe SolidusStarterFrontend::Views::OverrideGenerator, type: :generator do
|
8
|
-
destination Rails.root.join('app', 'views', 'spree')
|
9
|
-
|
10
|
-
before(:all) do
|
11
|
-
prepare_destination
|
12
|
-
end
|
13
|
-
|
14
|
-
subject! do
|
15
|
-
run_generator arguments
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:src) do
|
19
|
-
::SolidusStarterFrontend::Engine.root.join('app', 'views', 'spree')
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:dest) do
|
23
|
-
Rails.root.join('app', 'views', 'spree')
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'without any arguments' do
|
27
|
-
let(:arguments) { %w() }
|
28
|
-
|
29
|
-
it 'copies all views into the host app' do
|
30
|
-
expect(src.entries).to match_array(dest.entries)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'when "products" is passed as --only argument' do
|
35
|
-
let(:arguments) { %w(--only products) }
|
36
|
-
|
37
|
-
context 'as folder' do
|
38
|
-
it 'exclusively copies views whose name contains "products"' do
|
39
|
-
Dir.glob(dest.join("**", "*")).each do |file|
|
40
|
-
next if File.directory?(file)
|
41
|
-
expect(file.to_s).to match("products")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
after do
|
48
|
-
FileUtils.rm_rf destination_root
|
49
|
-
end
|
50
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
module Spree
|
6
|
-
describe BaseHelper, type: :helper do
|
7
|
-
# Regression test for https://github.com/spree/spree/issues/2759
|
8
|
-
it "nested_taxons_path works with a Taxon object" do
|
9
|
-
taxon = create(:taxon, name: "iphone")
|
10
|
-
expect(spree.nested_taxons_path(taxon)).to eq("/t/iphone")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
module Spree
|
6
|
-
describe Spree::OrdersHelper, type: :helper do
|
7
|
-
# Regression test for https://github.com/spree/spree/issues/2518 and https://github.com/spree/spree/issues/2323
|
8
|
-
it "truncates HTML correctly in product description" do
|
9
|
-
product = double(description: "<strong>" + ("a" * 95) + "</strong> This content is invisible.")
|
10
|
-
expected = "<strong>" + ("a" * 95) + "</strong>..."
|
11
|
-
expect(truncated_product_description(product)).to eq(expected)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe Spree::TaxonFiltersHelper, type: :helper do
|
6
|
-
let(:taxon) { nil }
|
7
|
-
subject { applicable_filters_for(taxon) }
|
8
|
-
|
9
|
-
it "returns the price/brand filters" do
|
10
|
-
expect(subject.map { |y| y[:name] }).to eq ['Brands', 'Price Range']
|
11
|
-
end
|
12
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Configure Rails Environment
|
4
|
-
ENV['RAILS_ENV'] = 'test'
|
5
|
-
|
6
|
-
# Run Coverage report
|
7
|
-
require 'solidus_dev_support/rspec/coverage'
|
8
|
-
|
9
|
-
require File.expand_path('dummy/config/environment.rb', __dir__)
|
10
|
-
|
11
|
-
require 'rails-controller-testing'
|
12
|
-
require 'rspec/active_model/mocks'
|
13
|
-
|
14
|
-
# Requires factories and other useful helpers defined in spree_core.
|
15
|
-
require 'solidus_dev_support/rspec/feature_helper'
|
16
|
-
require 'spree/testing_support/caching'
|
17
|
-
require 'spree/testing_support/order_walkthrough'
|
18
|
-
require 'spree/testing_support/translations' unless Spree.solidus_gem_version < Gem::Version.new('2.11')
|
19
|
-
|
20
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
21
|
-
# in spec/support/ and its subdirectories.
|
22
|
-
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
23
|
-
|
24
|
-
# Requires factories defined in lib/solidus_starter_frontend/factories.rb
|
25
|
-
require 'solidus_starter_frontend/factories'
|
26
|
-
|
27
|
-
RSpec.configure do |config|
|
28
|
-
config.infer_spec_type_from_file_location!
|
29
|
-
config.use_transactional_fixtures = false
|
30
|
-
|
31
|
-
if Spree.solidus_gem_version < Gem::Version.new('2.11')
|
32
|
-
config.extend Spree::TestingSupport::AuthorizationHelpers::Request, type: :system
|
33
|
-
|
34
|
-
config.after(:each, type: :system) do |example|
|
35
|
-
missing_translations = page.body.scan(/translation missing: #{I18n.locale}\.(.*?)[\s<\"&]/)
|
36
|
-
if missing_translations.any?
|
37
|
-
puts "Found missing translations: #{missing_translations.inspect}\n"
|
38
|
-
puts "In spec: #{example.location}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
if SolidusSupport.reset_spree_preferences_deprecated?
|
44
|
-
config.before :suite do
|
45
|
-
Spree::TestingSupport::Preferences.freeze_preferences(SolidusStarterFrontend::Config)
|
46
|
-
end
|
47
|
-
else
|
48
|
-
config.before do
|
49
|
-
SolidusStarterFrontend::Config.preference_store = SolidusStarterFrontend::Config.default_preferences
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
config.before do
|
54
|
-
Rails.cache.clear
|
55
|
-
end
|
56
|
-
|
57
|
-
config.before(:each, type: :system) do
|
58
|
-
driven_by((ENV['CAPYBARA_DRIVER'] || :rack_test).to_sym)
|
59
|
-
end
|
60
|
-
|
61
|
-
config.before(:each, type: :system, js: true) do
|
62
|
-
driven_by((ENV['CAPYBARA_JS_DRIVER'] || :apparition).to_sym)
|
63
|
-
end
|
64
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
shared_context 'checkout setup' do
|
4
|
-
let!(:store) { create(:store) }
|
5
|
-
let!(:country) { create(:country, states_required: true) }
|
6
|
-
let!(:state) { create(:state, country: country) }
|
7
|
-
let!(:shipping_method) { create(:shipping_method) }
|
8
|
-
let!(:stock_location) { create(:stock_location) }
|
9
|
-
let!(:mug) { create(:product, name: "RoR Mug") }
|
10
|
-
let!(:payment_method) { create(:check_payment_method) }
|
11
|
-
let!(:zone) { create(:zone) }
|
12
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
shared_context "custom products" do
|
4
|
-
before(:each) do
|
5
|
-
create(:store)
|
6
|
-
taxonomy = FactoryBot.create(:taxonomy, name: 'Categories')
|
7
|
-
root = taxonomy.root
|
8
|
-
clothing_taxon = FactoryBot.create(:taxon, name: 'Clothing', parent_id: root.id)
|
9
|
-
bags_taxon = FactoryBot.create(:taxon, name: 'Bags', parent_id: root.id)
|
10
|
-
mugs_taxon = FactoryBot.create(:taxon, name: 'Mugs', parent_id: root.id)
|
11
|
-
|
12
|
-
taxonomy = FactoryBot.create(:taxonomy, name: 'Brands')
|
13
|
-
root = taxonomy.root
|
14
|
-
apache_taxon = FactoryBot.create(:taxon, name: 'Apache', parent_id: root.id)
|
15
|
-
rails_taxon = FactoryBot.create(:taxon, name: 'Ruby on Rails', parent_id: root.id)
|
16
|
-
ruby_taxon = FactoryBot.create(:taxon, name: 'Ruby', parent_id: root.id)
|
17
|
-
|
18
|
-
FactoryBot.create(:custom_product, name: 'Ruby on Rails Ringer T-Shirt', price: '19.99', taxons: [rails_taxon, clothing_taxon])
|
19
|
-
FactoryBot.create(:custom_product, name: 'Ruby on Rails Mug', price: '15.99', taxons: [rails_taxon, mugs_taxon])
|
20
|
-
FactoryBot.create(:custom_product, name: 'Ruby on Rails Tote', price: '15.99', taxons: [rails_taxon, bags_taxon])
|
21
|
-
FactoryBot.create(:custom_product, name: 'Ruby on Rails Bag', price: '22.99', taxons: [rails_taxon, bags_taxon])
|
22
|
-
FactoryBot.create(:custom_product, name: 'Ruby on Rails Baseball Jersey', price: '19.99', taxons: [rails_taxon, clothing_taxon])
|
23
|
-
FactoryBot.create(:custom_product, name: 'Ruby on Rails Stein', price: '16.99', taxons: [rails_taxon, mugs_taxon])
|
24
|
-
FactoryBot.create(:custom_product, name: 'Ruby on Rails Jr. Spaghetti', price: '19.99', taxons: [rails_taxon, clothing_taxon])
|
25
|
-
FactoryBot.create(:custom_product, name: 'Ruby Baseball Jersey', price: '19.99', taxons: [ruby_taxon, clothing_taxon])
|
26
|
-
FactoryBot.create(:custom_product, name: 'Apache Baseball Jersey', price: '19.99', taxons: [apache_taxon, clothing_taxon])
|
27
|
-
end
|
28
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
shared_context 'fr locale' do
|
4
|
-
before do
|
5
|
-
I18n.backend.store_translations(:fr, spree: {
|
6
|
-
i18n: { this_file_language: "Français" },
|
7
|
-
cart: 'Panier',
|
8
|
-
shopping_cart: 'Panier'
|
9
|
-
})
|
10
|
-
end
|
11
|
-
|
12
|
-
after do
|
13
|
-
I18n.locale = :en # reset locale after each spec.
|
14
|
-
I18n.reload!
|
15
|
-
end
|
16
|
-
end
|