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
@@ -9,40 +9,40 @@ describe Spree::Admin::PromotionsController, type: :controller do
|
|
9
9
|
|
10
10
|
describe "#index" do
|
11
11
|
it "succeeds" do
|
12
|
-
|
12
|
+
get :index
|
13
13
|
expect(assigns[:promotions]).to match_array [promotion2, promotion1]
|
14
14
|
end
|
15
15
|
|
16
16
|
it "assigns promotion categories" do
|
17
|
-
|
17
|
+
get :index
|
18
18
|
expect(assigns[:promotion_categories]).to match_array [category]
|
19
19
|
end
|
20
20
|
|
21
21
|
context "search" do
|
22
22
|
it "pages results" do
|
23
|
-
|
23
|
+
get :index, per_page: '1'
|
24
24
|
expect(assigns[:promotions]).to eq [promotion2]
|
25
25
|
end
|
26
26
|
|
27
27
|
it "filters by name" do
|
28
|
-
|
28
|
+
get :index, q: { name_cont: promotion1.name }
|
29
29
|
expect(assigns[:promotions]).to eq [promotion1]
|
30
30
|
end
|
31
31
|
|
32
32
|
it "filters by code" do
|
33
|
-
|
33
|
+
get :index, q: { codes_value_cont: promotion1.codes.first.value }
|
34
34
|
expect(assigns[:promotions]).to eq [promotion1]
|
35
35
|
end
|
36
36
|
|
37
37
|
it "filters by path" do
|
38
|
-
|
38
|
+
get :index, q: { path_cont: promotion1.path }
|
39
39
|
expect(assigns[:promotions]).to eq [promotion1]
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "#create" do
|
45
|
-
subject {
|
45
|
+
subject { post :create, params }
|
46
46
|
let(:params) { { promotion: { name: 'some promo' } } }
|
47
47
|
|
48
48
|
context "it succeeds" do
|
@@ -14,7 +14,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
|
|
14
14
|
let!(:inactive_stock_location) { create(:stock_location, active: false) }
|
15
15
|
|
16
16
|
subject do
|
17
|
-
|
17
|
+
get :edit, order_id: order.to_param, id: reimbursement.to_param
|
18
18
|
end
|
19
19
|
|
20
20
|
it "loads all the active stock locations" do
|
@@ -32,7 +32,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
|
|
32
32
|
before { return_item.receive! }
|
33
33
|
|
34
34
|
subject do
|
35
|
-
|
35
|
+
post :create, order_id: order.to_param, build_from_customer_return_id: customer_return.id
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'creates the reimbursement' do
|
@@ -59,7 +59,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
|
|
59
59
|
it 'redirects to the referer' do
|
60
60
|
request.env["HTTP_REFERER"] = referer
|
61
61
|
expect {
|
62
|
-
|
62
|
+
post :create, order_id: order.to_param
|
63
63
|
}.to_not change { Spree::Reimbursement.count }
|
64
64
|
expect(response).to redirect_to(referer)
|
65
65
|
expect(flash[:error]).to eq("something bad happened")
|
@@ -69,7 +69,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
|
|
69
69
|
context 'when a referer header is not present' do
|
70
70
|
it 'redirects to the admin root' do
|
71
71
|
expect {
|
72
|
-
|
72
|
+
post :create, order_id: order.to_param
|
73
73
|
}.to_not change { Spree::Reimbursement.count }
|
74
74
|
expect(response).to redirect_to(spree.admin_path)
|
75
75
|
expect(flash[:error]).to eq("something bad happened")
|
@@ -86,7 +86,7 @@ describe Spree::Admin::ReimbursementsController, type: :controller do
|
|
86
86
|
let(:payment) { order.payments.first }
|
87
87
|
|
88
88
|
subject do
|
89
|
-
|
89
|
+
post :perform, order_id: order.to_param, id: reimbursement.to_param
|
90
90
|
end
|
91
91
|
|
92
92
|
it 'redirects to customer return page' do
|
@@ -44,7 +44,7 @@ describe Spree::Admin::ReportsController, type: :controller do
|
|
44
44
|
order_complete_mid_month.save!
|
45
45
|
end
|
46
46
|
|
47
|
-
subject {
|
47
|
+
subject { get :sales_total, params }
|
48
48
|
|
49
49
|
shared_examples 'sales total report' do
|
50
50
|
it 'should respond with success' do
|
@@ -126,7 +126,7 @@ describe Spree::Admin::ReportsController, type: :controller do
|
|
126
126
|
|
127
127
|
describe 'GET index' do
|
128
128
|
it 'should be ok' do
|
129
|
-
|
129
|
+
get :index
|
130
130
|
expect(response).to be_ok
|
131
131
|
end
|
132
132
|
end
|
@@ -45,7 +45,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
|
|
45
45
|
|
46
46
|
describe '#new' do
|
47
47
|
subject do
|
48
|
-
|
48
|
+
get :new
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'succeeds' do
|
@@ -58,7 +58,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
|
|
58
58
|
let(:widget) { Widget.create!(name: 'a widget') }
|
59
59
|
|
60
60
|
subject do
|
61
|
-
|
61
|
+
get :edit, id: widget.to_param
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'succeeds' do
|
@@ -72,7 +72,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
|
|
72
72
|
{ widget: { name: 'a widget' } }
|
73
73
|
end
|
74
74
|
|
75
|
-
subject {
|
75
|
+
subject { post :create, params }
|
76
76
|
|
77
77
|
it 'creates the resource' do
|
78
78
|
expect { subject }.to change { Widget.count }.by(1)
|
@@ -112,7 +112,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
|
|
112
112
|
}
|
113
113
|
end
|
114
114
|
|
115
|
-
subject {
|
115
|
+
subject { put :update, params }
|
116
116
|
|
117
117
|
it 'updates the resource' do
|
118
118
|
expect { subject }.to change { widget.reload.name }.from('a widget').to('widget renamed')
|
@@ -138,7 +138,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
|
|
138
138
|
let(:params) { { id: widget.id } }
|
139
139
|
|
140
140
|
subject {
|
141
|
-
|
141
|
+
delete :destroy, params
|
142
142
|
}
|
143
143
|
|
144
144
|
it 'destroys the resource' do
|
@@ -151,7 +151,7 @@ describe Spree::Admin::WidgetsController, type: :controller do
|
|
151
151
|
let(:widget_2) { Widget.create!(name: 'widget 2', position: 2) }
|
152
152
|
|
153
153
|
subject do
|
154
|
-
|
154
|
+
post :update_positions, id: widget_1.to_param,
|
155
155
|
positions: { widget_1.id => '2', widget_2.id => '1' }, format: 'js'
|
156
156
|
end
|
157
157
|
|
@@ -19,7 +19,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
|
|
19
19
|
let(:return_authorization) { return_item.return_authorization }
|
20
20
|
|
21
21
|
it "loads all the active rma reasons" do
|
22
|
-
|
22
|
+
get :edit, id: return_authorization.to_param, order_id: return_authorization.order.to_param
|
23
23
|
expect(assigns(:reasons)).to include(return_reason)
|
24
24
|
expect(assigns(:reasons)).to include(inactive_rma_reason)
|
25
25
|
expect(assigns(:reasons)).not_to include(other_inactive_rma_reason)
|
@@ -30,14 +30,14 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
|
|
30
30
|
let(:return_authorization) { create(:return_authorization, reason: return_reason) }
|
31
31
|
|
32
32
|
it "loads all the active rma reasons" do
|
33
|
-
|
33
|
+
get :edit, id: return_authorization.to_param, order_id: return_authorization.order.to_param
|
34
34
|
expect(assigns(:reasons)).to eq [return_reason]
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
context "return authorization doesn't have an associated reason" do
|
39
39
|
it "loads all the active rma reasons" do
|
40
|
-
|
40
|
+
get :new, order_id: order.to_param
|
41
41
|
expect(assigns(:reasons)).to eq [return_reason]
|
42
42
|
end
|
43
43
|
end
|
@@ -68,14 +68,14 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
context '#new' do
|
71
|
-
subject {
|
71
|
+
subject { get :new, order_id: order.to_param }
|
72
72
|
|
73
73
|
include_context 'without existing return items'
|
74
74
|
end
|
75
75
|
|
76
76
|
context '#edit' do
|
77
77
|
subject do
|
78
|
-
|
78
|
+
get :edit, {
|
79
79
|
id: return_authorization.to_param,
|
80
80
|
order_id: order.to_param
|
81
81
|
}
|
@@ -89,7 +89,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
|
|
89
89
|
|
90
90
|
context '#create failed' do
|
91
91
|
subject do
|
92
|
-
|
92
|
+
post :create, {
|
93
93
|
return_authorization: { stock_location_id: nil }, # return authorization requires valid stock location, so this will fail
|
94
94
|
order_id: order.to_param
|
95
95
|
}
|
@@ -100,7 +100,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
|
|
100
100
|
|
101
101
|
context '#update failed' do
|
102
102
|
subject do
|
103
|
-
|
103
|
+
put :update, {
|
104
104
|
return_authorization: { stock_location_id: nil }, # return authorization requires valid stock location, so this will fail
|
105
105
|
id: return_authorization.to_param,
|
106
106
|
order_id: order.to_param
|
@@ -121,7 +121,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
|
|
121
121
|
let!(:second_active_reimbursement_type) { create(:reimbursement_type) }
|
122
122
|
|
123
123
|
before do
|
124
|
-
|
124
|
+
get :new, order_id: order.to_param
|
125
125
|
end
|
126
126
|
|
127
127
|
it "loads all the active reimbursement types" do
|
@@ -136,7 +136,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
|
|
136
136
|
let!(:inactive_stock_location) { create(:stock_location, active: false) }
|
137
137
|
|
138
138
|
before do
|
139
|
-
|
139
|
+
get :new, order_id: order.to_param
|
140
140
|
end
|
141
141
|
|
142
142
|
it "loads all the active stock locations" do
|
@@ -148,7 +148,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
|
|
148
148
|
context '#create' do
|
149
149
|
let(:stock_location) { create(:stock_location) }
|
150
150
|
|
151
|
-
subject {
|
151
|
+
subject { post :create, params }
|
152
152
|
|
153
153
|
let(:params) do
|
154
154
|
{
|
@@ -188,7 +188,7 @@ describe Spree::Admin::ReturnAuthorizationsController, type: :controller do
|
|
188
188
|
}
|
189
189
|
end
|
190
190
|
|
191
|
-
subject {
|
191
|
+
subject { put :update, params }
|
192
192
|
|
193
193
|
context "adding an item" do
|
194
194
|
let(:return_items_params) do
|
@@ -10,7 +10,7 @@ describe Spree::Admin::ReturnItemsController, type: :controller do
|
|
10
10
|
let(:new_acceptance_status) { 'rejected' }
|
11
11
|
|
12
12
|
subject do
|
13
|
-
|
13
|
+
put :update, id: return_item.to_param, return_item: { acceptance_status: new_acceptance_status }
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'updates the return item' do
|
@@ -13,7 +13,7 @@ describe Spree::Admin::SearchController, type: :controller do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'GET #users' do
|
16
|
-
subject {
|
16
|
+
subject { get :users, { format: :json }.merge(params) }
|
17
17
|
|
18
18
|
shared_examples_for 'user found by search' do
|
19
19
|
it "should include users matching query" do
|
@@ -66,7 +66,7 @@ describe Spree::Admin::SearchController, type: :controller do
|
|
66
66
|
let!(:product_one) { create(:product, name: 'jersey') }
|
67
67
|
let!(:product_two) { create(:product, name: 'better jersey') }
|
68
68
|
|
69
|
-
subject {
|
69
|
+
subject { get :products, params }
|
70
70
|
|
71
71
|
shared_examples_for 'product search' do
|
72
72
|
it 'should respond with http success' do
|
@@ -8,7 +8,7 @@ describe Spree::Admin::ShippingMethodsController, type: :controller do
|
|
8
8
|
shipping_method = stub_model(Spree::ShippingMethod)
|
9
9
|
allow(Spree::ShippingMethod).to receive_messages find: shipping_method
|
10
10
|
expect(shipping_method.deleted_at).to be_nil
|
11
|
-
|
11
|
+
delete :destroy, id: 1
|
12
12
|
expect(shipping_method.reload.deleted_at).not_to be_nil
|
13
13
|
end
|
14
14
|
end
|
@@ -15,7 +15,7 @@ module Spree
|
|
15
15
|
before { request.env["HTTP_REFERER"] = "product_admin_page" }
|
16
16
|
|
17
17
|
subject do
|
18
|
-
|
18
|
+
post :create, { variant_id: variant, stock_location_id: stock_location, stock_movement: { quantity: 1, stock_item_id: stock_item.id } }
|
19
19
|
end
|
20
20
|
|
21
21
|
it "creates a stock movement with originator" do
|
@@ -31,7 +31,7 @@ module Spree
|
|
31
31
|
|
32
32
|
context "with product_slug param" do
|
33
33
|
it "scopes the variants by the product" do
|
34
|
-
|
34
|
+
get :index, product_slug: variant_1.product.slug
|
35
35
|
expect(assigns(:variants)).to include variant_1
|
36
36
|
expect(assigns(:variants)).not_to include variant_2
|
37
37
|
end
|
@@ -39,7 +39,7 @@ module Spree
|
|
39
39
|
|
40
40
|
context "without product_slug params" do
|
41
41
|
it "allows all accessible variants to be returned" do
|
42
|
-
|
42
|
+
get :index
|
43
43
|
expect(assigns(:variants)).to include variant_1
|
44
44
|
expect(assigns(:variants)).to include variant_2
|
45
45
|
end
|
@@ -8,7 +8,7 @@ module Spree
|
|
8
8
|
# Regression for https://github.com/spree/spree/issues/4272
|
9
9
|
context "with no countries present" do
|
10
10
|
it "cannot create a new stock location" do
|
11
|
-
|
11
|
+
get :new
|
12
12
|
expect(flash[:error]).to eq(Spree.t(:stock_locations_need_a_default_country))
|
13
13
|
expect(response).to redirect_to(spree.admin_stock_locations_path)
|
14
14
|
end
|
@@ -22,7 +22,7 @@ module Spree
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "can create a new stock location" do
|
25
|
-
|
25
|
+
get :new
|
26
26
|
expect(response).to be_success
|
27
27
|
end
|
28
28
|
end
|
@@ -33,7 +33,7 @@ module Spree
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "can create a new stock location" do
|
36
|
-
|
36
|
+
get :new
|
37
37
|
expect(response).to be_success
|
38
38
|
end
|
39
39
|
end
|
@@ -40,24 +40,24 @@ module Spree
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "doesn't display stock locations the user doesn't have access to" do
|
43
|
-
|
43
|
+
get :index
|
44
44
|
expect(assigns(:stock_locations)).to match_array [warehouse, ny_store, la_store]
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
it "searches by stock location" do
|
49
|
-
|
49
|
+
get :index, q: { source_location_id_or_destination_location_id_eq: ny_store.id }
|
50
50
|
expect(assigns(:stock_transfers).count).to eq 1
|
51
51
|
expect(assigns(:stock_transfers)).to include(stock_transfer1)
|
52
52
|
end
|
53
53
|
|
54
54
|
it "filters the closed stock transfers" do
|
55
|
-
|
55
|
+
get :index, q: { closed_at_null: '1' }
|
56
56
|
expect(assigns(:stock_transfers)).to match_array [stock_transfer1]
|
57
57
|
end
|
58
58
|
|
59
59
|
it "doesn't filter any stock transfers" do
|
60
|
-
|
60
|
+
get :index, q: { closed_at_null: '0' }
|
61
61
|
expect(assigns(:stock_transfers)).to match_array [stock_transfer1, stock_transfer2]
|
62
62
|
end
|
63
63
|
end
|
@@ -66,7 +66,7 @@ module Spree
|
|
66
66
|
let(:warehouse) { StockLocation.create(name: "Warehouse", active: false) }
|
67
67
|
|
68
68
|
subject do
|
69
|
-
|
69
|
+
post :create, stock_transfer: { source_location_id: warehouse.id, description: nil }
|
70
70
|
end
|
71
71
|
|
72
72
|
context "user doesn't have read access to the selected stock location" do
|
@@ -101,7 +101,7 @@ module Spree
|
|
101
101
|
# Regression spec for Solidus issue #1087
|
102
102
|
context "missing source_stock_location parameter" do
|
103
103
|
subject do
|
104
|
-
|
104
|
+
post :create, stock_transfer: { source_location_id: nil, description: nil }
|
105
105
|
end
|
106
106
|
|
107
107
|
it "sets a flash error" do
|
@@ -118,7 +118,7 @@ module Spree
|
|
118
118
|
let(:parameters) { { id: transfer_with_items.to_param } }
|
119
119
|
|
120
120
|
subject do
|
121
|
-
|
121
|
+
get :receive, parameters
|
122
122
|
end
|
123
123
|
|
124
124
|
context 'stock transfer is not receivable' do
|
@@ -171,7 +171,7 @@ module Spree
|
|
171
171
|
end
|
172
172
|
|
173
173
|
subject do
|
174
|
-
|
174
|
+
put :finalize, id: transfer_with_items.to_param
|
175
175
|
end
|
176
176
|
|
177
177
|
context 'stock transfer is not finalizable' do
|
@@ -229,7 +229,7 @@ module Spree
|
|
229
229
|
end
|
230
230
|
|
231
231
|
subject do
|
232
|
-
|
232
|
+
put :close, id: transfer_with_items.to_param
|
233
233
|
end
|
234
234
|
|
235
235
|
context 'stock transfer is not receivable' do
|
@@ -321,7 +321,7 @@ module Spree
|
|
321
321
|
let(:warehouse_stock_item) { warehouse.stock_items.find_by(variant: transfer_variant) }
|
322
322
|
let(:ny_stock_item) { ny_store.stock_items.find_by(variant: transfer_variant) }
|
323
323
|
|
324
|
-
subject {
|
324
|
+
subject { put :ship, id: stock_transfer.number }
|
325
325
|
|
326
326
|
before do
|
327
327
|
warehouse_stock_item.set_count_on_hand(1)
|
@@ -20,7 +20,7 @@ describe Spree::Admin::StoreCreditsController do
|
|
20
20
|
let!(:store_credit) { create(:store_credit, user: user, category: a_credit_category) }
|
21
21
|
let!(:event) { create(:store_credit_auth_event, store_credit: store_credit, created_at: 5.days.ago) }
|
22
22
|
|
23
|
-
before {
|
23
|
+
before { get :show, user_id: user.id, id: store_credit.id }
|
24
24
|
|
25
25
|
it "sets the store_credit variable to a new store credit model" do
|
26
26
|
expect(assigns(:store_credit)).to eq store_credit
|
@@ -33,12 +33,12 @@ describe Spree::Admin::StoreCreditsController do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "#new" do
|
36
|
-
before {
|
36
|
+
before { get :new, user_id: create(:user).id }
|
37
37
|
it { expect(assigns(:credit_categories)).to eq [a_credit_category, b_credit_category] }
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "#create" do
|
41
|
-
subject {
|
41
|
+
subject { post :create, parameters }
|
42
42
|
|
43
43
|
before {
|
44
44
|
allow(controller).to receive_messages(try_spree_current_user: admin_user)
|
@@ -94,7 +94,7 @@ describe Spree::Admin::StoreCreditsController do
|
|
94
94
|
describe "#edit_amount" do
|
95
95
|
let!(:store_credit) { create(:store_credit, user: user, category: a_credit_category) }
|
96
96
|
|
97
|
-
before {
|
97
|
+
before { get :edit_amount, user_id: user.id, id: store_credit.id }
|
98
98
|
|
99
99
|
it_behaves_like "update reason loader"
|
100
100
|
|
@@ -106,7 +106,7 @@ describe Spree::Admin::StoreCreditsController do
|
|
106
106
|
describe "#edit_validity" do
|
107
107
|
let!(:store_credit) { create(:store_credit, user: user, category: a_credit_category) }
|
108
108
|
|
109
|
-
before {
|
109
|
+
before { get :edit_validity, user_id: user.id, id: store_credit.id }
|
110
110
|
|
111
111
|
it_behaves_like "update reason loader"
|
112
112
|
|
@@ -119,7 +119,7 @@ describe Spree::Admin::StoreCreditsController do
|
|
119
119
|
let(:memo) { "New memo" }
|
120
120
|
let!(:store_credit) { create(:store_credit, user: user) }
|
121
121
|
|
122
|
-
subject {
|
122
|
+
subject { put :update, parameters.merge(format: :json) }
|
123
123
|
|
124
124
|
before { allow(controller).to receive_messages(try_spree_current_user: admin_user) }
|
125
125
|
|
@@ -141,7 +141,7 @@ describe Spree::Admin::StoreCreditsController do
|
|
141
141
|
it "returns a success message" do
|
142
142
|
subject
|
143
143
|
expect(response).to have_http_status(:ok)
|
144
|
-
expect(JSON.parse(response.body)['message']).to match("Store
|
144
|
+
expect(JSON.parse(response.body)['message']).to match("Store Credit has been successfully updated!")
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
@@ -182,7 +182,7 @@ describe Spree::Admin::StoreCreditsController do
|
|
182
182
|
}
|
183
183
|
end
|
184
184
|
|
185
|
-
subject {
|
185
|
+
subject { put :update_amount, parameters }
|
186
186
|
|
187
187
|
before { allow(controller).to receive_messages(try_spree_current_user: admin_user) }
|
188
188
|
|
@@ -226,7 +226,7 @@ describe Spree::Admin::StoreCreditsController do
|
|
226
226
|
context "the store credit has not been used" do
|
227
227
|
it "sets a success message in the flash" do
|
228
228
|
subject
|
229
|
-
expect(flash.now[:success]).to match "Store
|
229
|
+
expect(flash.now[:success]).to match "Store Credit has been successfully updated!"
|
230
230
|
end
|
231
231
|
|
232
232
|
it "does not create a new store credit" do
|
@@ -272,7 +272,7 @@ describe Spree::Admin::StoreCreditsController do
|
|
272
272
|
}
|
273
273
|
end
|
274
274
|
|
275
|
-
subject {
|
275
|
+
subject { put :invalidate, parameters }
|
276
276
|
|
277
277
|
it "attempts to invalidate the store credit" do
|
278
278
|
expect { subject }.to change { store_credit.reload.invalidated_at }.from(nil)
|