spree_backend 3.1.14 → 3.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/admin/logo.png +0 -0
- data/app/assets/javascripts/spree/backend/admin.js +2 -25
- data/app/assets/javascripts/spree/backend/checkouts/edit.js +2 -1
- data/app/assets/javascripts/spree/backend/line_items.js.coffee +2 -2
- data/app/assets/javascripts/spree/backend/line_items_on_order_edit.js +5 -2
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/option_value_picker.js +2 -2
- data/app/assets/javascripts/spree/backend/payments/edit.js.coffee +10 -8
- data/app/assets/javascripts/spree/backend/product_picker.js +3 -2
- data/app/assets/javascripts/spree/backend/{shipments.js.erb → shipments.js} +1 -1
- data/app/assets/javascripts/spree/backend/states.js +9 -7
- data/app/assets/javascripts/spree/backend/stock_location.js +3 -0
- data/app/assets/javascripts/spree/backend/tag_picker.js +52 -0
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/taxon_permalink_preview.js +12 -0
- data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +2 -2
- data/app/assets/javascripts/spree/backend/taxons.js.coffee +1 -1
- data/app/assets/javascripts/spree/backend/user_picker.js +4 -3
- data/app/assets/javascripts/spree/backend.js +8 -7
- data/app/assets/stylesheets/spree/backend/components/_main.scss +5 -1
- data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +7 -0
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +1 -1
- data/app/assets/stylesheets/spree/backend/spree_admin.css.scss +0 -1
- data/app/controllers/spree/admin/base_controller.rb +0 -11
- data/app/controllers/spree/admin/option_types_controller.rb +2 -14
- data/app/controllers/spree/admin/option_values_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +7 -7
- data/app/controllers/spree/admin/payment_methods_controller.rb +4 -0
- data/app/controllers/spree/admin/product_properties_controller.rb +1 -1
- data/app/controllers/spree/admin/products_controller.rb +1 -1
- data/app/controllers/spree/admin/promotion_actions_controller.rb +5 -5
- data/app/controllers/spree/admin/promotion_rules_controller.rb +6 -6
- data/app/controllers/spree/admin/promotions_controller.rb +2 -2
- data/app/controllers/spree/admin/properties_controller.rb +1 -1
- data/app/controllers/spree/admin/prototypes_controller.rb +2 -2
- data/app/controllers/spree/admin/refunds_controller.rb +1 -1
- data/app/controllers/spree/admin/reimbursement_types_controller.rb +26 -0
- data/app/controllers/spree/admin/reimbursements_controller.rb +1 -1
- data/app/controllers/spree/admin/reports_controller.rb +1 -1
- data/app/controllers/spree/admin/resource_controller.rb +8 -8
- data/app/controllers/spree/admin/return_authorizations_controller.rb +3 -3
- data/app/controllers/spree/admin/return_index_controller.rb +1 -1
- data/app/controllers/spree/admin/shipping_methods_controller.rb +2 -2
- data/app/controllers/spree/admin/states_controller.rb +1 -1
- data/app/controllers/spree/admin/stock_items_controller.rb +2 -2
- data/app/controllers/spree/admin/stock_movements_controller.rb +1 -5
- data/app/controllers/spree/admin/store_credits_controller.rb +1 -1
- data/app/controllers/spree/admin/taxons_controller.rb +1 -10
- data/app/controllers/spree/admin/users_controller.rb +5 -41
- data/app/controllers/spree/admin/variants_controller.rb +3 -1
- data/app/helpers/spree/admin/base_helper.rb +1 -6
- data/app/helpers/spree/admin/navigation_helper.rb +9 -31
- data/app/helpers/spree/admin/promotion_rules_helper.rb +12 -0
- data/app/views/kaminari/_first_page.html.erb +1 -1
- data/app/views/kaminari/_last_page.html.erb +1 -1
- data/app/views/kaminari/_next_page.html.erb +1 -1
- data/app/views/kaminari/_page.html.erb +1 -1
- data/app/views/kaminari/_paginator.html.erb +2 -4
- data/app/views/kaminari/_prev_page.html.erb +1 -1
- data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +1 -1
- data/app/views/spree/admin/adjustments/_form.html.erb +4 -4
- data/app/views/spree/admin/countries/_form.html.erb +2 -2
- data/app/views/spree/admin/countries/edit.html.erb +3 -3
- data/app/views/spree/admin/countries/index.html.erb +3 -3
- data/app/views/spree/admin/countries/new.html.erb +3 -3
- data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
- data/app/views/spree/admin/images/_form.html.erb +2 -2
- data/app/views/spree/admin/option_types/_form.html.erb +2 -2
- data/app/views/spree/admin/option_types/edit.html.erb +5 -5
- data/app/views/spree/admin/option_types/new.html.erb +3 -3
- data/app/views/spree/admin/orders/_adjustments.html.erb +6 -4
- data/app/views/spree/admin/orders/_form.html.erb +1 -1
- data/app/views/spree/admin/orders/_line_items.html.erb +8 -6
- data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +1 -1
- data/app/views/spree/admin/orders/_shipment.html.erb +9 -7
- data/app/views/spree/admin/orders/cart.html.erb +0 -4
- data/app/views/spree/admin/orders/edit.html.erb +0 -4
- data/app/views/spree/admin/orders/index.html.erb +20 -20
- data/app/views/spree/admin/payment_methods/_form.html.erb +5 -5
- data/app/views/spree/admin/payment_methods/index.html.erb +3 -3
- data/app/views/spree/admin/payments/_form.html.erb +6 -6
- data/app/views/spree/admin/payments/source_forms/_gateway.html.erb +6 -6
- data/app/views/spree/admin/products/_form.html.erb +14 -8
- data/app/views/spree/admin/products/_properties_form.erb +1 -1
- data/app/views/spree/admin/products/index.html.erb +6 -6
- data/app/views/spree/admin/products/new.html.erb +16 -16
- data/app/views/spree/admin/promotion_categories/_form.html.erb +3 -3
- data/app/views/spree/admin/promotion_categories/edit.html.erb +3 -3
- data/app/views/spree/admin/promotion_categories/index.html.erb +3 -3
- data/app/views/spree/admin/promotion_categories/new.html.erb +3 -3
- data/app/views/spree/admin/promotions/_actions.html.erb +4 -4
- data/app/views/spree/admin/promotions/_form.html.erb +10 -10
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +1 -1
- data/app/views/spree/admin/promotions/_rules.html.erb +4 -4
- data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +1 -1
- data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +2 -2
- data/app/views/spree/admin/promotions/actions/_create_line_items.html.erb +1 -1
- data/app/views/spree/admin/promotions/edit.html.erb +6 -6
- data/app/views/spree/admin/promotions/index.html.erb +5 -5
- data/app/views/spree/admin/promotions/new.html.erb +3 -3
- data/app/views/spree/admin/promotions/rules/_country.html.erb +6 -0
- data/app/views/spree/admin/promotions/rules/_landing_page.html.erb +1 -1
- data/app/views/spree/admin/promotions/rules/_product.html.erb +2 -2
- data/app/views/spree/admin/promotions/rules/_taxon.html.erb +2 -2
- data/app/views/spree/admin/properties/_form.html.erb +2 -2
- data/app/views/spree/admin/properties/edit.html.erb +3 -3
- data/app/views/spree/admin/properties/index.html.erb +6 -6
- data/app/views/spree/admin/prototypes/_prototypes.html.erb +1 -1
- data/app/views/spree/admin/prototypes/available.js.erb +1 -1
- data/app/views/spree/admin/prototypes/edit.html.erb +3 -3
- data/app/views/spree/admin/prototypes/index.html.erb +3 -3
- data/app/views/spree/admin/prototypes/new.html.erb +3 -3
- data/app/views/spree/admin/prototypes/show.html.erb +1 -1
- data/app/views/spree/admin/refunds/edit.html.erb +2 -0
- data/app/views/spree/admin/refunds/new.html.erb +2 -0
- data/app/views/spree/admin/reimbursement_types/_form.html.erb +32 -0
- data/app/views/spree/admin/reimbursement_types/edit.html.erb +11 -0
- data/app/views/spree/admin/reimbursement_types/index.html.erb +9 -0
- data/app/views/spree/admin/reimbursement_types/new.html.erb +11 -0
- data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
- data/app/views/spree/admin/reports/sales_total.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/_form.html.erb +4 -4
- data/app/views/spree/admin/return_index/customer_returns.html.erb +1 -2
- data/app/views/spree/admin/return_index/return_authorizations.html.erb +4 -4
- data/app/views/spree/admin/roles/edit.html.erb +1 -1
- data/app/views/spree/admin/roles/new.html.erb +1 -1
- data/app/views/spree/admin/shared/_calculator_fields.html.erb +2 -2
- data/app/views/spree/admin/shared/_destroy.js.erb +1 -1
- data/app/views/spree/admin/shared/_edit_resource_links.html.erb +2 -2
- data/app/views/spree/admin/shared/_head.html.erb +2 -1
- data/app/views/spree/admin/shared/_header.html.erb +4 -11
- data/app/views/spree/admin/shared/_index_table_options.html.erb +1 -1
- data/app/views/spree/admin/shared/_main_menu.html.erb +6 -0
- data/app/views/spree/admin/shared/_new_resource_links.html.erb +2 -2
- data/app/views/spree/admin/shared/_order_summary.html.erb +3 -3
- data/app/views/spree/admin/shared/_refunds.html.erb +1 -1
- data/app/views/spree/admin/shared/_report_order_criteria.html.erb +3 -3
- data/app/views/spree/admin/shared/_translations.html.erb +38 -38
- data/app/views/spree/admin/shared/{_update_order_state.js → _update_order_state.js.erb} +3 -3
- data/app/views/spree/admin/shared/named_types/_index.html.erb +2 -2
- data/app/views/spree/admin/shipping_categories/edit.html.erb +3 -3
- data/app/views/spree/admin/shipping_categories/index.html.erb +3 -3
- data/app/views/spree/admin/shipping_categories/new.html.erb +3 -3
- data/app/views/spree/admin/shipping_methods/_form.html.erb +14 -14
- data/app/views/spree/admin/shipping_methods/edit.html.erb +3 -3
- data/app/views/spree/admin/shipping_methods/index.html.erb +3 -3
- data/app/views/spree/admin/shipping_methods/new.html.erb +3 -3
- data/app/views/spree/admin/states/_form.html.erb +2 -2
- data/app/views/spree/admin/states/_state_list.html.erb +2 -2
- data/app/views/spree/admin/states/edit.html.erb +3 -3
- data/app/views/spree/admin/states/index.html.erb +3 -3
- data/app/views/spree/admin/states/new.html.erb +3 -3
- data/app/views/spree/admin/stock_locations/_form.html.erb +0 -8
- data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/edit.html.erb +3 -3
- data/app/views/spree/admin/stock_locations/index.html.erb +4 -4
- data/app/views/spree/admin/stock_locations/new.html.erb +3 -3
- data/app/views/spree/admin/stock_transfers/index.html.erb +3 -3
- data/app/views/spree/admin/stock_transfers/new.html.erb +1 -1
- data/app/views/spree/admin/stock_transfers/show.html.erb +3 -3
- data/app/views/spree/admin/tax_categories/_form.html.erb +7 -7
- data/app/views/spree/admin/tax_categories/edit.html.erb +3 -3
- data/app/views/spree/admin/tax_categories/new.html.erb +3 -3
- data/app/views/spree/admin/tax_rates/_form.html.erb +5 -5
- data/app/views/spree/admin/tax_rates/edit.html.erb +3 -3
- data/app/views/spree/admin/tax_rates/new.html.erb +3 -3
- data/app/views/spree/admin/taxonomies/_form.html.erb +2 -2
- data/app/views/spree/admin/taxonomies/_js_head.html.erb +0 -5
- data/app/views/spree/admin/taxonomies/new.html.erb +1 -1
- data/app/views/spree/admin/taxons/_form.html.erb +7 -7
- data/app/views/spree/admin/taxons/_taxon_table.html.erb +1 -1
- data/app/views/spree/admin/taxons/edit.html.erb +0 -15
- data/app/views/spree/admin/taxons/index.html.erb +1 -1
- data/app/views/spree/admin/trackers/_form.html.erb +1 -1
- data/app/views/spree/admin/trackers/edit.html.erb +3 -3
- data/app/views/spree/admin/trackers/index.html.erb +3 -3
- data/app/views/spree/admin/trackers/new.html.erb +3 -3
- data/app/views/spree/admin/users/_addresses_form.html.erb +2 -2
- data/app/views/spree/admin/users/_form.html.erb +3 -3
- data/app/views/spree/admin/users/index.html.erb +7 -7
- data/app/views/spree/admin/users/items.html.erb +2 -2
- data/app/views/spree/admin/users/new.html.erb +3 -3
- data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +24 -7
- data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +1 -0
- data/app/views/spree/admin/variants/_form.html.erb +7 -7
- data/app/views/spree/admin/variants/new.html.erb +3 -3
- data/app/views/spree/admin/zones/_country_members.html.erb +1 -1
- data/app/views/spree/admin/zones/_form.html.erb +6 -6
- data/app/views/spree/admin/zones/_state_members.html.erb +1 -1
- data/app/views/spree/admin/zones/edit.html.erb +3 -3
- data/app/views/spree/admin/zones/index.html.erb +5 -5
- data/app/views/spree/admin/zones/new.html.erb +3 -3
- data/config/routes.rb +4 -12
- data/lib/spree/backend/engine.rb +2 -6
- data/spec/controllers/spree/admin/base_controller_spec.rb +46 -0
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +185 -0
- data/spec/controllers/spree/admin/general_settings_controller_spec.rb +41 -0
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +18 -0
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +197 -0
- data/spec/controllers/spree/admin/orders_controller_spec.rb +296 -0
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +49 -0
- data/spec/controllers/spree/admin/payments_controller_spec.rb +97 -0
- data/spec/controllers/spree/admin/products_controller_spec.rb +99 -0
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +21 -0
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +21 -0
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +44 -0
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +32 -0
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +74 -0
- data/spec/controllers/spree/admin/reports_controller_spec.rb +42 -0
- data/spec/controllers/spree/admin/resource_controller_spec.rb +252 -0
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +225 -0
- data/spec/controllers/spree/admin/return_index_controller_spec.rb +37 -0
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +27 -0
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +14 -0
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +19 -0
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +41 -0
- data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +41 -0
- data/spec/controllers/spree/admin/tax_categories_controller_spec.rb +34 -0
- data/spec/controllers/spree/admin/users_controller_spec.rb +161 -0
- data/spec/controllers/spree/admin/variants_controller_spec.rb +32 -0
- data/spec/features/admin/configuration/analytics_tracker_spec.rb +47 -0
- data/spec/features/admin/configuration/countries_spec.rb +24 -0
- data/spec/features/admin/configuration/general_settings_spec.rb +44 -0
- data/spec/features/admin/configuration/payment_methods_spec.rb +63 -0
- data/spec/features/admin/configuration/roles_spec.rb +47 -0
- data/spec/features/admin/configuration/shipping_methods_spec.rb +62 -0
- data/spec/features/admin/configuration/states_spec.rb +68 -0
- data/spec/features/admin/configuration/stock_locations_spec.rb +48 -0
- data/spec/features/admin/configuration/store_credit_categories_spec.rb +50 -0
- data/spec/features/admin/configuration/tax_categories_spec.rb +56 -0
- data/spec/features/admin/configuration/tax_rates_spec.rb +18 -0
- data/spec/features/admin/configuration/zones_spec.rb +39 -0
- data/spec/features/admin/homepage_spec.rb +89 -0
- data/spec/features/admin/locale_spec.rb +31 -0
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +53 -0
- data/spec/features/admin/orders/adjustments_spec.rb +129 -0
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +47 -0
- data/spec/features/admin/orders/customer_details_spec.rb +154 -0
- data/spec/features/admin/orders/line_items_spec.rb +51 -0
- data/spec/features/admin/orders/listing_spec.rb +224 -0
- data/spec/features/admin/orders/log_entries_spec.rb +55 -0
- data/spec/features/admin/orders/new_order_spec.rb +186 -0
- data/spec/features/admin/orders/order_details_spec.rb +662 -0
- data/spec/features/admin/orders/payments_spec.rb +231 -0
- data/spec/features/admin/orders/risk_analysis_spec.rb +48 -0
- data/spec/features/admin/orders/shipments_spec.rb +64 -0
- data/spec/features/admin/orders/state_changes_spec.rb +21 -0
- data/spec/features/admin/products/edit/images_spec.rb +86 -0
- data/spec/features/admin/products/edit/products_spec.rb +64 -0
- data/spec/features/admin/products/edit/taxons_spec.rb +41 -0
- data/spec/features/admin/products/edit/variants_spec.rb +56 -0
- data/spec/features/admin/products/option_types_spec.rb +114 -0
- data/spec/features/admin/products/products_spec.rb +445 -0
- data/spec/features/admin/products/properties_spec.rb +147 -0
- data/spec/features/admin/products/prototypes_spec.rb +112 -0
- data/spec/features/admin/products/stock_management_spec.rb +124 -0
- data/spec/features/admin/products/taxonomies_spec.rb +52 -0
- data/spec/features/admin/products/variant_spec.rb +50 -0
- data/spec/features/admin/promotions/adjustments_spec.rb +259 -0
- data/spec/features/admin/promotions/option_value_rule_spec.rb +70 -0
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +70 -0
- data/spec/features/admin/refund_reasons/refund_reasons_spec.rb +57 -0
- data/spec/features/admin/reimbursement_type/edit_reimbursement_type_spec.rb +36 -0
- data/spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb +62 -0
- data/spec/features/admin/reports_spec.rb +61 -0
- data/spec/features/admin/return_authorization_reasons/return_authorization_reasons_spec.rb +63 -0
- data/spec/features/admin/returns/customer_returns_spec.rb +80 -0
- data/spec/features/admin/returns/return_authorizations_spec.rb +152 -0
- data/spec/features/admin/stock_transfer_spec.rb +75 -0
- data/spec/features/admin/store_credits_spec.rb +93 -0
- data/spec/features/admin/taxons_spec.rb +47 -0
- data/spec/features/admin/users_spec.rb +286 -0
- data/spec/helpers/admin/base_helper_spec.rb +30 -0
- data/spec/helpers/admin/navigation_helper_spec.rb +111 -0
- data/spec/helpers/admin/promotion_rules_helper_spec.rb +12 -0
- data/spec/helpers/admin/stock_movements_helper_spec.rb +30 -0
- data/spec/models/spree/resource_spec.rb +48 -0
- data/spec/routing/admin_path_spec.rb +22 -0
- data/spec/spec_helper.rb +144 -0
- data/spec/support/appear_before_matcher.rb +8 -0
- data/spec/support/ror_ringer.jpeg +0 -0
- data/spec/test_views/spree/admin/submodule/posts/edit.html.erb +1 -0
- data/spec/test_views/spree/admin/submodule/posts/new.html.erb +1 -0
- data/spec/test_views/spree/admin/widgets/edit.html.erb +1 -0
- data/spec/test_views/spree/admin/widgets/new.html.erb +1 -0
- data/spree_backend.gemspec +4 -3
- data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +130 -154
- metadata +114 -34
- data/app/assets/images/admin/payment_banner.png +0 -0
- data/app/assets/images/admin/progress.gif +0 -0
- data/app/assets/javascripts/spree/backend/nested-attribute.js +0 -27
- data/app/assets/javascripts/spree/backend/orders/edit_form.js +0 -21
- data/app/assets/stylesheets/spree/backend/components/_variables.scss +0 -12
- data/app/assets/stylesheets/spree/backend/plugins/_js_tree.scss +0 -0
- data/app/assets/stylesheets/spree/backend/shared/_typography.scss +0 -5
- data/app/controllers/spree/admin/root_controller.rb +0 -18
- data/app/controllers/spree/admin/search_controller.rb +0 -41
- data/app/helpers/spree/admin/inventory_settings_helper.rb +0 -9
- data/app/helpers/spree/admin/products_helper.rb +0 -29
- data/app/helpers/spree/admin/tables_helper.rb +0 -15
- data/app/helpers/spree/promotion_rules_helper.rb +0 -13
- data/app/views/spree/admin/inventory_units/adjust.html.erb +0 -29
- data/app/views/spree/admin/orders/_line_item.html.erb +0 -21
- data/app/views/spree/admin/refund_reasons/destroy.js.erb +0 -1
- data/app/views/spree/admin/return_authorization_reasons/destroy.js.erb +0 -1
- data/app/views/spree/admin/search/products.rabl +0 -9
- data/app/views/spree/admin/search/users.rabl +0 -30
- data/app/views/spree/admin/stock_movements/edit.html.erb +0 -17
@@ -0,0 +1,662 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe "Order Details", type: :feature, js: true do
|
5
|
+
let!(:stock_location) { create(:stock_location_with_items) }
|
6
|
+
let!(:product) { create(:product, name: 'spree t-shirt', price: 20.00) }
|
7
|
+
let(:order) { create(:order, state: 'complete', completed_at: "2011-02-01 12:36:15", number: "R100") }
|
8
|
+
let(:state) { create(:state) }
|
9
|
+
let!(:shipping_method) { create(:shipping_method, name: "Default") }
|
10
|
+
|
11
|
+
before do
|
12
|
+
order.shipments.create!(stock_location_id: stock_location.id)
|
13
|
+
order.contents.add(product.master, 2)
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'as Admin' do
|
17
|
+
stub_authorization!
|
18
|
+
|
19
|
+
context "cart edit page" do
|
20
|
+
before do
|
21
|
+
product.master.stock_items.first.update_column(:count_on_hand, 100)
|
22
|
+
visit spree.cart_admin_order_path(order)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should allow me to edit order details" do
|
26
|
+
expect(page).to have_content("spree t-shirt")
|
27
|
+
expect(page).to have_content("$40.00")
|
28
|
+
|
29
|
+
within_row(1) do
|
30
|
+
click_icon :edit
|
31
|
+
fill_in "quantity", with: "1"
|
32
|
+
end
|
33
|
+
click_icon :save
|
34
|
+
|
35
|
+
within("#order_total") do
|
36
|
+
expect(page).to have_content("$20.00")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it "can add an item to a shipment" do
|
41
|
+
select2_search "spree t-shirt", from: Spree.t(:name_or_sku)
|
42
|
+
within("table.stock-levels") do
|
43
|
+
fill_in "variant_quantity", with: 2
|
44
|
+
click_icon :add
|
45
|
+
end
|
46
|
+
|
47
|
+
within("#order_total") do
|
48
|
+
expect(page).to have_content("$80.00")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it "can remove an item from a shipment" do
|
53
|
+
expect(page).to have_content("spree t-shirt")
|
54
|
+
|
55
|
+
within_row(1) do
|
56
|
+
accept_alert do
|
57
|
+
click_icon :delete
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Click "ok" on confirmation dialog
|
62
|
+
expect(page).not_to have_content("spree t-shirt")
|
63
|
+
end
|
64
|
+
|
65
|
+
# Regression test for #3862
|
66
|
+
it "can cancel removing an item from a shipment" do
|
67
|
+
expect(page).to have_content("spree t-shirt")
|
68
|
+
|
69
|
+
within_row(1) do
|
70
|
+
# Click "cancel" on confirmation dialog
|
71
|
+
dismiss_alert do
|
72
|
+
click_icon :delete
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
expect(page).to have_content("spree t-shirt")
|
77
|
+
end
|
78
|
+
|
79
|
+
it "can add tracking information" do
|
80
|
+
visit spree.edit_admin_order_path(order)
|
81
|
+
|
82
|
+
within(".show-tracking") do
|
83
|
+
click_icon :edit
|
84
|
+
end
|
85
|
+
fill_in "tracking", with: "FOOBAR"
|
86
|
+
click_icon :save
|
87
|
+
|
88
|
+
expect(page).not_to have_css("input[name=tracking]")
|
89
|
+
expect(page).to have_content("Tracking: FOOBAR")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "can change the shipping method" do
|
93
|
+
order = create(:completed_order_with_totals)
|
94
|
+
visit spree.edit_admin_order_path(order)
|
95
|
+
within("table.table tr.show-method") do
|
96
|
+
click_icon :edit
|
97
|
+
end
|
98
|
+
select2 "Default", from: "Shipping Method"
|
99
|
+
click_icon :save
|
100
|
+
|
101
|
+
expect(page).not_to have_css('#selected_shipping_rate_id')
|
102
|
+
expect(page).to have_content("Default")
|
103
|
+
end
|
104
|
+
|
105
|
+
it "can assign a back-end only shipping method" do
|
106
|
+
create(:shipping_method, name: "Backdoor", display_on: "back_end")
|
107
|
+
order = create(
|
108
|
+
:completed_order_with_totals,
|
109
|
+
shipping_method_filter: Spree::ShippingMethod::DISPLAY_ON_FRONT_AND_BACK_END
|
110
|
+
)
|
111
|
+
visit spree.edit_admin_order_path(order)
|
112
|
+
within("table tr.show-method") do
|
113
|
+
click_icon :edit
|
114
|
+
end
|
115
|
+
select2 "Backdoor", from: "Shipping Method"
|
116
|
+
click_icon :save
|
117
|
+
|
118
|
+
expect(page).not_to have_css('#selected_shipping_rate_id')
|
119
|
+
expect(page).to have_content("Backdoor")
|
120
|
+
end
|
121
|
+
|
122
|
+
it "will show the variant sku", js: false do
|
123
|
+
order = create(:completed_order_with_totals)
|
124
|
+
visit spree.edit_admin_order_path(order)
|
125
|
+
sku = order.line_items.first.variant.sku
|
126
|
+
expect(page).to have_content("SKU: #{sku}")
|
127
|
+
end
|
128
|
+
|
129
|
+
context "with special_instructions present" do
|
130
|
+
before(:each) do
|
131
|
+
order.update_column(:special_instructions, "Very special instructions here")
|
132
|
+
end
|
133
|
+
|
134
|
+
it "will show the special_instructions", js: false do
|
135
|
+
visit spree.edit_admin_order_path(order)
|
136
|
+
expect(page).to have_content("Very special instructions here")
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context 'when not tracking inventory' do
|
141
|
+
let(:tote) { create(:product, name: "Tote", price: 15.00) }
|
142
|
+
|
143
|
+
context "variant doesn't track inventory" do
|
144
|
+
before do
|
145
|
+
tote.master.update_column :track_inventory, false
|
146
|
+
# make sure there's no stock level for any item
|
147
|
+
tote.master.stock_items.update_all count_on_hand: 0, backorderable: false
|
148
|
+
end
|
149
|
+
|
150
|
+
it "adds variant to order just fine" do
|
151
|
+
select2_search tote.name, from: Spree.t(:name_or_sku)
|
152
|
+
within("table.stock-levels") do
|
153
|
+
fill_in "variant_quantity", with: 1
|
154
|
+
click_icon :add
|
155
|
+
end
|
156
|
+
|
157
|
+
wait_for_ajax
|
158
|
+
|
159
|
+
within(".line-items") do
|
160
|
+
expect(page).to have_content(tote.name)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
context "site doesn't track inventory" do
|
166
|
+
before do
|
167
|
+
Spree::Config[:track_inventory_levels] = false
|
168
|
+
tote.master.update_column(:track_inventory, true)
|
169
|
+
# make sure there's no stock level for any item
|
170
|
+
tote.master.stock_items.update_all count_on_hand: 0, backorderable: true
|
171
|
+
end
|
172
|
+
|
173
|
+
it "adds variant to order just fine" do
|
174
|
+
select2_search tote.name, from: Spree.t(:name_or_sku)
|
175
|
+
within("table.stock-levels") do
|
176
|
+
fill_in "variant_quantity", with: 1
|
177
|
+
click_icon :add
|
178
|
+
end
|
179
|
+
|
180
|
+
wait_for_ajax
|
181
|
+
|
182
|
+
within(".line-items") do
|
183
|
+
expect(page).to have_content(tote.name)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
after { Spree::Config[:track_inventory_levels] = true }
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context "variant out of stock and not backorderable" do
|
192
|
+
before do
|
193
|
+
product.master.stock_items.first.update_column(:backorderable, false)
|
194
|
+
product.master.stock_items.first.update_column(:count_on_hand, 0)
|
195
|
+
end
|
196
|
+
|
197
|
+
it "displays out of stock instead of add button" do
|
198
|
+
select2_search product.name, from: Spree.t(:name_or_sku)
|
199
|
+
|
200
|
+
within("table.stock-levels") do
|
201
|
+
expect(page).to have_content(Spree.t(:out_of_stock))
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
context 'Shipment edit page' do
|
208
|
+
let!(:stock_location2) { create(:stock_location_with_items, name: 'Clarksville') }
|
209
|
+
|
210
|
+
before do
|
211
|
+
product.master.stock_items.first.update_column(:backorderable, true)
|
212
|
+
product.master.stock_items.first.update_column(:count_on_hand, 100)
|
213
|
+
product.master.stock_items.last.update_column(:count_on_hand, 100)
|
214
|
+
end
|
215
|
+
|
216
|
+
context 'splitting to location' do
|
217
|
+
before { visit spree.edit_admin_order_path(order) }
|
218
|
+
# can not properly implement until poltergeist supports checking alert text
|
219
|
+
# see https://github.com/teampoltergeist/poltergeist/pull/516
|
220
|
+
it 'should warn you if you have not selected a location or shipment'
|
221
|
+
|
222
|
+
context 'there is enough stock at the other location' do
|
223
|
+
it 'should allow me to make a split' do
|
224
|
+
expect(order.shipments.count).to eq(1)
|
225
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
|
226
|
+
|
227
|
+
within_row(1) { click_icon 'split' }
|
228
|
+
targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
|
229
|
+
click_icon :save
|
230
|
+
|
231
|
+
wait_for_ajax
|
232
|
+
order.reload
|
233
|
+
|
234
|
+
expect(order.shipments.count).to eq(2)
|
235
|
+
expect(order.shipments.last.backordered?).to eq(false)
|
236
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(1)
|
237
|
+
expect(order.shipments.last.inventory_units_for(product.master).count).to eq(1)
|
238
|
+
end
|
239
|
+
|
240
|
+
it 'should allow me to make a transfer via splitting off all stock' do
|
241
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
|
242
|
+
|
243
|
+
within_row(1) { click_icon 'split' }
|
244
|
+
targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
|
245
|
+
fill_in 'item_quantity', with: 2
|
246
|
+
click_icon :save
|
247
|
+
|
248
|
+
wait_for_ajax
|
249
|
+
order.reload
|
250
|
+
|
251
|
+
expect(order.shipments.count).to eq(1)
|
252
|
+
expect(order.shipments.last.backordered?).to eq(false)
|
253
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
|
254
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location2.id)
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'should allow me to split more than I have if available there' do
|
258
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
|
259
|
+
|
260
|
+
within_row(1) { click_icon 'split' }
|
261
|
+
targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
|
262
|
+
fill_in 'item_quantity', with: 5
|
263
|
+
click_icon :save
|
264
|
+
|
265
|
+
wait_for_ajax
|
266
|
+
order.reload
|
267
|
+
|
268
|
+
expect(order.shipments.count).to eq(1)
|
269
|
+
expect(order.shipments.last.backordered?).to eq(false)
|
270
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(5)
|
271
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location2.id)
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'should not split anything if the input quantity is garbage' do
|
275
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
|
276
|
+
|
277
|
+
within_row(1) { click_icon 'split' }
|
278
|
+
targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
|
279
|
+
fill_in 'item_quantity', with: 'ff'
|
280
|
+
click_icon :save
|
281
|
+
|
282
|
+
wait_for_ajax
|
283
|
+
|
284
|
+
expect(order.shipments.count).to eq(1)
|
285
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
|
286
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'should not allow less than or equal to zero qty' do
|
290
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
|
291
|
+
|
292
|
+
within_row(1) { click_icon 'split' }
|
293
|
+
targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
|
294
|
+
fill_in 'item_quantity', with: 0
|
295
|
+
click_icon :save
|
296
|
+
|
297
|
+
wait_for_ajax
|
298
|
+
|
299
|
+
expect(order.shipments.count).to eq(1)
|
300
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
|
301
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
|
302
|
+
|
303
|
+
|
304
|
+
fill_in 'item_quantity', with: -1
|
305
|
+
click_icon :save
|
306
|
+
|
307
|
+
wait_for_ajax
|
308
|
+
|
309
|
+
expect(order.shipments.count).to eq(1)
|
310
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
|
311
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
|
312
|
+
end
|
313
|
+
|
314
|
+
context 'A shipment has shipped' do
|
315
|
+
|
316
|
+
it 'should not show or let me back to the cart page, nor show the shipment edit buttons', js: false do
|
317
|
+
order = create(:order, state: 'payment')
|
318
|
+
order.shipments.create!(stock_location_id: stock_location.id, state: 'shipped')
|
319
|
+
|
320
|
+
visit spree.cart_admin_order_path(order)
|
321
|
+
|
322
|
+
expect(page.current_path).to eq(spree.edit_admin_order_path(order))
|
323
|
+
expect(page).not_to have_text 'Cart'
|
324
|
+
expect(page).not_to have_selector('.fa-split')
|
325
|
+
expect(page).not_to have_selector('.fa-trash')
|
326
|
+
end
|
327
|
+
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
context 'there is not enough stock at the other location' do
|
332
|
+
context 'and it cannot backorder' do
|
333
|
+
it 'should not allow me to split stock' do
|
334
|
+
product.master.stock_items.last.update_column(:backorderable, false)
|
335
|
+
product.master.stock_items.last.update_column(:count_on_hand, 0)
|
336
|
+
|
337
|
+
within_row(1) { click_icon 'split' }
|
338
|
+
targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
|
339
|
+
fill_in 'item_quantity', with: 2
|
340
|
+
click_icon :save
|
341
|
+
|
342
|
+
wait_for_ajax
|
343
|
+
|
344
|
+
expect(order.shipments.count).to eq(1)
|
345
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
|
346
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
|
347
|
+
end
|
348
|
+
|
349
|
+
end
|
350
|
+
|
351
|
+
context 'but it can backorder' do
|
352
|
+
it 'should allow me to split and backorder the stock' do
|
353
|
+
product.master.stock_items.last.update_column(:count_on_hand, 0)
|
354
|
+
product.master.stock_items.last.update_column(:backorderable, true)
|
355
|
+
|
356
|
+
within_row(1) { click_icon 'split' }
|
357
|
+
targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
|
358
|
+
fill_in 'item_quantity', with: 2
|
359
|
+
click_icon :save
|
360
|
+
|
361
|
+
wait_for_ajax
|
362
|
+
order.reload
|
363
|
+
|
364
|
+
expect(order.shipments.count).to eq(1)
|
365
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
|
366
|
+
expect(order.shipments.first.stock_location.id).to eq(stock_location2.id)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
context 'multiple items in cart' do
|
372
|
+
it 'should have no problem splitting if multiple items are in the from shipment' do
|
373
|
+
order.contents.add(create(:variant), 2)
|
374
|
+
expect(order.shipments.count).to eq(1)
|
375
|
+
expect(order.shipments.first.manifest.count).to eq(2)
|
376
|
+
|
377
|
+
within_row(1) { click_icon 'split' }
|
378
|
+
targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
|
379
|
+
click_icon :save
|
380
|
+
|
381
|
+
wait_for_ajax
|
382
|
+
order.reload
|
383
|
+
|
384
|
+
expect(order.shipments.count).to eq(2)
|
385
|
+
expect(order.shipments.last.backordered?).to eq(false)
|
386
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(1)
|
387
|
+
expect(order.shipments.last.inventory_units_for(product.master).count).to eq(1)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
context 'when not tracking inventory' do
|
392
|
+
let(:tote) { create(:product, name: "Tote", price: 15.00) }
|
393
|
+
|
394
|
+
context "variant doesn't track inventory" do
|
395
|
+
before do
|
396
|
+
tote.master.update_column :track_inventory, false
|
397
|
+
# make sure there's no stock level for any item
|
398
|
+
tote.master.stock_items.update_all count_on_hand: 0, backorderable: false
|
399
|
+
end
|
400
|
+
|
401
|
+
it "adds variant to order just fine" do
|
402
|
+
select2_search tote.name, from: Spree.t(:name_or_sku)
|
403
|
+
within("table.stock-levels") do
|
404
|
+
fill_in "stock_item_quantity", with: 1
|
405
|
+
click_icon :add
|
406
|
+
end
|
407
|
+
|
408
|
+
wait_for_ajax
|
409
|
+
|
410
|
+
within("[data-hook=admin_order_form_fields]") do
|
411
|
+
expect(page).to have_content(tote.name)
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
context "site doesn't track inventory" do
|
417
|
+
before do
|
418
|
+
Spree::Config[:track_inventory_levels] = false
|
419
|
+
tote.master.update_column(:track_inventory, true)
|
420
|
+
# make sure there's no stock level for any item
|
421
|
+
tote.master.stock_items.update_all count_on_hand: 0, backorderable: true
|
422
|
+
end
|
423
|
+
|
424
|
+
it "adds variant to order just fine" do
|
425
|
+
select2_search tote.name, from: Spree.t(:name_or_sku)
|
426
|
+
within("table.stock-levels") do
|
427
|
+
fill_in "stock_item_quantity", with: 1
|
428
|
+
click_icon :add
|
429
|
+
end
|
430
|
+
|
431
|
+
wait_for_ajax
|
432
|
+
|
433
|
+
within("[data-hook=admin_order_form_fields]") do
|
434
|
+
expect(page).to have_content(tote.name)
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
after { Spree::Config[:track_inventory_levels] = true }
|
439
|
+
end
|
440
|
+
end
|
441
|
+
|
442
|
+
context "variant out of stock and not backorderable" do
|
443
|
+
before do
|
444
|
+
product.master.stock_items.first.update_column(:backorderable, false)
|
445
|
+
product.master.stock_items.first.update_column(:count_on_hand, 0)
|
446
|
+
end
|
447
|
+
|
448
|
+
it "displays out of stock instead of add button" do
|
449
|
+
select2_search product.name, from: Spree.t(:name_or_sku)
|
450
|
+
|
451
|
+
within("table.stock-levels") do
|
452
|
+
expect(page).to have_content(Spree.t(:out_of_stock))
|
453
|
+
end
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
context 'splitting to shipment' do
|
459
|
+
before do
|
460
|
+
@shipment2 = order.shipments.create(stock_location_id: stock_location2.id)
|
461
|
+
visit spree.edit_admin_order_path(order)
|
462
|
+
end
|
463
|
+
|
464
|
+
it 'should delete the old shipment if enough are split off' do
|
465
|
+
expect(order.shipments.count).to eq(2)
|
466
|
+
|
467
|
+
within_row(1) { click_icon 'split' }
|
468
|
+
targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
|
469
|
+
fill_in 'item_quantity', with: 2
|
470
|
+
click_icon :save
|
471
|
+
|
472
|
+
wait_for_ajax
|
473
|
+
order.reload
|
474
|
+
|
475
|
+
expect(order.shipments.count).to eq(1)
|
476
|
+
expect(order.shipments.last.inventory_units_for(product.master).count).to eq(2)
|
477
|
+
end
|
478
|
+
|
479
|
+
context 'receiving shipment can not backorder' do
|
480
|
+
before { product.master.stock_items.last.update_column(:backorderable, false) }
|
481
|
+
|
482
|
+
it 'should not allow a split if the receiving shipment qty plus the incoming is greater than the count_on_hand' do
|
483
|
+
expect(order.shipments.count).to eq(2)
|
484
|
+
|
485
|
+
within_row(1) { click_icon 'split' }
|
486
|
+
targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
|
487
|
+
fill_in 'item_quantity', with: 1
|
488
|
+
click_icon :save
|
489
|
+
|
490
|
+
wait_for_ajax
|
491
|
+
|
492
|
+
within_row(1) { click_icon 'split' }
|
493
|
+
targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
|
494
|
+
fill_in 'item_quantity', with: 200
|
495
|
+
click_icon :save
|
496
|
+
|
497
|
+
wait_for_ajax
|
498
|
+
|
499
|
+
expect(order.shipments.count).to eq(2)
|
500
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(1)
|
501
|
+
expect(order.shipments.last.inventory_units_for(product.master).count).to eq(1)
|
502
|
+
end
|
503
|
+
|
504
|
+
it 'should not allow a shipment to split stock to itself' do
|
505
|
+
within_row(1) { click_icon 'split' }
|
506
|
+
targetted_select2 order.shipments.first.number, from: '#s2id_item_stock_location'
|
507
|
+
fill_in 'item_quantity', with: 1
|
508
|
+
click_icon :save
|
509
|
+
|
510
|
+
wait_for_ajax
|
511
|
+
|
512
|
+
expect(order.shipments.count).to eq(2)
|
513
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
|
514
|
+
end
|
515
|
+
|
516
|
+
it 'should split fine if more than one line_item is in the receiving shipment' do
|
517
|
+
variant2 = create(:variant)
|
518
|
+
order.contents.add(variant2, 2, shipment: @shipment2)
|
519
|
+
|
520
|
+
within_row(1) { click_icon 'split' }
|
521
|
+
targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
|
522
|
+
fill_in 'item_quantity', with: 1
|
523
|
+
click_icon :save
|
524
|
+
|
525
|
+
wait_for_ajax
|
526
|
+
|
527
|
+
expect(order.shipments.count).to eq(2)
|
528
|
+
expect(order.shipments.first.inventory_units_for(product.master).count).to eq 1
|
529
|
+
expect(order.shipments.last.inventory_units_for(product.master).count).to eq 1
|
530
|
+
expect(order.shipments.first.inventory_units_for(variant2).count).to eq 0
|
531
|
+
expect(order.shipments.last.inventory_units_for(variant2).count).to eq 2
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
context 'receiving shipment can backorder' do
|
536
|
+
it 'should add more to the backorder' do
|
537
|
+
product.master.stock_items.last.update_column(:backorderable, true)
|
538
|
+
product.master.stock_items.last.update_column(:count_on_hand, 0)
|
539
|
+
expect(@shipment2.reload.backordered?).to eq(false)
|
540
|
+
|
541
|
+
|
542
|
+
within_row(1) { click_icon 'split' }
|
543
|
+
targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
|
544
|
+
fill_in 'item_quantity', with: 1
|
545
|
+
click_icon :save
|
546
|
+
|
547
|
+
wait_for_ajax
|
548
|
+
|
549
|
+
expect(@shipment2.reload.backordered?).to eq(true)
|
550
|
+
|
551
|
+
within_row(1) { click_icon 'split' }
|
552
|
+
targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
|
553
|
+
fill_in 'item_quantity', with: 1
|
554
|
+
click_icon :save
|
555
|
+
|
556
|
+
wait_for_ajax
|
557
|
+
|
558
|
+
expect(order.shipments.count).to eq(1)
|
559
|
+
expect(order.shipments.last.inventory_units_for(product.master).count).to eq(2)
|
560
|
+
expect(@shipment2.reload.backordered?).to eq(true)
|
561
|
+
end
|
562
|
+
end
|
563
|
+
end
|
564
|
+
end
|
565
|
+
end
|
566
|
+
|
567
|
+
context 'with only read permissions' do
|
568
|
+
before do
|
569
|
+
allow_any_instance_of(Spree::Admin::BaseController).to receive(:spree_current_user).and_return(nil)
|
570
|
+
end
|
571
|
+
|
572
|
+
custom_authorization! do |user|
|
573
|
+
can [:admin, :index, :read, :edit], Spree::Order
|
574
|
+
end
|
575
|
+
|
576
|
+
it "should not display forbidden links" do
|
577
|
+
visit spree.edit_admin_order_path(order)
|
578
|
+
|
579
|
+
expect(page).not_to have_button('cancel')
|
580
|
+
expect(page).not_to have_button('Resend')
|
581
|
+
|
582
|
+
# Order Tabs
|
583
|
+
expect(page).not_to have_link('Details')
|
584
|
+
expect(page).not_to have_link('Customer')
|
585
|
+
expect(page).not_to have_link('Adjustments')
|
586
|
+
expect(page).not_to have_link('Payments')
|
587
|
+
expect(page).not_to have_link('Returns')
|
588
|
+
|
589
|
+
# Order item actions
|
590
|
+
expect(page).not_to have_css('.delete-item')
|
591
|
+
expect(page).not_to have_css('.split-item')
|
592
|
+
expect(page).not_to have_css('.edit-item')
|
593
|
+
expect(page).not_to have_css('.edit-tracking')
|
594
|
+
|
595
|
+
expect(page).not_to have_css('#add-line-item')
|
596
|
+
end
|
597
|
+
end
|
598
|
+
|
599
|
+
context 'as Fakedispatch' do
|
600
|
+
custom_authorization! do |user|
|
601
|
+
# allow dispatch to :admin, :index, and :edit on Spree::Order
|
602
|
+
can [:admin, :edit, :index, :read], Spree::Order
|
603
|
+
# allow dispatch to :index, :show, :create and :update shipments on the admin
|
604
|
+
can [:admin, :manage, :read, :ship], Spree::Shipment
|
605
|
+
end
|
606
|
+
|
607
|
+
before do
|
608
|
+
allow(Spree.user_class).to receive(:find_by).
|
609
|
+
with(hash_including(:spree_api_key)).
|
610
|
+
and_return(Spree.user_class.new)
|
611
|
+
end
|
612
|
+
|
613
|
+
it 'should not display order tabs or edit buttons without ability', js: false do
|
614
|
+
visit spree.edit_admin_order_path(order)
|
615
|
+
|
616
|
+
# Order Form
|
617
|
+
expect(page).not_to have_css('.edit-item')
|
618
|
+
# Order Tabs
|
619
|
+
expect(page).not_to have_link('Details')
|
620
|
+
expect(page).not_to have_link('Customer')
|
621
|
+
expect(page).not_to have_link('Adjustments')
|
622
|
+
expect(page).not_to have_link('Payments')
|
623
|
+
expect(page).not_to have_link('Returns')
|
624
|
+
end
|
625
|
+
|
626
|
+
it "can add tracking information" do
|
627
|
+
visit spree.edit_admin_order_path(order)
|
628
|
+
within("table.table tr:nth-child(5)") do
|
629
|
+
click_icon :edit
|
630
|
+
end
|
631
|
+
fill_in "tracking", with: "FOOBAR"
|
632
|
+
click_icon :save
|
633
|
+
|
634
|
+
expect(page).not_to have_css("input[name=tracking]")
|
635
|
+
expect(page).to have_content("Tracking: FOOBAR")
|
636
|
+
end
|
637
|
+
|
638
|
+
it "can change the shipping method" do
|
639
|
+
order = create(:completed_order_with_totals)
|
640
|
+
visit spree.edit_admin_order_path(order)
|
641
|
+
within("table.table tr.show-method") do
|
642
|
+
click_icon :edit
|
643
|
+
end
|
644
|
+
select2 "Default", from: "Shipping Method"
|
645
|
+
click_icon :save
|
646
|
+
|
647
|
+
expect(page).not_to have_css('#selected_shipping_rate_id')
|
648
|
+
expect(page).to have_content("Default")
|
649
|
+
end
|
650
|
+
|
651
|
+
it 'can ship' do
|
652
|
+
order = create(:order_ready_to_ship)
|
653
|
+
order.refresh_shipment_rates
|
654
|
+
visit spree.edit_admin_order_path(order)
|
655
|
+
click_on 'Ship'
|
656
|
+
wait_for_ajax
|
657
|
+
within '.shipment-state' do
|
658
|
+
expect(page).to have_content('shipped')
|
659
|
+
end
|
660
|
+
end
|
661
|
+
end
|
662
|
+
end
|