solidus_backend 1.3.2 → 1.4.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +38 -0
- data/app/assets/javascripts/spree/backend/components/tooltips.js +2 -0
- data/app/assets/javascripts/spree/backend/product_picker.js +2 -2
- data/app/assets/javascripts/spree/backend/routes.js +0 -1
- data/app/assets/javascripts/spree/backend/shipments.js +147 -118
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +16 -14
- data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +1 -1
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb +1 -1
- data/app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs +1 -1
- data/app/assets/javascripts/spree/backend/templates/variants/split.hbs +25 -27
- data/app/assets/javascripts/spree/backend/user_picker.js +14 -8
- data/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss +3 -3
- data/app/assets/stylesheets/spree/backend/components/_breadcrumb.scss +4 -0
- data/app/assets/stylesheets/spree/backend/components/_date-picker.scss +0 -1
- data/app/assets/stylesheets/spree/backend/components/_hint.scss +3 -0
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +0 -1
- data/app/assets/stylesheets/spree/backend/components/_progress.scss +5 -2
- data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +14 -5
- data/app/assets/stylesheets/spree/backend/components/_states.scss +1 -2
- data/app/assets/stylesheets/spree/backend/globals/_mixins.css +2 -0
- data/app/assets/stylesheets/spree/backend/globals/mixins/_line_through.scss +22 -0
- data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +12 -3
- data/app/assets/stylesheets/spree/backend/sections/_products.scss +25 -7
- data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +0 -1
- data/app/assets/stylesheets/spree/backend/sections/_transfer_items.scss +0 -1
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +4 -6
- data/app/assets/stylesheets/spree/backend/shared/_header.scss +5 -2
- data/app/assets/stylesheets/spree/backend/shared/_layout.scss +36 -3
- data/app/assets/stylesheets/spree/backend/shared/_tables.scss +1 -3
- data/app/assets/stylesheets/spree/backend/shared/_typography.scss +0 -2
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +3 -1
- data/app/controllers/spree/admin/cancellations_controller.rb +1 -1
- data/app/controllers/spree/admin/general_settings_controller.rb +0 -6
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +7 -0
- data/app/controllers/spree/admin/orders_controller.rb +1 -1
- data/app/controllers/spree/admin/payment_methods_controller.rb +8 -3
- data/app/controllers/spree/admin/payments_controller.rb +12 -5
- data/app/controllers/spree/admin/products_controller.rb +1 -1
- data/app/controllers/spree/admin/refunds_controller.rb +1 -1
- data/app/controllers/spree/admin/reimbursements_controller.rb +1 -1
- data/app/controllers/spree/admin/root_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_items_controller.rb +0 -8
- data/app/controllers/spree/admin/stock_transfers_controller.rb +6 -6
- data/app/controllers/spree/admin/users_controller.rb +7 -3
- data/app/helpers/spree/admin/base_helper.rb +11 -0
- data/app/helpers/spree/admin/navigation_helper.rb +46 -3
- data/app/helpers/spree/admin/orders_helper.rb +0 -1
- data/app/helpers/spree/admin/stock_locations_helper.rb +1 -5
- data/app/models/spree/backend_configuration.rb +100 -0
- data/app/views/spree/admin/adjustment_reasons/edit.html.erb +4 -7
- data/app/views/spree/admin/adjustment_reasons/index.html.erb +4 -4
- data/app/views/spree/admin/adjustment_reasons/new.html.erb +4 -4
- data/app/views/spree/admin/adjustments/edit.html.erb +4 -6
- data/app/views/spree/admin/adjustments/index.html.erb +3 -6
- data/app/views/spree/admin/adjustments/new.html.erb +5 -6
- data/app/views/spree/admin/cancellations/index.html.erb +4 -3
- data/app/views/spree/admin/countries/edit.html.erb +4 -6
- data/app/views/spree/admin/countries/index.html.erb +4 -4
- data/app/views/spree/admin/countries/new.html.erb +4 -4
- data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +1 -1
- data/app/views/spree/admin/customer_returns/edit.html.erb +4 -6
- data/app/views/spree/admin/customer_returns/index.html.erb +2 -5
- data/app/views/spree/admin/customer_returns/new.html.erb +5 -6
- data/app/views/spree/admin/general_settings/edit.html.erb +4 -28
- data/app/views/spree/admin/images/edit.html.erb +6 -2
- data/app/views/spree/admin/images/index.html.erb +3 -0
- data/app/views/spree/admin/images/new.html.erb +3 -3
- data/app/views/spree/admin/log_entries/index.html.erb +4 -8
- data/app/views/spree/admin/option_types/edit.html.erb +7 -9
- data/app/views/spree/admin/option_types/index.html.erb +4 -4
- data/app/views/spree/admin/orders/_shipment.html.erb +4 -1
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +4 -1
- data/app/views/spree/admin/orders/cart.html.erb +4 -8
- data/app/views/spree/admin/orders/confirm.html.erb +3 -4
- data/app/views/spree/admin/orders/confirm/_payments.html.erb +1 -1
- data/app/views/spree/admin/orders/confirm_advance.html.erb +3 -4
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
- data/app/views/spree/admin/orders/customer_details/edit.html.erb +2 -4
- data/app/views/spree/admin/orders/customer_details/show.html.erb +3 -5
- data/app/views/spree/admin/orders/edit.html.erb +1 -8
- data/app/views/spree/admin/orders/index.html.erb +11 -5
- data/app/views/spree/admin/payment_methods/edit.html.erb +5 -7
- data/app/views/spree/admin/payment_methods/index.html.erb +6 -5
- data/app/views/spree/admin/payment_methods/new.html.erb +6 -7
- data/app/views/spree/admin/payments/_capture_events.html.erb +1 -1
- data/app/views/spree/admin/payments/credit.html.erb +3 -3
- data/app/views/spree/admin/payments/index.html.erb +4 -7
- data/app/views/spree/admin/payments/new.html.erb +4 -5
- data/app/views/spree/admin/payments/show.html.erb +4 -7
- data/app/views/spree/admin/prices/_form.html.erb +1 -0
- data/app/views/spree/admin/prices/index.html.erb +2 -2
- data/app/views/spree/admin/product_properties/index.html.erb +3 -1
- data/app/views/spree/admin/products/_form.html.erb +11 -18
- data/app/views/spree/admin/products/_properties_form.erb +1 -1
- data/app/views/spree/admin/products/edit.html.erb +3 -2
- data/app/views/spree/admin/products/index.html.erb +19 -28
- data/app/views/spree/admin/products/new.html.erb +4 -2
- data/app/views/spree/admin/promotion_categories/edit.html.erb +4 -3
- data/app/views/spree/admin/promotion_categories/index.html.erb +4 -4
- data/app/views/spree/admin/promotion_categories/new.html.erb +4 -3
- data/app/views/spree/admin/promotion_rules/create.js.erb +1 -1
- data/app/views/spree/admin/promotions/_actions.html.erb +3 -3
- data/app/views/spree/admin/promotions/_rules.html.erb +2 -2
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +1 -1
- data/app/views/spree/admin/promotions/edit.html.erb +4 -5
- data/app/views/spree/admin/promotions/index.html.erb +3 -5
- data/app/views/spree/admin/promotions/new.html.erb +3 -3
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +2 -2
- data/app/views/spree/admin/properties/edit.html.erb +3 -6
- data/app/views/spree/admin/properties/index.html.erb +5 -5
- data/app/views/spree/admin/prototypes/_form.html.erb +3 -3
- data/app/views/spree/admin/prototypes/_prototypes.html.erb +1 -1
- data/app/views/spree/admin/prototypes/edit.html.erb +3 -6
- data/app/views/spree/admin/prototypes/index.html.erb +4 -4
- data/app/views/spree/admin/prototypes/show.html.erb +2 -2
- data/app/views/spree/admin/refund_reasons/edit.html.erb +4 -4
- data/app/views/spree/admin/refund_reasons/index.html.erb +5 -4
- data/app/views/spree/admin/refund_reasons/new.html.erb +5 -4
- data/app/views/spree/admin/refunds/edit.html.erb +5 -6
- data/app/views/spree/admin/refunds/new.html.erb +6 -6
- data/app/views/spree/admin/reimbursement_types/index.html.erb +4 -3
- data/app/views/spree/admin/reimbursements/edit.html.erb +5 -6
- data/app/views/spree/admin/reimbursements/index.html.erb +2 -4
- data/app/views/spree/admin/reimbursements/show.html.erb +3 -4
- data/app/views/spree/admin/reports/index.html.erb +2 -3
- data/app/views/spree/admin/reports/sales_total.html.erb +2 -4
- data/app/views/spree/admin/return_authorizations/edit.html.erb +15 -16
- data/app/views/spree/admin/return_authorizations/index.html.erb +3 -5
- data/app/views/spree/admin/return_authorizations/new.html.erb +5 -6
- data/app/views/spree/admin/return_reasons/edit.html.erb +3 -2
- data/app/views/spree/admin/return_reasons/index.html.erb +3 -1
- data/app/views/spree/admin/return_reasons/new.html.erb +4 -2
- data/app/views/spree/admin/shared/_areas_tabs.html.erb +3 -3
- data/app/views/spree/admin/shared/_configuration_menu.html.erb +2 -2
- data/app/views/spree/admin/shared/_edit_resource_links.html.erb +2 -2
- data/app/views/spree/admin/shared/_head.html.erb +1 -8
- data/app/views/spree/admin/shared/_header.html.erb +8 -12
- data/app/views/spree/admin/shared/_new_resource_links.html.erb +2 -2
- data/app/views/spree/admin/shared/_no_objects_found.html.erb +1 -1
- data/app/views/spree/admin/shared/_order_submenu.html.erb +10 -10
- data/app/views/spree/admin/shared/_order_summary.html.erb +1 -1
- data/app/views/spree/admin/shared/_order_tabs.html.erb +3 -3
- data/app/views/spree/admin/shared/_payments_tabs.html.erb +1 -1
- data/app/views/spree/admin/shared/_product_sub_menu.html.erb +2 -2
- data/app/views/spree/admin/shared/_product_tabs.html.erb +8 -9
- data/app/views/spree/admin/shared/_report_criteria.html.erb +2 -2
- data/app/views/spree/admin/shared/_report_order_criteria.html.erb +2 -2
- data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +4 -4
- data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +5 -5
- data/app/views/spree/admin/shared/_shipping_tabs.html.erb +4 -3
- data/app/views/spree/admin/shared/_sidebar.html.erb +1 -1
- data/app/views/spree/admin/shared/_tabs.html.erb +12 -37
- data/app/views/spree/admin/shared/_taxes_tabs.html.erb +2 -2
- data/app/views/spree/admin/shared/_variant_search.html.erb +1 -1
- data/app/views/spree/admin/shared/named_types/_edit.html.erb +5 -5
- data/app/views/spree/admin/shared/named_types/_index.html.erb +5 -4
- data/app/views/spree/admin/shared/named_types/_new.html.erb +5 -4
- data/app/views/spree/admin/shipping_categories/edit.html.erb +5 -6
- data/app/views/spree/admin/shipping_categories/index.html.erb +5 -4
- data/app/views/spree/admin/shipping_categories/new.html.erb +5 -6
- data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
- data/app/views/spree/admin/shipping_methods/edit.html.erb +5 -6
- data/app/views/spree/admin/shipping_methods/index.html.erb +5 -5
- data/app/views/spree/admin/shipping_methods/new.html.erb +5 -6
- data/app/views/spree/admin/states/edit.html.erb +5 -6
- data/app/views/spree/admin/states/index.html.erb +5 -4
- data/app/views/spree/admin/states/new.html.erb +5 -3
- data/app/views/spree/admin/stock_items/index.html.erb +4 -7
- data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +2 -2
- data/app/views/spree/admin/stock_locations/edit.html.erb +5 -5
- data/app/views/spree/admin/stock_locations/index.html.erb +16 -9
- data/app/views/spree/admin/stock_locations/new.html.erb +5 -4
- data/app/views/spree/admin/stock_movements/index.html.erb +3 -4
- data/app/views/spree/admin/stock_movements/new.html.erb +2 -3
- data/app/views/spree/admin/stock_transfers/_location.html.erb +7 -0
- data/app/views/spree/admin/stock_transfers/_transfer_item_table.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/edit.html.erb +5 -6
- data/app/views/spree/admin/stock_transfers/index.html.erb +5 -5
- data/app/views/spree/admin/stock_transfers/new.html.erb +6 -8
- data/app/views/spree/admin/stock_transfers/receive.html.erb +4 -12
- data/app/views/spree/admin/stock_transfers/show.html.erb +6 -12
- data/app/views/spree/admin/stock_transfers/tracking_info.html.erb +5 -13
- data/app/views/spree/admin/store_credits/edit_amount.html.erb +6 -4
- data/app/views/spree/admin/store_credits/edit_validity.html.erb +8 -6
- data/app/views/spree/admin/store_credits/index.html.erb +5 -5
- data/app/views/spree/admin/store_credits/new.html.erb +5 -4
- data/app/views/spree/admin/store_credits/show.html.erb +5 -4
- data/app/views/spree/admin/style_guide/topics/typography/_icons.html.erb +2 -2
- data/app/views/spree/admin/tax_categories/edit.html.erb +5 -4
- data/app/views/spree/admin/tax_categories/index.html.erb +5 -4
- data/app/views/spree/admin/tax_categories/new.html.erb +5 -4
- data/app/views/spree/admin/tax_rates/edit.html.erb +5 -6
- data/app/views/spree/admin/tax_rates/index.html.erb +5 -4
- data/app/views/spree/admin/tax_rates/new.html.erb +5 -6
- data/app/views/spree/admin/taxonomies/edit.erb +7 -9
- data/app/views/spree/admin/taxonomies/index.html.erb +4 -4
- data/app/views/spree/admin/taxonomies/new.html.erb +5 -7
- data/app/views/spree/admin/taxons/edit.html.erb +5 -6
- data/app/views/spree/admin/taxons/index.html.erb +2 -3
- data/app/views/spree/admin/trackers/edit.html.erb +5 -6
- data/app/views/spree/admin/trackers/index.html.erb +4 -4
- data/app/views/spree/admin/trackers/new.html.erb +4 -6
- data/app/views/spree/admin/users/_form.html.erb +2 -2
- data/app/views/spree/admin/users/_tabs.html.erb +5 -5
- data/app/views/spree/admin/users/_user_page_actions.html.erb +1 -4
- data/app/views/spree/admin/users/addresses.html.erb +5 -4
- data/app/views/spree/admin/users/edit.html.erb +6 -6
- data/app/views/spree/admin/users/index.html.erb +4 -5
- data/app/views/spree/admin/users/items.html.erb +4 -3
- data/app/views/spree/admin/users/new.html.erb +2 -9
- data/app/views/spree/admin/users/orders.html.erb +4 -3
- data/app/views/spree/admin/variants/_form.html.erb +1 -0
- data/app/views/spree/admin/variants/edit.html.erb +4 -3
- data/app/views/spree/admin/variants/index.html.erb +10 -8
- data/app/views/spree/admin/variants/new.html.erb +5 -0
- data/app/views/spree/admin/zones/_country_members.html.erb +2 -2
- data/app/views/spree/admin/zones/_state_members.html.erb +2 -2
- data/app/views/spree/admin/zones/edit.html.erb +5 -6
- data/app/views/spree/admin/zones/index.html.erb +5 -4
- data/app/views/spree/admin/zones/new.html.erb +6 -7
- data/app/views/spree/layouts/admin.html.erb +28 -15
- data/config/initializers/form_builder.rb +6 -0
- data/config/routes.rb +2 -6
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +4 -4
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +5 -5
- data/spec/controllers/spree/admin/orders_controller_spec.rb +28 -28
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +5 -5
- data/spec/controllers/spree/admin/payments_controller_spec.rb +7 -7
- data/spec/controllers/spree/admin/prices_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/product_properties_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/products_controller_spec.rb +6 -6
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +7 -7
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +5 -5
- data/spec/controllers/spree/admin/reports_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/resource_controller_spec.rb +6 -6
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +11 -11
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/search_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +10 -10
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +10 -10
- data/spec/controllers/spree/admin/users_controller_spec.rb +139 -141
- data/spec/controllers/spree/admin/variants_controller_spec.rb +2 -2
- data/spec/features/admin/configuration/general_settings_spec.rb +7 -16
- data/spec/features/admin/configuration/payment_methods_spec.rb +7 -7
- data/spec/features/admin/configuration/stock_locations_spec.rb +1 -1
- data/spec/features/admin/configuration/tax_categories_spec.rb +1 -1
- data/spec/features/admin/configuration/zones_spec.rb +1 -1
- data/spec/features/admin/homepage_spec.rb +2 -2
- data/spec/features/admin/orders/adjustments_spec.rb +1 -1
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +8 -8
- data/spec/features/admin/orders/customer_details_spec.rb +20 -5
- data/spec/features/admin/orders/listing_spec.rb +97 -70
- data/spec/features/admin/orders/new_order_spec.rb +35 -6
- data/spec/features/admin/orders/order_details_spec.rb +37 -58
- data/spec/features/admin/orders/payments_spec.rb +57 -4
- data/spec/features/admin/orders/return_authorizations_spec.rb +25 -0
- data/spec/features/admin/orders/shipments_spec.rb +5 -5
- data/spec/features/admin/products/edit/products_spec.rb +1 -1
- data/spec/features/admin/products/edit/taxons_spec.rb +5 -5
- data/spec/features/admin/products/edit/variants_spec.rb +1 -1
- data/spec/features/admin/products/option_types_spec.rb +2 -2
- data/spec/features/admin/products/products_spec.rb +6 -6
- data/spec/features/admin/products/properties_spec.rb +6 -6
- data/spec/features/admin/products/prototypes_spec.rb +1 -1
- data/spec/features/admin/products/stock_management_spec.rb +5 -5
- data/spec/features/admin/promotion_adjustments_spec.rb +8 -8
- data/spec/features/admin/promotions/option_value_rule_spec.rb +4 -4
- data/spec/features/admin/promotions/product_rule_spec.rb +33 -0
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +2 -2
- data/spec/features/admin/promotions/user_rule_spec.rb +15 -0
- data/spec/features/admin/reports_spec.rb +1 -1
- data/spec/features/admin/users_spec.rb +27 -2
- data/spec/helpers/admin/base_helper_spec.rb +30 -0
- data/spec/helpers/admin/navigation_helper_spec.rb +40 -2
- data/spec/spec_helper.rb +10 -8
- data/spec/support/feature/order_feature_helper.rb +17 -0
- metadata +18 -11
- data/app/assets/javascripts/spree/backend/general_settings.js.coffee +0 -13
- data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
@@ -37,7 +37,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
37
37
|
context "#approve" do
|
38
38
|
it "approves an order" do
|
39
39
|
expect(order.contents).to receive(:approve).with(user: controller.try_spree_current_user)
|
40
|
-
|
40
|
+
put :approve, id: order.number
|
41
41
|
expect(flash[:success]).to eq Spree.t(:order_approved)
|
42
42
|
end
|
43
43
|
end
|
@@ -45,7 +45,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
45
45
|
context "#cancel" do
|
46
46
|
it "cancels an order" do
|
47
47
|
expect(order).to receive(:canceled_by).with(controller.try_spree_current_user)
|
48
|
-
|
48
|
+
put :cancel, id: order.number
|
49
49
|
expect(flash[:success]).to eq Spree.t(:order_canceled)
|
50
50
|
end
|
51
51
|
end
|
@@ -53,14 +53,14 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
53
53
|
context "#resume" do
|
54
54
|
it "resumes an order" do
|
55
55
|
expect(order).to receive(:resume!)
|
56
|
-
|
56
|
+
put :resume, id: order.number
|
57
57
|
expect(flash[:success]).to eq Spree.t(:order_resumed)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
context "pagination" do
|
62
62
|
it "can page through the orders" do
|
63
|
-
|
63
|
+
get :index, page: 2, per_page: 10
|
64
64
|
expect(assigns[:orders].offset_value).to eq(10)
|
65
65
|
expect(assigns[:orders].limit_value).to eq(10)
|
66
66
|
end
|
@@ -77,21 +77,21 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
77
77
|
expect(Spree::Core::Importer::Order).to receive(:import)
|
78
78
|
.with(nil, hash_including(created_by_id: controller.try_spree_current_user.id))
|
79
79
|
.and_return(order)
|
80
|
-
|
80
|
+
get :new
|
81
81
|
end
|
82
82
|
|
83
83
|
it "sets frontend_viewable to false" do
|
84
84
|
expect(Spree::Core::Importer::Order).to receive(:import)
|
85
85
|
.with(nil, hash_including(frontend_viewable: false ))
|
86
86
|
.and_return(order)
|
87
|
-
|
87
|
+
get :new
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should associate the order with a store" do
|
91
91
|
expect(Spree::Core::Importer::Order).to receive(:import)
|
92
92
|
.with(user, hash_including(store_id: controller.current_store.id))
|
93
93
|
.and_return(order)
|
94
|
-
|
94
|
+
get :new, { user_id: user.id }
|
95
95
|
end
|
96
96
|
|
97
97
|
context "when a user_id is passed as a parameter" do
|
@@ -102,12 +102,12 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
102
102
|
expect(Spree::Core::Importer::Order).to receive(:import)
|
103
103
|
.with(user, hash_including(created_by_id: controller.try_spree_current_user.id))
|
104
104
|
.and_return(order)
|
105
|
-
|
105
|
+
get :new, { user_id: user.id }
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should redirect to cart" do
|
110
|
-
|
110
|
+
get :new
|
111
111
|
expect(response).to redirect_to(spree.cart_admin_order_path(Spree::Order.last))
|
112
112
|
end
|
113
113
|
end
|
@@ -117,13 +117,13 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
117
117
|
it "does not refresh rates if the order is completed" do
|
118
118
|
allow(order).to receive_messages completed?: true
|
119
119
|
expect(order).not_to receive :refresh_shipment_rates
|
120
|
-
|
120
|
+
get :edit, id: order.number
|
121
121
|
end
|
122
122
|
|
123
123
|
it "does refresh the rates if the order is incomplete" do
|
124
124
|
allow(order).to receive_messages completed?: false
|
125
125
|
expect(order).to receive :refresh_shipment_rates
|
126
|
-
|
126
|
+
get :edit, id: order.number
|
127
127
|
end
|
128
128
|
|
129
129
|
context "when order does not have a ship address" do
|
@@ -135,7 +135,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
135
135
|
before { Spree::Config[:order_bill_address_used] = true }
|
136
136
|
|
137
137
|
it "should redirect to the customer details page" do
|
138
|
-
|
138
|
+
get :edit, id: order.number
|
139
139
|
expect(response).to redirect_to(spree.edit_admin_order_customer_path(order))
|
140
140
|
end
|
141
141
|
end
|
@@ -144,7 +144,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
144
144
|
before { Spree::Config[:order_bill_address_used] = false }
|
145
145
|
|
146
146
|
it "should redirect to the customer details page" do
|
147
|
-
|
147
|
+
get :edit, id: order.number
|
148
148
|
expect(response).to redirect_to(spree.edit_admin_order_customer_path(order))
|
149
149
|
end
|
150
150
|
end
|
@@ -153,7 +153,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
153
153
|
|
154
154
|
describe '#advance' do
|
155
155
|
subject do
|
156
|
-
|
156
|
+
put :advance, id: order.number
|
157
157
|
end
|
158
158
|
|
159
159
|
context 'when incomplete' do
|
@@ -199,7 +199,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
199
199
|
|
200
200
|
context '#confirm' do
|
201
201
|
subject do
|
202
|
-
|
202
|
+
get :confirm, id: order.number
|
203
203
|
end
|
204
204
|
|
205
205
|
context 'when in confirm' do
|
@@ -234,7 +234,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
234
234
|
|
235
235
|
context "#complete" do
|
236
236
|
subject do
|
237
|
-
|
237
|
+
put :complete, id: order.number
|
238
238
|
end
|
239
239
|
|
240
240
|
context 'when successful' do
|
@@ -288,7 +288,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
288
288
|
end
|
289
289
|
|
290
290
|
it "does not display duplicated results" do
|
291
|
-
|
291
|
+
get :index, q: {
|
292
292
|
line_items_variant_id_in: Spree::Order.first.variants.map(&:id)
|
293
293
|
}
|
294
294
|
expect(assigns[:orders].map(&:number).count).to eq 1
|
@@ -300,17 +300,17 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
300
300
|
let!(:finalized_adjustment) { create(:adjustment, finalized: true, adjustable: order, order: order) }
|
301
301
|
|
302
302
|
it "changes all the finalized adjustments to unfinalized" do
|
303
|
-
|
303
|
+
post :unfinalize_adjustments, id: order.number
|
304
304
|
expect(finalized_adjustment.reload.finalized).to eq(false)
|
305
305
|
end
|
306
306
|
|
307
307
|
it "sets the flash success message" do
|
308
|
-
|
308
|
+
post :unfinalize_adjustments, id: order.number
|
309
309
|
expect(flash[:success]).to eql('All adjustments successfully unfinalized!')
|
310
310
|
end
|
311
311
|
|
312
312
|
it "redirects back" do
|
313
|
-
|
313
|
+
post :unfinalize_adjustments, id: order.number
|
314
314
|
expect(response).to redirect_to(:back)
|
315
315
|
end
|
316
316
|
end
|
@@ -320,17 +320,17 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
320
320
|
let!(:not_finalized_adjustment) { create(:adjustment, finalized: false, adjustable: order, order: order) }
|
321
321
|
|
322
322
|
it "changes all the unfinalized adjustments to finalized" do
|
323
|
-
|
323
|
+
post :finalize_adjustments, id: order.number
|
324
324
|
expect(not_finalized_adjustment.reload.finalized).to eq(true)
|
325
325
|
end
|
326
326
|
|
327
327
|
it "sets the flash success message" do
|
328
|
-
|
328
|
+
post :finalize_adjustments, id: order.number
|
329
329
|
expect(flash[:success]).to eql('All adjustments successfully finalized!')
|
330
330
|
end
|
331
331
|
|
332
332
|
it "redirects back" do
|
333
|
-
|
333
|
+
post :finalize_adjustments, id: order.number
|
334
334
|
expect(response).to redirect_to(:back)
|
335
335
|
end
|
336
336
|
end
|
@@ -346,21 +346,21 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
346
346
|
|
347
347
|
it 'should grant access to users with an admin role' do
|
348
348
|
user.spree_roles << Spree::Role.find_or_create_by(name: 'admin')
|
349
|
-
|
349
|
+
get :index
|
350
350
|
expect(response).to render_template :index
|
351
351
|
end
|
352
352
|
|
353
353
|
it 'should grant access to users with an bar role' do
|
354
354
|
user.spree_roles << Spree::Role.find_or_create_by(name: 'bar')
|
355
355
|
Spree::Ability.register_ability(BarAbility)
|
356
|
-
|
356
|
+
get :index
|
357
357
|
expect(response).to render_template :index
|
358
358
|
Spree::Ability.remove_ability(BarAbility)
|
359
359
|
end
|
360
360
|
|
361
361
|
it 'should deny access to users without an admin role' do
|
362
362
|
allow(user).to receive_messages has_spree_role?: false
|
363
|
-
|
363
|
+
get :index
|
364
364
|
expect(response).to redirect_to('/unauthorized')
|
365
365
|
end
|
366
366
|
|
@@ -376,7 +376,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
376
376
|
expect(Spree::Order.complete.count).to eq 4
|
377
377
|
|
378
378
|
allow(user).to receive_messages has_spree_role?: false
|
379
|
-
|
379
|
+
get :index
|
380
380
|
expect(response).to render_template :index
|
381
381
|
expect(assigns['orders'].size).to eq 1
|
382
382
|
expect(assigns['orders'].first.number).to eq number
|
@@ -389,7 +389,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
389
389
|
|
390
390
|
it "raise active record not found" do
|
391
391
|
expect {
|
392
|
-
|
392
|
+
get :edit, id: 0
|
393
393
|
}.to raise_error ActiveRecord::RecordNotFound
|
394
394
|
end
|
395
395
|
end
|
@@ -18,7 +18,7 @@ module Spree
|
|
18
18
|
# regression test for https://github.com/spree/spree/issues/2094
|
19
19
|
it "does not clear password on update" do
|
20
20
|
expect(payment_method.preferred_password).to eq("haxme")
|
21
|
-
|
21
|
+
put :update, id: payment_method.id, payment_method: { type: payment_method.class.to_s, preferred_password: "" }
|
22
22
|
expect(response).to redirect_to(spree.edit_admin_payment_method_path(payment_method))
|
23
23
|
|
24
24
|
payment_method.reload
|
@@ -28,13 +28,13 @@ module Spree
|
|
28
28
|
|
29
29
|
context "tries to save invalid payment" do
|
30
30
|
it "doesn't break, responds nicely" do
|
31
|
-
|
31
|
+
post :create, payment_method: { name: "", type: "Spree::Gateway::Bogus" }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
it "can create a payment method of a valid type" do
|
36
36
|
expect {
|
37
|
-
|
37
|
+
post :create, payment_method: { name: "Test Method", type: "Spree::Gateway::Bogus" }
|
38
38
|
}.to change(Spree::PaymentMethod, :count).by(1)
|
39
39
|
|
40
40
|
expect(response).to be_redirect
|
@@ -43,7 +43,7 @@ module Spree
|
|
43
43
|
|
44
44
|
it "can not create a payment method of an invalid type" do
|
45
45
|
expect {
|
46
|
-
|
46
|
+
post :create, payment_method: { name: "Invalid Payment Method", type: "Spree::InvalidType" }
|
47
47
|
}.to change(Spree::PaymentMethod, :count).by(0)
|
48
48
|
|
49
49
|
expect(response).to be_redirect
|
@@ -51,7 +51,7 @@ module Spree
|
|
51
51
|
end
|
52
52
|
|
53
53
|
describe "GET index" do
|
54
|
-
subject {
|
54
|
+
subject { get :index }
|
55
55
|
|
56
56
|
let!(:first_method) { GatewayWithPassword.create! name: "First", preferred_password: "1235" }
|
57
57
|
let!(:second_method) { GatewayWithPassword.create! name: "Second", preferred_password: "1235" }
|
@@ -32,7 +32,7 @@ module Spree
|
|
32
32
|
end
|
33
33
|
|
34
34
|
before do
|
35
|
-
|
35
|
+
post :create, attributes
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should process payment correctly" do
|
@@ -81,7 +81,7 @@ module Spree
|
|
81
81
|
end
|
82
82
|
|
83
83
|
it "loads backend payment methods" do
|
84
|
-
|
84
|
+
get :new, order_id: order.number
|
85
85
|
expect(response.status).to eq(200)
|
86
86
|
expect(assigns[:payment_methods]).to include(@payment_method)
|
87
87
|
end
|
@@ -97,7 +97,7 @@ module Spree
|
|
97
97
|
|
98
98
|
context "order does not have payments" do
|
99
99
|
it "redirect to new payments page" do
|
100
|
-
|
100
|
+
get :index, { amount: 100, order_id: order.number }
|
101
101
|
expect(response).to redirect_to(spree.new_admin_order_payment_path(order))
|
102
102
|
end
|
103
103
|
end
|
@@ -108,7 +108,7 @@ module Spree
|
|
108
108
|
end
|
109
109
|
|
110
110
|
it "shows the payments page" do
|
111
|
-
|
111
|
+
get :index, { amount: 100, order_id: order.number }
|
112
112
|
expect(response.code).to eq "200"
|
113
113
|
end
|
114
114
|
end
|
@@ -121,7 +121,7 @@ module Spree
|
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should redirect to the customer details page" do
|
124
|
-
|
124
|
+
get :index, { amount: 100, order_id: order.number }
|
125
125
|
expect(response).to redirect_to(spree.edit_admin_order_customer_path(order))
|
126
126
|
end
|
127
127
|
end
|
@@ -147,7 +147,7 @@ module Spree
|
|
147
147
|
|
148
148
|
it 'allows the action' do
|
149
149
|
expect {
|
150
|
-
|
150
|
+
post(:fire, id: payment.to_param, e: 'capture', order_id: order.to_param)
|
151
151
|
}.to change { payment.reload.state }.from('checkout').to('completed')
|
152
152
|
end
|
153
153
|
|
@@ -166,7 +166,7 @@ module Spree
|
|
166
166
|
|
167
167
|
it 'does not allow the action' do
|
168
168
|
expect {
|
169
|
-
|
169
|
+
post(:fire, id: payment.to_param, e: 'capture', order_id: order.to_param)
|
170
170
|
}.to_not change { payment.reload.state }
|
171
171
|
expect(flash[:error]).to eq('Authorization Failure')
|
172
172
|
end
|
@@ -9,7 +9,7 @@ describe Spree::Admin::PricesController do
|
|
9
9
|
context "when only given a product" do
|
10
10
|
let(:product) { create(:product) }
|
11
11
|
|
12
|
-
subject {
|
12
|
+
subject { get :index, product_id: product.slug }
|
13
13
|
|
14
14
|
it { is_expected.to be_success }
|
15
15
|
|
@@ -25,7 +25,7 @@ describe Spree::Admin::PricesController do
|
|
25
25
|
let(:variant) { create(:variant) }
|
26
26
|
let(:product) { variant.product }
|
27
27
|
|
28
|
-
subject {
|
28
|
+
subject { get :index, product_id: product.slug, variant_id: variant.id }
|
29
29
|
|
30
30
|
it { is_expected.to be_success }
|
31
31
|
|
@@ -9,7 +9,7 @@ describe Spree::Admin::ProductsController, type: :controller do
|
|
9
9
|
# Regression test for https://github.com/spree/spree/issues/1259
|
10
10
|
it "can find a product by SKU" do
|
11
11
|
product = create(:product, sku: "ABC123")
|
12
|
-
|
12
|
+
get :index, q: { sku_start: "ABC123" }
|
13
13
|
expect(assigns[:collection]).not_to be_empty
|
14
14
|
expect(assigns[:collection]).to include(product)
|
15
15
|
end
|
@@ -19,7 +19,7 @@ describe Spree::Admin::ProductsController, type: :controller do
|
|
19
19
|
context "adding properties to a product" do
|
20
20
|
let!(:product) { create(:product) }
|
21
21
|
specify do
|
22
|
-
|
22
|
+
put :update, id: product.to_param, product: { product_properties_attributes: { "1" => { property_name: "Foo", value: "bar" } } }
|
23
23
|
expect(flash[:success]).to eq("Product #{product.name.inspect} has been successfully updated!")
|
24
24
|
end
|
25
25
|
end
|
@@ -53,7 +53,7 @@ describe Spree::Admin::ProductsController, type: :controller do
|
|
53
53
|
}
|
54
54
|
end
|
55
55
|
|
56
|
-
subject {
|
56
|
+
subject { put :update, payload }
|
57
57
|
|
58
58
|
it "creates a variant property rule" do
|
59
59
|
expect { subject }.to change { product.variant_property_rules.count }.by(1)
|
@@ -113,14 +113,14 @@ describe Spree::Admin::ProductsController, type: :controller do
|
|
113
113
|
}
|
114
114
|
end
|
115
115
|
|
116
|
-
subject {
|
116
|
+
subject { put :update, payload }
|
117
117
|
|
118
118
|
it "does not create any new rules" do
|
119
119
|
expect { subject }.to_not change { Spree::VariantPropertyRule.count }
|
120
120
|
end
|
121
121
|
|
122
122
|
it "replaces the rule's condition" do
|
123
|
-
expect { subject }.to change { rule.option_value_ids }.from([original_option_value.id]).to([option_value.id])
|
123
|
+
expect { subject }.to change { rule.reload.option_value_ids }.from([original_option_value.id]).to([option_value.id])
|
124
124
|
end
|
125
125
|
|
126
126
|
it "adds two values to the rule" do
|
@@ -152,7 +152,7 @@ describe Spree::Admin::ProductsController, type: :controller do
|
|
152
152
|
end
|
153
153
|
|
154
154
|
it "deletes all the variants (including master) for the product" do
|
155
|
-
|
155
|
+
delete :destroy, id: product
|
156
156
|
expect(product.reload.deleted_at).not_to be_nil
|
157
157
|
product.variants_including_master.each do |variant|
|
158
158
|
expect(variant.reload.deleted_at).not_to be_nil
|
@@ -6,14 +6,14 @@ describe Spree::Admin::PromotionActionsController, type: :controller do
|
|
6
6
|
let!(:promotion) { create(:promotion) }
|
7
7
|
|
8
8
|
it "can create a promotion action of a valid type" do
|
9
|
-
|
9
|
+
post :create, promotion_id: promotion.id, action_type: "Spree::Promotion::Actions::CreateAdjustment"
|
10
10
|
expect(response).to be_redirect
|
11
11
|
expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
|
12
12
|
expect(promotion.actions.count).to eq(1)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "can not create a promotion action of an invalid type" do
|
16
|
-
|
16
|
+
post :create, promotion_id: promotion.id, action_type: "Spree::InvalidType"
|
17
17
|
expect(response).to be_redirect
|
18
18
|
expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
|
19
19
|
expect(promotion.rules.count).to eq(0)
|
@@ -10,7 +10,7 @@ describe Spree::Admin::PromotionCodesController do
|
|
10
10
|
let!(:code3) { create(:promotion_code, promotion: promotion) }
|
11
11
|
|
12
12
|
it "can create a promotion rule of a valid type" do
|
13
|
-
|
13
|
+
get :index, promotion_id: promotion.id, format: 'csv'
|
14
14
|
expect(response).to be_success
|
15
15
|
parsed = CSV.parse(response.body, headers: true)
|
16
16
|
expect(parsed.entries.map(&:to_h)).to eq([{ "Code" => code1.value }, { "Code" => code2.value }, { "Code" => code3.value }])
|
@@ -6,14 +6,14 @@ describe Spree::Admin::PromotionRulesController, type: :controller do
|
|
6
6
|
let!(:promotion) { create(:promotion) }
|
7
7
|
|
8
8
|
it "can create a promotion rule of a valid type" do
|
9
|
-
|
9
|
+
post :create, promotion_id: promotion.id, promotion_rule: { type: "Spree::Promotion::Rules::Product" }
|
10
10
|
expect(response).to be_redirect
|
11
11
|
expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
|
12
12
|
expect(promotion.rules.count).to eq(1)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "can not create a promotion rule of an invalid type" do
|
16
|
-
|
16
|
+
post :create, promotion_id: promotion.id, promotion_rule: { type: "Spree::InvalidType" }
|
17
17
|
expect(response).to be_redirect
|
18
18
|
expect(response).to redirect_to spree.edit_admin_promotion_path(promotion)
|
19
19
|
expect(promotion.rules.count).to eq(0)
|