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,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature "Tiered Calculator Promotions" do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
let(:promotion) { create :promotion }
|
7
|
+
|
8
|
+
background do
|
9
|
+
visit spree.edit_admin_promotion_path(promotion)
|
10
|
+
end
|
11
|
+
|
12
|
+
scenario "adding a tiered percent calculator", js: true do
|
13
|
+
select2 "Create whole-order adjustment", from: "Add action of type"
|
14
|
+
within('#action_fields') { click_button "Add" }
|
15
|
+
|
16
|
+
select2 "Tiered Percent", from: "Calculator"
|
17
|
+
within('#actions_container') { click_button "Update" }
|
18
|
+
|
19
|
+
within("#actions_container .settings") do
|
20
|
+
expect(page.body).to have_content("Base Percent")
|
21
|
+
expect(page.body).to have_content("Tiers")
|
22
|
+
|
23
|
+
click_button "Add"
|
24
|
+
end
|
25
|
+
|
26
|
+
fill_in "Base Percent", with: 5
|
27
|
+
|
28
|
+
within(".tier") do
|
29
|
+
find(".js-base-input").set(100)
|
30
|
+
page.execute_script("$('.js-base-input').change();")
|
31
|
+
find(".js-value-input").set(10)
|
32
|
+
page.execute_script("$('.js-value-input').change();")
|
33
|
+
end
|
34
|
+
within('#actions_container') { click_button "Update" }
|
35
|
+
|
36
|
+
first_action = promotion.actions.first
|
37
|
+
expect(first_action.class).to eq Spree::Promotion::Actions::CreateAdjustment
|
38
|
+
|
39
|
+
first_action_calculator = first_action.calculator
|
40
|
+
expect(first_action_calculator.class).to eq Spree::Calculator::TieredPercent
|
41
|
+
expect(first_action_calculator.preferred_base_percent).to eq 5
|
42
|
+
expect(first_action_calculator.preferred_tiers).to eq Hash[100.0 => 10.0]
|
43
|
+
end
|
44
|
+
|
45
|
+
context "with an existing tiered flat rate calculator" do
|
46
|
+
let(:promotion) { create :promotion, :with_order_adjustment }
|
47
|
+
|
48
|
+
background do
|
49
|
+
action = promotion.actions.first
|
50
|
+
|
51
|
+
action.calculator = Spree::Calculator::TieredFlatRate.new
|
52
|
+
action.calculator.preferred_base_amount = 5
|
53
|
+
action.calculator.preferred_tiers = Hash[100 => 10, 200 => 15, 300 => 20]
|
54
|
+
action.calculator.save!
|
55
|
+
|
56
|
+
visit spree.edit_admin_promotion_path(promotion)
|
57
|
+
end
|
58
|
+
|
59
|
+
scenario "deleting a tier", js: true do
|
60
|
+
within(".tier:nth-child(2)") do
|
61
|
+
click_icon :delete
|
62
|
+
end
|
63
|
+
|
64
|
+
within('#actions_container') { click_button "Update" }
|
65
|
+
|
66
|
+
calculator = promotion.actions.first.calculator
|
67
|
+
expect(calculator.preferred_tiers).to eq Hash[100.0 => 10.0, 300.0 => 20.0]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'RefundReason', type: :feature, js: true do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
let!(:amount) { 100.0 }
|
7
|
+
let!(:payment_amount) { amount * 2 }
|
8
|
+
let!(:payment_method) { create(:credit_card_payment_method) }
|
9
|
+
let!(:payment) { create(:payment, amount: payment_amount, payment_method: payment_method) }
|
10
|
+
let!(:refund_reason) { create(:default_refund_reason, name: 'Reason #1', mutable: true) }
|
11
|
+
let!(:refund_reason2) { create(:refund_reason, name: 'Reason #2', mutable: true) }
|
12
|
+
let!(:refund) { create(:refund, payment: payment, amount: amount, reason: refund_reason, transaction_id: nil) }
|
13
|
+
|
14
|
+
before { visit spree.admin_refund_reasons_path }
|
15
|
+
|
16
|
+
describe 'destroy' do
|
17
|
+
it 'has refund reasons' do
|
18
|
+
within('.table #refund_reasons') do
|
19
|
+
expect(page).to have_content(refund_reason.name)
|
20
|
+
expect(page).to have_content(refund_reason2.name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'should not destroy an associated option type' do
|
25
|
+
before { within_row(1) { delete_product_property } }
|
26
|
+
|
27
|
+
it 'has persisted refund reasons' do
|
28
|
+
within('.table #refund_reasons') do
|
29
|
+
expect(page).to have_content(refund_reason.name)
|
30
|
+
expect(page).to have_content(refund_reason2.name)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
it(js: false) { expect(Spree::RefundReason.all).to include(refund_reason) }
|
35
|
+
it(js: false) { expect(Spree::RefundReason.all).to include(refund_reason2) }
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'should allow an admin to destroy a non associated option type' do
|
39
|
+
before { within_row(2) { delete_product_property } }
|
40
|
+
|
41
|
+
it 'has persisted refund reasons' do
|
42
|
+
within('.table #refund_reasons') do
|
43
|
+
expect(page).to have_content(refund_reason.name)
|
44
|
+
expect(page).not_to have_content(refund_reason2.name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it(js: false) { expect(Spree::RefundReason.all).to include(refund_reason) }
|
49
|
+
it(js: false) { expect(Spree::RefundReason.all).not_to include(refund_reason2) }
|
50
|
+
end
|
51
|
+
|
52
|
+
def delete_product_property
|
53
|
+
click_icon :delete
|
54
|
+
wait_for_ajax
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "edit reimbursement type", type: :feature do
|
4
|
+
stub_authorization!
|
5
|
+
let(:r_type) do
|
6
|
+
create(:reimbursement_type,
|
7
|
+
name: 'Exchange',
|
8
|
+
type: 'Spree::ReimbursementType::Exchange',
|
9
|
+
active: true,
|
10
|
+
mutable: true)
|
11
|
+
end
|
12
|
+
|
13
|
+
before do
|
14
|
+
visit "/admin/reimbursement_types/#{r_type.id}/edit"
|
15
|
+
end
|
16
|
+
|
17
|
+
context "with valid attributes" do
|
18
|
+
it "change name, active and mutable" do
|
19
|
+
fill_in "Name", with: "New Credit"
|
20
|
+
uncheck "Mutable"
|
21
|
+
uncheck "Active"
|
22
|
+
|
23
|
+
expect { click_button "Create" }.not_to change(Spree::ReimbursementType, :count)
|
24
|
+
|
25
|
+
r_type.reload
|
26
|
+
|
27
|
+
expect(r_type.active).to eq false
|
28
|
+
expect(r_type.mutable).to eq false
|
29
|
+
expect(page).to have_content("New Credit")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "view should have select field" do
|
34
|
+
expect(page).not_to have_css("div#reimbursement_type_type_field.form-group.field")
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "new reimbursement type", type: :feature do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
before do
|
7
|
+
visit "/admin/reimbursement_types/new"
|
8
|
+
end
|
9
|
+
|
10
|
+
it "view should have select field" do
|
11
|
+
expect(page).to have_css("div#reimbursement_type_type_field.form-group.field")
|
12
|
+
end
|
13
|
+
|
14
|
+
context "with valid attributes" do
|
15
|
+
it "credit type" do
|
16
|
+
fill_in "Name", with: "Credit"
|
17
|
+
select "Spree::ReimbursementType::Credit", from: "reimbursement_type_type"
|
18
|
+
|
19
|
+
expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)
|
20
|
+
|
21
|
+
expect(page).to have_content("Credit")
|
22
|
+
end
|
23
|
+
|
24
|
+
it "exchange type" do
|
25
|
+
fill_in "Name", with: "Exchange"
|
26
|
+
select "Spree::ReimbursementType::Exchange", from: "reimbursement_type_type"
|
27
|
+
|
28
|
+
expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)
|
29
|
+
|
30
|
+
expect(page).to have_content("Exchange")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "original payment type" do
|
34
|
+
fill_in "Name", with: "OriginalPayment"
|
35
|
+
select "Spree::ReimbursementType::OriginalPayment", from: "reimbursement_type_type"
|
36
|
+
|
37
|
+
expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)
|
38
|
+
|
39
|
+
expect(page).to have_content("OriginalPayment")
|
40
|
+
end
|
41
|
+
|
42
|
+
it "store credit type" do
|
43
|
+
fill_in "Name", with: "StoreCredit"
|
44
|
+
select "Spree::ReimbursementType::StoreCredit", from: "reimbursement_type_type"
|
45
|
+
|
46
|
+
expect { click_button "Create" }.to change(Spree::ReimbursementType, :count).by(1)
|
47
|
+
|
48
|
+
expect(page).to have_content("StoreCredit")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "with invalid params" do
|
53
|
+
it "without name" do
|
54
|
+
fill_in "Name", with: ""
|
55
|
+
select "Spree::ReimbursementType::StoreCredit", from: "reimbursement_type_type"
|
56
|
+
|
57
|
+
expect { click_button "Create" }.not_to change(Spree::ReimbursementType, :count)
|
58
|
+
|
59
|
+
expect(page).to have_content("Name can't be blank")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Reports", type: :feature do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
context "visiting the admin reports page" do
|
7
|
+
it "should have the right content" do
|
8
|
+
visit spree.admin_path
|
9
|
+
click_link "Reports"
|
10
|
+
click_link "Sales Total"
|
11
|
+
|
12
|
+
expect(page).to have_content("Sales Totals")
|
13
|
+
expect(page).to have_content("Item Total")
|
14
|
+
expect(page).to have_content("Adjustment Total")
|
15
|
+
expect(page).to have_content("Sales Total")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "searching the admin reports page" do
|
20
|
+
before do
|
21
|
+
order = create(:order)
|
22
|
+
order.update_columns({adjustment_total: 100})
|
23
|
+
order.completed_at = Time.current
|
24
|
+
order.save!
|
25
|
+
|
26
|
+
order = create(:order)
|
27
|
+
order.update_columns({adjustment_total: 200})
|
28
|
+
order.completed_at = Time.current
|
29
|
+
order.save!
|
30
|
+
|
31
|
+
#incomplete order
|
32
|
+
order = create(:order)
|
33
|
+
order.update_columns({adjustment_total: 50})
|
34
|
+
order.save!
|
35
|
+
|
36
|
+
order = create(:order)
|
37
|
+
order.update_columns({adjustment_total: 200})
|
38
|
+
order.completed_at = 3.years.ago
|
39
|
+
order.created_at = 3.years.ago
|
40
|
+
order.save!
|
41
|
+
|
42
|
+
order = create(:order)
|
43
|
+
order.update_columns({adjustment_total: 200})
|
44
|
+
order.completed_at = 3.years.from_now
|
45
|
+
order.created_at = 3.years.from_now
|
46
|
+
order.save!
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should allow me to search for reports" do
|
50
|
+
visit spree.admin_path
|
51
|
+
click_link "Reports"
|
52
|
+
click_link "Sales Total"
|
53
|
+
|
54
|
+
fill_in "q_completed_at_gt", with: 1.week.ago
|
55
|
+
fill_in "q_completed_at_lt", with: 1.week.from_now
|
56
|
+
click_button "Search"
|
57
|
+
|
58
|
+
expect(page).to have_content("$300.00")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'ReturnAuthorizationReason', type: :feature, js: true do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
let!(:order) { create(:shipped_order) }
|
7
|
+
let!(:stock_location) { create(:stock_location) }
|
8
|
+
let!(:rma_reason) { create(:return_authorization_reason, name: 'Defect #1', mutable: true) }
|
9
|
+
let!(:rma_reason2) { create(:return_authorization_reason, name: 'Defect #2', mutable: true) }
|
10
|
+
|
11
|
+
let!(:return_authorization) do
|
12
|
+
create(
|
13
|
+
:return_authorization,
|
14
|
+
order: order,
|
15
|
+
stock_location: stock_location,
|
16
|
+
reason: rma_reason
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
before { visit spree.admin_return_authorization_reasons_path }
|
21
|
+
|
22
|
+
describe 'destroy' do
|
23
|
+
it 'has return authorization reasons' do
|
24
|
+
within('.table #return_authorization_reasons') do
|
25
|
+
expect(page).to have_content(rma_reason.name)
|
26
|
+
expect(page).to have_content(rma_reason2.name)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'should not destroy an associated option type' do
|
31
|
+
before { within_row(1) { delete_product_property } }
|
32
|
+
|
33
|
+
it 'has persisted return authorization reasons' do
|
34
|
+
within('.table #return_authorization_reasons') do
|
35
|
+
expect(page).to have_content(rma_reason.name)
|
36
|
+
expect(page).to have_content(rma_reason2.name)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it(js: false) { expect(Spree::ReturnAuthorizationReason.all).to include(rma_reason) }
|
41
|
+
it(js: false) { expect(Spree::ReturnAuthorizationReason.all).to include(rma_reason2) }
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'should allow an admin to destroy a non associated option type' do
|
45
|
+
before { within_row(2) { delete_product_property } }
|
46
|
+
|
47
|
+
it 'has persisted return authorization reasons' do
|
48
|
+
within('.table #return_authorization_reasons') do
|
49
|
+
expect(page).to have_content(rma_reason.name)
|
50
|
+
expect(page).not_to have_content(rma_reason2.name)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
it(js: false) { expect(Spree::ReturnAuthorizationReason.all).to include(rma_reason) }
|
55
|
+
it(js: false) { expect(Spree::ReturnAuthorizationReason.all).not_to include(rma_reason2) }
|
56
|
+
end
|
57
|
+
|
58
|
+
def delete_product_property
|
59
|
+
click_icon :delete
|
60
|
+
wait_for_ajax
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe "Customer Returns", type: :feature do
|
5
|
+
stub_authorization!
|
6
|
+
let!(:customer_return) { create(:customer_return, created_at: Time.current) }
|
7
|
+
|
8
|
+
describe "listing" do
|
9
|
+
let!(:customer_return_2) { create(:customer_return, created_at: Time.current - 1.day) }
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
visit spree.admin_customer_returns_path
|
13
|
+
end
|
14
|
+
|
15
|
+
it "lists sorted by created_at" do
|
16
|
+
within_row(1) { expect(page).to have_content(customer_return.number) }
|
17
|
+
within_row(2) { expect(page).to have_content(customer_return_2.number) }
|
18
|
+
end
|
19
|
+
|
20
|
+
it "displays pre tax total" do
|
21
|
+
within_row(1) { expect(page).to have_content(customer_return.display_pre_tax_total.to_html) }
|
22
|
+
end
|
23
|
+
|
24
|
+
it "displays order number" do
|
25
|
+
within_row(1) { expect(page).to have_content(customer_return.order.number) }
|
26
|
+
end
|
27
|
+
|
28
|
+
it "displays customer return number" do
|
29
|
+
within_row(1) { expect(page).to have_content(customer_return.number) }
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'displays status' do
|
33
|
+
within_row(1) { expect(page).to have_content(Spree.t(:incomplete)) }
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'has edit link' do
|
37
|
+
expect(page).to have_css('.icon-edit')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "searching" do
|
42
|
+
let!(:customer_return_2) { create(:customer_return) }
|
43
|
+
|
44
|
+
it "searches on number" do
|
45
|
+
visit spree.admin_customer_returns_path
|
46
|
+
|
47
|
+
click_on 'Filter'
|
48
|
+
fill_in "q_number_cont", with: customer_return.number
|
49
|
+
click_on 'Search'
|
50
|
+
|
51
|
+
expect(page).to have_content(customer_return.number)
|
52
|
+
expect(page).not_to have_content(customer_return_2.number)
|
53
|
+
|
54
|
+
click_on 'Filter'
|
55
|
+
fill_in "q_number_cont", with: customer_return_2.number
|
56
|
+
click_on 'Search'
|
57
|
+
|
58
|
+
expect(page).to have_content(customer_return_2.number)
|
59
|
+
expect(page).not_to have_content(customer_return.number)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'link' do
|
64
|
+
describe 'order number' do
|
65
|
+
it 'opens orders edit page' do
|
66
|
+
visit spree.admin_customer_returns_path
|
67
|
+
click_link customer_return.order.number
|
68
|
+
expect(page).to have_content("Orders / #{customer_return.order.number}")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe 'customer return number' do
|
73
|
+
it 'opens customer return edit page' do
|
74
|
+
visit spree.admin_customer_returns_path
|
75
|
+
click_link customer_return.number
|
76
|
+
expect(page).to have_content("Customer Return ##{customer_return.number}")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe "Return Authorizations", type: :feature do
|
5
|
+
stub_authorization!
|
6
|
+
|
7
|
+
describe "listing" do
|
8
|
+
let!(:return_authorization) { create(:return_authorization, created_at: Time.current) }
|
9
|
+
let!(:return_authorization_2) { create(:return_authorization, created_at: Time.current - 1.day) }
|
10
|
+
|
11
|
+
before(:each) do
|
12
|
+
visit spree.admin_return_authorizations_path
|
13
|
+
end
|
14
|
+
|
15
|
+
it "lists return authorizations sorted by created_at" do
|
16
|
+
within_row(1) { expect(page).to have_content(return_authorization.number) }
|
17
|
+
within_row(2) { expect(page).to have_content(return_authorization_2.number) }
|
18
|
+
end
|
19
|
+
|
20
|
+
it "displays order number" do
|
21
|
+
within_row(1) { expect(page).to have_content(return_authorization.order.number) }
|
22
|
+
end
|
23
|
+
|
24
|
+
it "displays return authorization number" do
|
25
|
+
within_row(1) { expect(page).to have_content(return_authorization.number) }
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'displays state' do
|
29
|
+
return_authorization_state = Spree.t("return_authorization_states.#{return_authorization.state}")
|
30
|
+
within_row(1) { expect(page).to have_content(return_authorization_state) }
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'has edit link' do
|
34
|
+
expect(page).to have_css('.icon-edit')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "searching" do
|
39
|
+
let!(:return_authorization) { create(:return_authorization, state: 'authorized') }
|
40
|
+
let!(:return_authorization_2) { create(:return_authorization, state: 'canceled') }
|
41
|
+
|
42
|
+
it "searches on number" do
|
43
|
+
visit spree.admin_return_authorizations_path
|
44
|
+
|
45
|
+
click_on 'Filter'
|
46
|
+
fill_in "q_number_cont", with: return_authorization.number
|
47
|
+
click_on 'Search'
|
48
|
+
|
49
|
+
expect(page).to have_content(return_authorization.number)
|
50
|
+
expect(page).not_to have_content(return_authorization_2.number)
|
51
|
+
|
52
|
+
click_on 'Filter'
|
53
|
+
fill_in "q_number_cont", with: return_authorization_2.number
|
54
|
+
click_on 'Search'
|
55
|
+
|
56
|
+
expect(page).to have_content(return_authorization_2.number)
|
57
|
+
expect(page).not_to have_content(return_authorization.number)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "searches on status" do
|
61
|
+
visit spree.admin_return_authorizations_path
|
62
|
+
|
63
|
+
click_on 'Filter'
|
64
|
+
select Spree.t("return_authorization_states.#{return_authorization.state}"), from: 'Status'
|
65
|
+
click_on 'Search'
|
66
|
+
|
67
|
+
expect(page).to have_content(return_authorization.number)
|
68
|
+
expect(page).not_to have_content(return_authorization_2.number)
|
69
|
+
|
70
|
+
click_on 'Filter'
|
71
|
+
select Spree.t("return_authorization_states.#{return_authorization_2.state}"), from: 'Status'
|
72
|
+
click_on 'Search'
|
73
|
+
|
74
|
+
expect(page).to have_content(return_authorization_2.number)
|
75
|
+
expect(page).not_to have_content(return_authorization.number)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe 'link' do
|
80
|
+
let!(:return_authorization) { create(:return_authorization) }
|
81
|
+
|
82
|
+
describe 'order number' do
|
83
|
+
it 'opens orders edit page' do
|
84
|
+
visit spree.admin_return_authorizations_path
|
85
|
+
click_link return_authorization.order.number
|
86
|
+
expect(page).to have_content("Orders / #{return_authorization.order.number}")
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe 'return authorization number' do
|
91
|
+
it 'opens return authorization edit page' do
|
92
|
+
visit spree.admin_return_authorizations_path
|
93
|
+
click_link return_authorization.number
|
94
|
+
expect(page).to have_content(return_authorization.number)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe 'authorized' do
|
99
|
+
let!(:return_authorization) { create(:return_authorization, state: 'authorized') }
|
100
|
+
let!(:return_authorization_2) { create(:return_authorization, state: 'canceled') }
|
101
|
+
|
102
|
+
it 'only shows authorized return authorizations' do
|
103
|
+
visit spree.admin_return_authorizations_path
|
104
|
+
within('.nav-tabs') do
|
105
|
+
click_link 'Authorized'
|
106
|
+
end
|
107
|
+
|
108
|
+
expect(page).to have_content(return_authorization.number)
|
109
|
+
expect(page).not_to have_content(return_authorization_2.number)
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'preselects authorized status in filter' do
|
113
|
+
visit spree.admin_return_authorizations_path
|
114
|
+
within('.nav-tabs') do
|
115
|
+
click_link 'Authorized'
|
116
|
+
end
|
117
|
+
|
118
|
+
within('#table-filter') do
|
119
|
+
return_authorization_state = Spree.t("return_authorization_states.#{return_authorization.state}")
|
120
|
+
expect(page).to have_select("Status", selected: return_authorization_state)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe 'canceled' do
|
126
|
+
let!(:return_authorization) { create(:return_authorization, state: 'canceled') }
|
127
|
+
let!(:return_authorization_2) { create(:return_authorization, state: 'authorized') }
|
128
|
+
|
129
|
+
it 'only shows canceled return authorizations' do
|
130
|
+
visit spree.admin_return_authorizations_path
|
131
|
+
within('.nav-tabs') do
|
132
|
+
click_link 'Canceled'
|
133
|
+
end
|
134
|
+
|
135
|
+
expect(page).to have_content(return_authorization.number)
|
136
|
+
expect(page).not_to have_content(return_authorization_2.number)
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'preselects canceled status in filter' do
|
140
|
+
visit spree.admin_return_authorizations_path
|
141
|
+
within('.nav-tabs') do
|
142
|
+
click_link 'Canceled'
|
143
|
+
end
|
144
|
+
|
145
|
+
within('#table-filter') do
|
146
|
+
return_authorization_state = Spree.t("return_authorization_states.#{return_authorization.state}")
|
147
|
+
expect(page).to have_select("Status", selected: return_authorization_state)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Stock Transfers', type: :feature, js: true do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
it 'transfer between 2 locations' do
|
7
|
+
source_location = create(:stock_location_with_items, name: 'NY')
|
8
|
+
destination_location = create(:stock_location, name: 'SF')
|
9
|
+
variant = Spree::Variant.last
|
10
|
+
|
11
|
+
visit spree.admin_stock_transfers_path
|
12
|
+
click_on 'New Stock Transfer'
|
13
|
+
fill_in 'reference', with: 'PO 666'
|
14
|
+
|
15
|
+
select2_search variant.name, from: 'Variant'
|
16
|
+
|
17
|
+
click_button 'Add'
|
18
|
+
click_button 'Transfer Stock'
|
19
|
+
|
20
|
+
expect(page).to have_content('Reference PO 666')
|
21
|
+
expect(page).to have_content('NY')
|
22
|
+
expect(page).to have_content('SF')
|
23
|
+
expect(page).to have_content(variant.name)
|
24
|
+
|
25
|
+
transfer = Spree::StockTransfer.last
|
26
|
+
expect(transfer.stock_movements.size).to eq 2
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'received stock transfer' do
|
30
|
+
def it_is_received_stock_transfer(page)
|
31
|
+
expect(page).to have_content('Reference PO 666')
|
32
|
+
expect(page).not_to have_selector("#stock-location-source")
|
33
|
+
expect(page).to have_selector("#stock-location-destination")
|
34
|
+
|
35
|
+
transfer = Spree::StockTransfer.last
|
36
|
+
expect(transfer.stock_movements.size).to eq 1
|
37
|
+
expect(transfer.source_location).to be_nil
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'receive stock to a single location' do
|
41
|
+
source_location = create(:stock_location_with_items, name: 'NY')
|
42
|
+
destination_location = create(:stock_location, name: 'SF')
|
43
|
+
variant = Spree::Variant.last
|
44
|
+
|
45
|
+
visit spree.new_admin_stock_transfer_path
|
46
|
+
|
47
|
+
fill_in 'reference', with: 'PO 666'
|
48
|
+
check 'transfer_receive_stock'
|
49
|
+
select('NY', from: 'transfer_destination_location_id')
|
50
|
+
select2_search variant.name, from: 'Variant'
|
51
|
+
|
52
|
+
click_button 'Add'
|
53
|
+
click_button 'Transfer Stock'
|
54
|
+
|
55
|
+
it_is_received_stock_transfer page
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'forced to only receive there is only one location' do
|
59
|
+
source_location = create(:stock_location_with_items, name: 'NY')
|
60
|
+
variant = Spree::Variant.last
|
61
|
+
|
62
|
+
visit spree.new_admin_stock_transfer_path
|
63
|
+
|
64
|
+
fill_in 'reference', with: 'PO 666'
|
65
|
+
|
66
|
+
select('NY', from: 'transfer_destination_location_id')
|
67
|
+
select2_search variant.name, from: 'Variant'
|
68
|
+
|
69
|
+
click_button 'Add'
|
70
|
+
click_button 'Transfer Stock'
|
71
|
+
|
72
|
+
it_is_received_stock_transfer page
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|