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,231 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Payments', type: :feature, js: true do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
context "with a pre-existing payment" do
|
7
|
+
|
8
|
+
let!(:payment) do
|
9
|
+
create(:payment,
|
10
|
+
order: order,
|
11
|
+
amount: order.outstanding_balance,
|
12
|
+
payment_method: create(:credit_card_payment_method),
|
13
|
+
state: state
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:order) { create(:completed_order_with_totals, number: 'R100', line_items_count: 5) }
|
18
|
+
let(:state) { 'checkout' }
|
19
|
+
|
20
|
+
before do
|
21
|
+
visit spree.edit_admin_order_path(order)
|
22
|
+
click_link 'Payments'
|
23
|
+
end
|
24
|
+
|
25
|
+
def refresh_page
|
26
|
+
visit current_path
|
27
|
+
end
|
28
|
+
|
29
|
+
# Regression tests for #1453
|
30
|
+
context 'with a check payment' do
|
31
|
+
let(:order) { create(:completed_order_with_totals, number: 'R100') }
|
32
|
+
let!(:payment) do
|
33
|
+
create(:payment,
|
34
|
+
order: order,
|
35
|
+
amount: order.outstanding_balance,
|
36
|
+
payment_method: create(:check_payment_method) # Check
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'capturing a check payment from a new order' do
|
41
|
+
click_icon(:capture)
|
42
|
+
expect(page).not_to have_content('Cannot perform requested operation')
|
43
|
+
expect(page).to have_content('Payment Updated')
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'voids a check payment from a new order' do
|
47
|
+
click_icon(:void)
|
48
|
+
expect(page).to have_content('Payment Updated')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should list all captures for a payment' do
|
53
|
+
Spree::ShippingMethod.delete_all
|
54
|
+
capture_amount = order.outstanding_balance/2 * 100
|
55
|
+
payment.capture!(capture_amount)
|
56
|
+
|
57
|
+
visit spree.admin_order_payment_path(order, payment)
|
58
|
+
expect(page).to have_content 'Capture events'
|
59
|
+
within '#capture_events' do
|
60
|
+
within_row(1) do
|
61
|
+
expect(page).to have_content(capture_amount / 100)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'lists and create payments for an order' do
|
67
|
+
within_row(1) do
|
68
|
+
expect(column_text(3)).to eq('$150.00')
|
69
|
+
expect(column_text(4)).to eq('Credit Card')
|
70
|
+
expect(column_text(6)).to eq('checkout')
|
71
|
+
end
|
72
|
+
|
73
|
+
click_icon :void
|
74
|
+
expect(find('#payment_status').text).to eq('balance due')
|
75
|
+
expect(page).to have_content('Payment Updated')
|
76
|
+
|
77
|
+
within_row(1) do
|
78
|
+
expect(column_text(3)).to eq('$150.00')
|
79
|
+
expect(column_text(4)).to eq('Credit Card')
|
80
|
+
expect(column_text(6)).to eq('void')
|
81
|
+
end
|
82
|
+
|
83
|
+
click_on 'New Payment'
|
84
|
+
expect(page).to have_content('New Payment')
|
85
|
+
click_button 'Update'
|
86
|
+
expect(page).to have_content('successfully created!')
|
87
|
+
|
88
|
+
click_icon(:capture)
|
89
|
+
wait_for_ajax
|
90
|
+
expect(find('#payment_status').text).to eq('paid')
|
91
|
+
|
92
|
+
expect(page).not_to have_selector('#new_payment_section')
|
93
|
+
end
|
94
|
+
|
95
|
+
# Regression test for #1269
|
96
|
+
it 'cannot create a payment for an order with no payment methods', js: false do
|
97
|
+
Spree::PaymentMethod.delete_all
|
98
|
+
order.payments.delete_all
|
99
|
+
|
100
|
+
click_on 'New Payment'
|
101
|
+
expect(page).to have_content('You cannot create a payment for an order without any payment methods defined.')
|
102
|
+
expect(page).to have_content('Please define some payment methods first.')
|
103
|
+
end
|
104
|
+
|
105
|
+
%w[checkout pending].each do |state|
|
106
|
+
context "payment is #{state.inspect}" do
|
107
|
+
let(:state) { state }
|
108
|
+
|
109
|
+
it 'allows the amount to be edited by clicking on the edit button then saving' do
|
110
|
+
within_row(1) do
|
111
|
+
click_icon(:edit)
|
112
|
+
fill_in('amount', with: '$1')
|
113
|
+
click_icon(:save)
|
114
|
+
expect(page).to have_selector('td.amount span', text: '$1.00')
|
115
|
+
expect(payment.reload.amount).to eq(1.00)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'allows the amount to be edited by clicking on the amount then saving' do
|
120
|
+
within_row(1) do
|
121
|
+
find('td.amount span').click
|
122
|
+
fill_in('amount', with: '$1.01')
|
123
|
+
click_icon(:save)
|
124
|
+
expect(page).to have_selector('td.amount span', text: '$1.01')
|
125
|
+
expect(payment.reload.amount).to eq(1.01)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'allows the amount change to be cancelled by clicking on the cancel button' do
|
130
|
+
within_row(1) do
|
131
|
+
click_icon(:edit)
|
132
|
+
|
133
|
+
# Can't use fill_in here, as under poltergeist that will unfocus (and
|
134
|
+
# thus submit) the field under poltergeist
|
135
|
+
find('td.amount input').click
|
136
|
+
page.execute_script("$('td.amount input').val('$1')")
|
137
|
+
|
138
|
+
click_icon(:cancel)
|
139
|
+
expect(page).to have_selector('td.amount span', text: '$150.00')
|
140
|
+
expect(payment.reload.amount).to eq(150.00)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'displays an error when the amount is invalid' do
|
145
|
+
within_row(1) do
|
146
|
+
click_icon(:edit)
|
147
|
+
fill_in('amount', with: 'invalid')
|
148
|
+
click_icon(:save)
|
149
|
+
expect(find('td.amount input').value).to eq('invalid')
|
150
|
+
expect(payment.reload.amount).to eq(150.00)
|
151
|
+
end
|
152
|
+
expect(page).to have_selector('.alert-error', text: 'Invalid resource. Please fix errors and try again.')
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
context 'payment is completed', js: false do
|
158
|
+
let(:state) { 'completed' }
|
159
|
+
|
160
|
+
it 'does not allow the amount to be edited' do
|
161
|
+
within_row(1) do
|
162
|
+
expect(page).not_to have_selector('.fa-edit')
|
163
|
+
expect(page).not_to have_selector('td.amount span')
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
context "with no prior payments" do
|
170
|
+
let(:order) { create(:order_with_line_items, line_items_count: 1) }
|
171
|
+
let!(:payment_method) { create(:credit_card_payment_method) }
|
172
|
+
|
173
|
+
# Regression tests for #4129
|
174
|
+
context "with a credit card payment method" do
|
175
|
+
before do
|
176
|
+
visit spree.admin_order_payments_path(order)
|
177
|
+
end
|
178
|
+
|
179
|
+
it "is able to create a new credit card payment with valid information" do
|
180
|
+
fill_in "Card Number", with: "4111 1111 1111 1111"
|
181
|
+
fill_in "Name", with: "Test User"
|
182
|
+
fill_in "Expiration", with: "09 / #{Time.current.year + 1}"
|
183
|
+
fill_in "Card Code", with: "007"
|
184
|
+
# Regression test for #4277
|
185
|
+
sleep(1)
|
186
|
+
expect(find('.ccType', visible: false).value).to eq('visa')
|
187
|
+
click_button "Continue"
|
188
|
+
expect(page).to have_content("Payment has been successfully created!")
|
189
|
+
end
|
190
|
+
|
191
|
+
it "is unable to create a new payment with invalid information" do
|
192
|
+
click_button "Continue"
|
193
|
+
expect(page).to have_content("Payment could not be created.")
|
194
|
+
expect(page).to have_content("Number can't be blank")
|
195
|
+
expect(page).to have_content("Name can't be blank")
|
196
|
+
expect(page).to have_content("Verification Value can't be blank")
|
197
|
+
expect(page).to have_content("Month is not a number")
|
198
|
+
expect(page).to have_content("Year is not a number")
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
context "user existing card" do
|
203
|
+
let!(:cc) do
|
204
|
+
create(:credit_card, user_id: order.user_id, payment_method: payment_method, gateway_customer_profile_id: "BGS-RFRE")
|
205
|
+
end
|
206
|
+
|
207
|
+
before { visit spree.admin_order_payments_path(order) }
|
208
|
+
|
209
|
+
it "is able to reuse customer payment source", js: false do
|
210
|
+
expect(find("#card_#{cc.id}")).to be_checked
|
211
|
+
click_button "Continue"
|
212
|
+
expect(page).to have_content("Payment has been successfully created!")
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
context "with a check" do
|
217
|
+
let!(:payment_method) { create(:check_payment_method) }
|
218
|
+
|
219
|
+
before do
|
220
|
+
visit spree.admin_order_payments_path(order.reload)
|
221
|
+
end
|
222
|
+
|
223
|
+
it "can successfully be created and captured" do
|
224
|
+
click_on 'Continue'
|
225
|
+
expect(page).to have_content("Payment has been successfully created!")
|
226
|
+
click_icon(:capture)
|
227
|
+
expect(page).to have_content("Payment Updated")
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Order Risk Analysis', type: :feature do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
let!(:order) do
|
7
|
+
create(:completed_order_with_pending_payment)
|
8
|
+
end
|
9
|
+
|
10
|
+
def visit_order
|
11
|
+
visit spree.admin_path
|
12
|
+
click_link 'Orders'
|
13
|
+
within_row(1) do
|
14
|
+
click_link order.number
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "the order is considered risky" do
|
19
|
+
before do
|
20
|
+
allow_any_instance_of(Spree::Admin::BaseController).to receive_messages try_spree_current_user: create(:user)
|
21
|
+
|
22
|
+
order.payments.first.update_column(:avs_response, 'X')
|
23
|
+
order.considered_risky!
|
24
|
+
visit_order
|
25
|
+
end
|
26
|
+
|
27
|
+
it "displays 'Risk Analysis' box" do
|
28
|
+
expect(page).to have_content 'Risk Analysis'
|
29
|
+
end
|
30
|
+
|
31
|
+
it "can be approved" do
|
32
|
+
click_button('Approve')
|
33
|
+
expect(page).to have_content 'Approver'
|
34
|
+
expect(page).to have_content 'Approved at'
|
35
|
+
expect(page).to have_content 'Status: complete'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "the order is not considered risky" do
|
40
|
+
before do
|
41
|
+
visit_order
|
42
|
+
end
|
43
|
+
|
44
|
+
it "does not display 'Risk Analysis' box" do
|
45
|
+
expect(page).to_not have_content 'Risk Analysis'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Shipments", type: :feature do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
let!(:order) { create(:order_ready_to_ship, number: "R100", state: "complete", line_items_count: 5) }
|
7
|
+
|
8
|
+
# Regression test for #4025
|
9
|
+
context "a shipment without a shipping method" do
|
10
|
+
before do
|
11
|
+
order.shipments.each do |s|
|
12
|
+
# Deleting the shipping rates causes there to be no shipping methods
|
13
|
+
s.shipping_rates.delete_all
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it "can still be displayed" do
|
18
|
+
expect { visit spree.edit_admin_order_path(order) }.not_to raise_error
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "shipping an order", js: true do
|
23
|
+
before(:each) do
|
24
|
+
visit spree.admin_orders_path
|
25
|
+
within_row(1) do
|
26
|
+
click_link "R100"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it "can ship a completed order" do
|
31
|
+
click_on "Ship"
|
32
|
+
wait_for_ajax
|
33
|
+
|
34
|
+
expect(page).to have_content("shipped package")
|
35
|
+
expect(order.reload.shipment_state).to eq("shipped")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "moving variants between shipments", js: true do
|
40
|
+
let!(:la) { create(:stock_location, name: "LA") }
|
41
|
+
before(:each) do
|
42
|
+
visit spree.admin_orders_path
|
43
|
+
within_row(1) do
|
44
|
+
click_link "R100"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "can move a variant to a new and to an existing shipment" do
|
49
|
+
expect(order.shipments.count).to eq(1)
|
50
|
+
|
51
|
+
within_row(1) { click_icon :split }
|
52
|
+
targetted_select2 'LA', from: '#s2id_item_stock_location'
|
53
|
+
click_icon :save
|
54
|
+
wait_for_ajax
|
55
|
+
expect(page.find("#shipment_#{order.shipments.first.id}")).to be_present
|
56
|
+
|
57
|
+
within_row(2) { click_icon :split }
|
58
|
+
targetted_select2 "LA(#{order.reload.shipments.last.number})", from: '#s2id_item_stock_location'
|
59
|
+
click_icon :save
|
60
|
+
wait_for_ajax
|
61
|
+
expect(page.find("#shipment_#{order.reload.shipments.last.id}")).to be_present
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Order - State Changes", type: :feature do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
let!(:order) { create(:order_with_line_items) }
|
7
|
+
|
8
|
+
context "for completed order" do
|
9
|
+
before do
|
10
|
+
order.next!
|
11
|
+
visit spree.admin_order_state_changes_path(order)
|
12
|
+
end
|
13
|
+
it 'are viewable' do
|
14
|
+
within_row(1) do
|
15
|
+
within('td:nth-child(1)') { expect(page).to have_content('Order') }
|
16
|
+
within('td:nth-child(2)') { expect(page).to have_content('Cart') }
|
17
|
+
within('td:nth-child(3)') { expect(page).to have_content('Address') }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Product Images", type: :feature, js: true do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
let(:file_path) { Rails.root + "../../spec/support/ror_ringer.jpeg" }
|
7
|
+
|
8
|
+
before do
|
9
|
+
# Ensure attachment style keys are symbolized before running all tests
|
10
|
+
# Otherwise this would result in this error:
|
11
|
+
# undefined method `processors' for \"48x48>\
|
12
|
+
Spree::Image.attachment_definitions[:attachment][:styles].symbolize_keys!
|
13
|
+
end
|
14
|
+
|
15
|
+
context "uploading, editing, and deleting an image" do
|
16
|
+
it "should allow an admin to upload and edit an image for a product" do
|
17
|
+
Spree::Image.attachment_definitions[:attachment].delete :storage
|
18
|
+
|
19
|
+
create(:product)
|
20
|
+
|
21
|
+
visit spree.admin_products_path
|
22
|
+
click_icon(:edit)
|
23
|
+
click_link "Images"
|
24
|
+
click_link "new_image_link"
|
25
|
+
attach_file('image_attachment', file_path)
|
26
|
+
click_button "Create"
|
27
|
+
expect(page).to have_content("successfully created!")
|
28
|
+
|
29
|
+
click_icon(:edit)
|
30
|
+
fill_in "image_alt", with: "ruby on rails t-shirt"
|
31
|
+
click_button "Update"
|
32
|
+
expect(page).to have_content("successfully updated!")
|
33
|
+
expect(page).to have_content("ruby on rails t-shirt")
|
34
|
+
|
35
|
+
accept_alert do
|
36
|
+
click_icon :delete
|
37
|
+
end
|
38
|
+
expect(page).not_to have_content("ruby on rails t-shirt")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Regression test for #2228
|
43
|
+
it "should see variant images", js: false do
|
44
|
+
variant = create(:variant)
|
45
|
+
variant.images.create!(attachment: File.open(file_path))
|
46
|
+
visit spree.admin_product_images_path(variant.product)
|
47
|
+
|
48
|
+
expect(page).not_to have_content("No Images Found.")
|
49
|
+
within("table.table") do
|
50
|
+
expect(page).to have_content(variant.options_text)
|
51
|
+
|
52
|
+
#ensure no duplicate images are displayed
|
53
|
+
expect(page).to have_css("tbody tr", count: 1)
|
54
|
+
|
55
|
+
#ensure variant header is displayed
|
56
|
+
within("thead") do
|
57
|
+
expect(page.body).to have_content("Variant")
|
58
|
+
end
|
59
|
+
|
60
|
+
#ensure variant header is displayed
|
61
|
+
within("tbody") do
|
62
|
+
expect(page).to have_content("Size: S")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should not see variant column when product has no variants", js: false do
|
68
|
+
product = create(:product)
|
69
|
+
product.images.create!(attachment: File.open(file_path))
|
70
|
+
visit spree.admin_product_images_path(product)
|
71
|
+
|
72
|
+
expect(page).not_to have_content("No Images Found.")
|
73
|
+
within("table.table") do
|
74
|
+
#ensure no duplicate images are displayed
|
75
|
+
expect(page).to have_css("tbody tr", count: 1)
|
76
|
+
|
77
|
+
#ensure variant header is not displayed
|
78
|
+
within("thead") do
|
79
|
+
expect(page).not_to have_content("Variant")
|
80
|
+
end
|
81
|
+
|
82
|
+
#ensure correct cell count
|
83
|
+
expect(page).to have_css("thead th", count: 3)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe 'Product Details', type: :feature, js: true do
|
5
|
+
stub_authorization!
|
6
|
+
|
7
|
+
context 'editing a product' do
|
8
|
+
it 'should list the product details' do
|
9
|
+
create(:product, name: 'Bún thịt nướng', sku: 'A100',
|
10
|
+
description: 'lorem ipsum', available_on: '2013-08-14 01:02:03')
|
11
|
+
|
12
|
+
visit spree.admin_products_path
|
13
|
+
within_row(1) { click_icon :edit }
|
14
|
+
|
15
|
+
click_link 'Details'
|
16
|
+
|
17
|
+
expect(find('.content-header h1').text.strip).to eq('Products / Bún thịt nướng')
|
18
|
+
expect(find('input#product_name').value).to eq('Bún thịt nướng')
|
19
|
+
expect(find('input#product_slug').value).to eq('bun-th-t-n-ng')
|
20
|
+
expect(find('textarea#product_description').text.strip).to eq('lorem ipsum')
|
21
|
+
expect(find('input#product_price').value).to eq('19.99')
|
22
|
+
expect(find('input#product_cost_price').value).to eq('17.00')
|
23
|
+
expect(find('input#product_available_on').value).to eq("2013/08/14")
|
24
|
+
expect(find('input#product_sku').value).to eq('A100')
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should handle slug changes" do
|
28
|
+
create(:product, name: 'Bún thịt nướng', sku: 'A100',
|
29
|
+
description: 'lorem ipsum', available_on: '2011-01-01 01:01:01')
|
30
|
+
|
31
|
+
visit spree.admin_products_path
|
32
|
+
within('table.table tbody tr:nth-child(1)') do
|
33
|
+
click_icon(:edit)
|
34
|
+
end
|
35
|
+
|
36
|
+
fill_in "product_slug", with: 'random-slug-value'
|
37
|
+
click_button "Update"
|
38
|
+
expect(page).to have_content("successfully updated!")
|
39
|
+
|
40
|
+
fill_in "product_slug", with: 'a'
|
41
|
+
click_button "Update"
|
42
|
+
within('#product_slug_field') { expect(page).to have_content("is too short") }
|
43
|
+
|
44
|
+
fill_in "product_slug", with: 'another-random-slug-value'
|
45
|
+
click_button "Update"
|
46
|
+
expect(page).to have_content("successfully updated!")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Regression test for #3385
|
51
|
+
context "deleting a product" do
|
52
|
+
it "is still able to find the master variant" do
|
53
|
+
create(:product)
|
54
|
+
|
55
|
+
visit spree.admin_products_path
|
56
|
+
within_row(1) do
|
57
|
+
accept_alert do
|
58
|
+
click_icon :delete
|
59
|
+
end
|
60
|
+
end
|
61
|
+
wait_for_ajax
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Product Taxons", type: :feature, js: true do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
after do
|
7
|
+
Capybara.ignore_hidden_elements = true
|
8
|
+
end
|
9
|
+
|
10
|
+
before do
|
11
|
+
Capybara.ignore_hidden_elements = false
|
12
|
+
end
|
13
|
+
|
14
|
+
context "managing taxons" do
|
15
|
+
def selected_taxons
|
16
|
+
find("#product_taxon_ids").value.split(',').map(&:to_i).uniq
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should allow an admin to manage taxons" do
|
20
|
+
taxon_1 = create(:taxon)
|
21
|
+
taxon_2 = create(:taxon, name: 'Clothing')
|
22
|
+
product = create(:product)
|
23
|
+
product.taxons << taxon_1
|
24
|
+
|
25
|
+
visit spree.admin_products_path
|
26
|
+
within_row(1) { click_icon :edit }
|
27
|
+
|
28
|
+
expect(find(".select2-search-choice").text).to eq(taxon_1.name)
|
29
|
+
expect(selected_taxons).to match_array([taxon_1.id])
|
30
|
+
|
31
|
+
select2_search "Clothing", from: "Taxons"
|
32
|
+
click_button "Update"
|
33
|
+
expect(selected_taxons).to match_array([taxon_1.id, taxon_2.id])
|
34
|
+
|
35
|
+
# Regression test for #2139
|
36
|
+
sleep(1)
|
37
|
+
expect(first(".select2-search-choice", text: taxon_1.name)).to be_present
|
38
|
+
expect(first(".select2-search-choice", text: taxon_2.name)).to be_present
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Product Variants", type: :feature, js: true do
|
4
|
+
stub_authorization!
|
5
|
+
|
6
|
+
let!(:product) { create(:product) }
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
visit spree.admin_products_path
|
10
|
+
end
|
11
|
+
|
12
|
+
context "editing variant option types" do
|
13
|
+
it "should allow an admin to create option types for a variant" do
|
14
|
+
within_row(1) { click_icon :edit }
|
15
|
+
|
16
|
+
within('#sidebar') { click_link "Variants" }
|
17
|
+
expect(page).to have_content("To add variants, you must first define")
|
18
|
+
end
|
19
|
+
|
20
|
+
it "allows admin to create a variant if there are option types" do
|
21
|
+
click_link "Products"
|
22
|
+
click_link "Option Types"
|
23
|
+
click_link "new_option_type_link"
|
24
|
+
fill_in "option_type_name", with: "shirt colors"
|
25
|
+
fill_in "option_type_presentation", with: "colors"
|
26
|
+
click_button "Create"
|
27
|
+
expect(page).to have_content("successfully created!")
|
28
|
+
|
29
|
+
page.find('#option_type_option_values_attributes_0_name').set('color')
|
30
|
+
page.find('#option_type_option_values_attributes_0_presentation').set('black')
|
31
|
+
click_button "Update"
|
32
|
+
expect(page).to have_content("successfully updated!")
|
33
|
+
|
34
|
+
visit spree.admin_products_path
|
35
|
+
within_row(1) { click_icon :edit }
|
36
|
+
|
37
|
+
select2_search "shirt", from: "Option Types"
|
38
|
+
click_button "Update"
|
39
|
+
expect(page).to have_content("successfully updated!")
|
40
|
+
|
41
|
+
within('#sidebar') { click_link "Variants" }
|
42
|
+
click_link "New Variant"
|
43
|
+
|
44
|
+
targetted_select2 "black", from: "#s2id_variant_option_value_ids"
|
45
|
+
fill_in "variant_sku", with: "A100"
|
46
|
+
click_button "Create"
|
47
|
+
expect(page).to have_content("successfully created!")
|
48
|
+
|
49
|
+
within(".table") do
|
50
|
+
expect(page).to have_content("19.99")
|
51
|
+
expect(page).to have_content("black")
|
52
|
+
expect(page).to have_content("A100")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|