solidus_backend 2.7.4 → 2.9.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_backend might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +12 -8
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/javascripts/spree/backend.js +0 -2
- data/app/assets/javascripts/spree/backend/adjustments.js +1 -1
- data/app/assets/javascripts/spree/backend/components/sortable_table.js +1 -0
- data/app/assets/javascripts/spree/backend/components/tabs.js +1 -0
- data/app/assets/javascripts/spree/backend/components/tooltips.js +21 -17
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +1 -1
- data/app/assets/javascripts/spree/backend/product_picker.js +1 -1
- data/app/assets/javascripts/spree/backend/shipments.js +7 -1
- data/app/assets/javascripts/spree/backend/stock_management.js +18 -0
- data/app/assets/javascripts/spree/backend/store_credits.js +18 -2
- data/app/assets/javascripts/spree/backend/taxons.js +1 -1
- data/app/assets/javascripts/spree/backend/templates/orders/line_item.hbs +1 -1
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +24 -25
- data/app/assets/javascripts/spree/backend/user_picker.js +1 -1
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js +1 -1
- data/app/assets/javascripts/spree/backend/views/order/customer_select.js +1 -1
- data/app/assets/javascripts/spree/backend/views/order/summary.js +2 -2
- data/app/assets/javascripts/spree/backend/views/stock/add_stock_item.js +15 -4
- data/app/assets/javascripts/spree/backend/views/stock/edit_stock_item_row.js +46 -10
- data/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss +24 -16
- data/app/assets/stylesheets/spree/backend/components/_breadcrumb.scss +12 -0
- data/app/assets/stylesheets/spree/backend/components/_buttons.scss +18 -0
- data/app/assets/stylesheets/spree/backend/components/_image_placeholder.scss +2 -2
- data/app/assets/stylesheets/spree/backend/components/_list_group.scss +2 -2
- data/app/assets/stylesheets/spree/backend/components/_messages.scss +20 -12
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +45 -11
- data/app/assets/stylesheets/spree/backend/components/_progress.scss +3 -3
- data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +1 -2
- data/app/assets/stylesheets/spree/backend/components/_tabs.scss +14 -13
- data/app/assets/stylesheets/spree/backend/globals/_deprecated_variables.scss +24 -0
- data/app/assets/stylesheets/spree/backend/globals/_deprecation.scss +10 -1
- data/app/assets/stylesheets/spree/backend/globals/_functions.scss +2 -0
- data/app/assets/stylesheets/spree/backend/globals/_variables.scss +88 -57
- data/app/assets/stylesheets/spree/backend/globals/_variables_override.scss +1 -0
- data/app/assets/stylesheets/spree/backend/globals/mixins/_caret.scss +1 -1
- data/app/assets/stylesheets/spree/backend/globals/mixins/_line_through.scss +1 -1
- data/app/assets/stylesheets/spree/backend/sections/_log_entries.scss +8 -2
- data/app/assets/stylesheets/spree/backend/sections/_orders.scss +25 -6
- data/app/assets/stylesheets/spree/backend/sections/_products.scss +3 -1
- data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +5 -5
- data/app/assets/stylesheets/spree/backend/sections/_stock_management.scss +77 -2
- data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +4 -4
- data/app/assets/stylesheets/spree/backend/sections/_taxonomies.scss +1 -1
- data/app/assets/stylesheets/spree/backend/shared/_fonts.scss +15 -0
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +27 -7
- data/app/assets/stylesheets/spree/backend/shared/_header.scss +2 -2
- data/app/assets/stylesheets/spree/backend/shared/_icons.scss +5 -1
- data/app/assets/stylesheets/spree/backend/shared/_layout.scss +5 -4
- data/app/assets/stylesheets/spree/backend/shared/_tables.scss +11 -6
- data/app/assets/stylesheets/spree/backend/shared/_typography.scss +10 -6
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +3 -1
- data/app/controllers/spree/admin/cancellations_controller.rb +2 -2
- data/app/controllers/spree/admin/customer_returns_controller.rb +8 -1
- data/app/controllers/spree/admin/locale_controller.rb +1 -1
- data/app/controllers/spree/admin/log_entries_controller.rb +3 -0
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +8 -1
- data/app/controllers/spree/admin/orders_controller.rb +1 -12
- data/app/controllers/spree/admin/products_controller.rb +10 -6
- data/app/controllers/spree/admin/promotion_codes_controller.rb +19 -1
- data/app/controllers/spree/admin/promotions_controller.rb +1 -1
- data/app/controllers/spree/admin/reimbursements_controller.rb +7 -2
- data/app/controllers/spree/admin/resource_controller.rb +1 -0
- data/app/controllers/spree/admin/store_credit_reasons_controller.rb +8 -0
- data/app/controllers/spree/admin/store_credits_controller.rb +11 -11
- data/app/controllers/spree/admin/users_controller.rb +4 -2
- data/app/helpers/spree/admin/base_helper.rb +9 -3
- data/app/helpers/spree/admin/navigation_helper.rb +1 -1
- data/app/helpers/spree/admin/promotions_helper.rb +15 -0
- data/app/models/spree/backend_configuration.rb +38 -21
- data/app/views/spree/admin/cancellations/index.html.erb +3 -1
- data/app/views/spree/admin/images/_image_row.html.erb +1 -1
- data/app/views/spree/admin/images/edit.html.erb +3 -3
- data/app/views/spree/admin/images/index.html.erb +3 -3
- data/app/views/spree/admin/log_entries/index.html.erb +1 -19
- data/app/views/spree/admin/option_types/edit.html.erb +1 -1
- data/app/views/spree/admin/orders/_carton_manifest.html.erb +3 -1
- data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +1 -1
- data/app/views/spree/admin/orders/_shipment_manifest.html.erb +3 -1
- data/app/views/spree/admin/orders/confirm/_line_items.html.erb +3 -2
- data/app/views/spree/admin/orders/confirm/_shipment_manifest.html.erb +3 -1
- data/app/views/spree/admin/orders/index.html.erb +1 -1
- data/app/views/spree/admin/payments/_capture_events.html.erb +15 -18
- data/app/views/spree/admin/payments/_list.html.erb +1 -1
- data/app/views/spree/admin/payments/_log_entries.html.erb +29 -0
- data/app/views/spree/admin/payments/show.html.erb +13 -6
- data/app/views/spree/admin/payments/source_forms/{_storecredit.html.erb → _store_credit.html.erb} +0 -0
- data/app/views/spree/admin/payments/source_views/{_storecredit.html.erb → _store_credit.html.erb} +0 -0
- data/app/views/spree/admin/prices/_form.html.erb +1 -1
- data/app/views/spree/admin/product_properties/index.html.erb +1 -1
- data/app/views/spree/admin/products/_form.html.erb +23 -12
- data/app/views/spree/admin/products/edit.html.erb +5 -0
- data/app/views/spree/admin/products/index.html.erb +3 -1
- data/app/views/spree/admin/promotion_categories/index.html.erb +1 -1
- data/app/views/spree/admin/promotion_code_batches/index.html.erb +1 -1
- data/app/views/spree/admin/promotion_codes/index.html.erb +5 -1
- data/app/views/spree/admin/promotion_codes/new.html.erb +31 -0
- data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
- data/app/views/spree/admin/promotions/_activations_edit.html.erb +1 -1
- data/app/views/spree/admin/promotions/_form.html.erb +6 -5
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/edit.html.erb +3 -1
- data/app/views/spree/admin/promotions/index.html.erb +4 -4
- data/app/views/spree/admin/refunds/new.html.erb +1 -1
- data/app/views/spree/admin/reimbursements/edit.html.erb +2 -2
- data/app/views/spree/admin/shared/_address_form.html.erb +10 -3
- data/app/views/spree/admin/shared/_edit_resource_links.html.erb +1 -1
- data/app/views/spree/admin/shared/_head.html.erb +1 -3
- data/app/views/spree/admin/shared/_image.html.erb +2 -2
- data/app/views/spree/admin/shared/_modal.html.erb +1 -1
- data/app/views/spree/admin/shared/_product_sub_menu.html.erb +1 -1
- data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +4 -0
- data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +3 -3
- data/app/views/spree/admin/shared/_tabs.html.erb +3 -2
- data/app/views/spree/admin/shared/_variant_search.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +10 -10
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +56 -38
- data/app/views/spree/admin/stock_locations/_form.html.erb +133 -121
- data/app/views/spree/admin/stock_locations/edit.html.erb +4 -2
- data/app/views/spree/admin/store_credit_reasons/edit.html.erb +15 -0
- data/app/views/spree/admin/store_credit_reasons/index.html.erb +56 -0
- data/app/views/spree/admin/store_credit_reasons/new.html.erb +18 -0
- data/app/views/spree/admin/store_credit_reasons/shared/_form.html.erb +15 -0
- data/app/views/spree/admin/store_credits/_store_credit_reason_field.html.erb +7 -0
- data/app/views/spree/admin/store_credits/edit_amount.html.erb +1 -1
- data/app/views/spree/admin/store_credits/edit_validity.html.erb +2 -2
- data/app/views/spree/admin/store_credits/index.html.erb +1 -1
- data/app/views/spree/admin/store_credits/show.html.erb +3 -3
- data/app/views/spree/admin/stores/_form.html.erb +1 -0
- data/app/views/spree/admin/style_guide/topics/typography/_colors.html.erb +30 -20
- data/app/views/spree/admin/style_guide/topics/typography/_fonts.html.erb +1 -1
- data/app/views/spree/admin/taxonomies/edit.html.erb +1 -1
- data/app/views/spree/admin/taxons/_form.html.erb +1 -1
- data/app/views/spree/admin/taxons/edit.html.erb +2 -2
- data/app/views/spree/admin/users/edit.html.erb +2 -2
- data/app/views/spree/admin/users/index.html.erb +2 -2
- data/app/views/spree/admin/users/items.html.erb +3 -1
- data/app/views/spree/admin/users/orders.html.erb +1 -1
- data/app/views/spree/admin/variants/_form.html.erb +1 -1
- data/app/views/spree/admin/variants/index.html.erb +1 -1
- data/app/views/spree/admin/zones/_state_members.html.erb +1 -1
- data/config/routes.rb +2 -8
- data/lib/spree/backend.rb +1 -1
- data/solidus_backend.gemspec +3 -4
- data/spec/controllers/spree/admin/base_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +7 -3
- data/spec/controllers/spree/admin/locale_controller_spec.rb +45 -0
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +50 -2
- data/spec/controllers/spree/admin/orders_controller_spec.rb +25 -13
- data/spec/controllers/spree/admin/payments_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/products_controller_spec.rb +72 -0
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +13 -1
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +11 -0
- data/spec/controllers/spree/admin/resource_controller_spec.rb +22 -0
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +7 -7
- data/spec/features/admin/configuration/payment_methods_spec.rb +2 -2
- data/spec/features/admin/configuration/shipping_methods_spec.rb +2 -2
- data/spec/features/admin/homepage_spec.rb +1 -6
- data/spec/features/admin/locale_spec.rb +1 -2
- data/spec/features/admin/orders/adjustments_spec.rb +1 -1
- data/spec/features/admin/orders/customer_details_spec.rb +5 -7
- data/spec/features/admin/orders/customer_returns_spec.rb +28 -0
- data/spec/features/admin/orders/listing_spec.rb +2 -7
- data/spec/features/admin/orders/log_entries_spec.rb +2 -2
- data/spec/features/admin/orders/new_order_spec.rb +117 -0
- data/spec/features/admin/orders/new_refund_spec.rb +35 -0
- data/spec/features/admin/orders/order_details_spec.rb +10 -5
- data/spec/features/admin/orders/payments_spec.rb +82 -41
- data/spec/features/admin/orders/return_payment_state_spec.rb +3 -0
- data/spec/features/admin/orders/shipments_spec.rb +28 -0
- data/spec/features/admin/products/edit/products_spec.rb +25 -0
- data/spec/features/admin/products/edit/taxons_spec.rb +4 -0
- data/spec/features/admin/products/pricing_spec.rb +24 -6
- data/spec/features/admin/products/products_spec.rb +5 -5
- data/spec/features/admin/products/stock_management_spec.rb +27 -13
- data/spec/features/admin/products/variant_spec.rb +1 -1
- data/spec/features/admin/promotion_adjustments_spec.rb +12 -12
- data/spec/features/admin/promotions/option_value_rule_spec.rb +2 -2
- data/spec/features/admin/promotions/product_rule_spec.rb +1 -1
- data/spec/features/admin/promotions/promotion_spec.rb +52 -0
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +1 -1
- data/spec/features/admin/promotions/user_rule_spec.rb +2 -2
- data/spec/features/admin/reimbursements_spec.rb +1 -1
- data/spec/features/admin/store_credits_spec.rb +51 -2
- data/spec/features/admin/taxons_spec.rb +35 -0
- data/spec/features/admin/users_spec.rb +44 -11
- data/spec/helpers/admin/navigation_helper_spec.rb +4 -2
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +2 -2
- data/spec/javascripts/spec_helper.js +2 -0
- data/spec/models/spree/backend_configuration/menu_item_spec.rb +17 -0
- data/spec/models/spree/backend_configuration_spec.rb +22 -0
- data/spec/spec_helper.rb +2 -2
- data/spec/support/appear_before_matcher.rb +1 -1
- data/spec/support/feature/order_feature_helper.rb +1 -1
- data/spec/views/spree/admin/shared/navigation_footer_spec.rb +1 -1
- data/vendor/assets/fonts/inter/Inter-Regular.woff +0 -0
- data/vendor/assets/fonts/inter/Inter-Regular.woff2 +0 -0
- data/vendor/assets/fonts/inter/Inter-SemiBold.woff +0 -0
- data/vendor/assets/fonts/inter/Inter-SemiBold.woff2 +0 -0
- data/vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_en-US.js +10 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_pagination.scss +4 -0
- metadata +38 -36
- data/.eslintrc +0 -21
- data/app/controllers/spree/admin/reports_controller.rb +0 -82
- data/app/views/spree/admin/reports/index.html.erb +0 -19
- data/app/views/spree/admin/reports/sales_total.html.erb +0 -35
- data/app/views/spree/admin/shared/_report_order_criteria.html.erb +0 -19
- data/app/views/spree/admin/store_credits/_update_reason_field.html.erb +0 -7
- data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -133
- data/spec/features/admin/reports_spec.rb +0 -63
@@ -7,9 +7,12 @@ describe "Return payment state spec" do
|
|
7
7
|
|
8
8
|
before do
|
9
9
|
Spree::RefundReason.create!(name: Spree::RefundReason::RETURN_PROCESSING_REASON, mutable: false)
|
10
|
+
allow_any_instance_of(Spree::Admin::ReimbursementsController).to receive(:try_spree_current_user).
|
11
|
+
and_return(user)
|
10
12
|
end
|
11
13
|
|
12
14
|
let!(:order) { create(:shipped_order) }
|
15
|
+
let(:user) { create(:admin_user) }
|
13
16
|
|
14
17
|
# Regression test for https://github.com/spree/spree/issues/6229
|
15
18
|
it "refunds and has outstanding_balance of zero", js: true do
|
@@ -58,6 +58,34 @@ describe "Shipments", type: :feature do
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
context "destroying a shipment", js: true do
|
62
|
+
before do
|
63
|
+
visit spree.admin_path
|
64
|
+
click_link "Orders"
|
65
|
+
within_row(1) do
|
66
|
+
click_link "R100"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "when the line item cannot be found" do
|
71
|
+
it "shows the proper error message" do
|
72
|
+
expect(page).to have_selector '.delete-item'
|
73
|
+
order.shipments.first.line_items.each(&:destroy)
|
74
|
+
accept_alert { first('.delete-item').click }
|
75
|
+
expect(page).to have_content 'The resource you were looking for could not be found.'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "when the shipment has already been shipped" do
|
80
|
+
it "shows the proper error message" do
|
81
|
+
expect(page).to have_selector '.delete-item'
|
82
|
+
order.shipments.first.ship!
|
83
|
+
accept_alert { first('.delete-item').click }
|
84
|
+
expect(page).to have_content 'Cannot remove items from a shipped shipment'
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
61
89
|
context "moving variants between shipments", js: true do
|
62
90
|
let!(:order) { create(:completed_order_with_pending_payment, number: "R100", state: "complete", line_items_count: 5) }
|
63
91
|
let!(:la) { create(:stock_location, name: "LA") }
|
@@ -50,6 +50,31 @@ describe 'Product Details', type: :feature do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
context "when default price is deleted" do
|
54
|
+
it "does not show the master price", js: true do
|
55
|
+
product = create(:product, name: 'Bún thịt nướng', sku: 'A100',
|
56
|
+
description: 'lorem ipsum', available_on: '2013-08-14 01:02:03')
|
57
|
+
|
58
|
+
visit spree.admin_path
|
59
|
+
click_nav "Products"
|
60
|
+
within_row(1) { click_icon :edit }
|
61
|
+
|
62
|
+
click_link 'Prices'
|
63
|
+
|
64
|
+
within "#spree_price_#{product.master.default_price.id}" do
|
65
|
+
accept_alert do
|
66
|
+
click_icon :trash
|
67
|
+
end
|
68
|
+
end
|
69
|
+
expect(page).to have_content("Price has been successfully removed")
|
70
|
+
|
71
|
+
click_link 'Product Details'
|
72
|
+
|
73
|
+
expect(page).not_to have_field('product_price')
|
74
|
+
expect(page).to have_content('This Product has no price in the default currency (USD).')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
53
78
|
# Regression test for https://github.com/spree/spree/issues/3385
|
54
79
|
context "deleting a product", js: true do
|
55
80
|
it "is still able to find the master variant" do
|
@@ -28,7 +28,11 @@ describe "Product Display Order", type: :feature do
|
|
28
28
|
assert_selected_taxons([taxon_1])
|
29
29
|
|
30
30
|
select2_search "Clothing", from: "Taxon"
|
31
|
+
assert_selected_taxons([taxon_1, taxon_2])
|
32
|
+
|
31
33
|
click_button "Update"
|
34
|
+
|
35
|
+
expect(find(".flash")).to have_text "Product \"#{product.name}\" has been successfully updated!"
|
32
36
|
assert_selected_taxons([taxon_1, taxon_2])
|
33
37
|
end
|
34
38
|
|
@@ -65,18 +65,36 @@ describe 'Pricing' do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
context "editing" do
|
68
|
-
let(:
|
69
|
-
let(:
|
70
|
-
|
71
|
-
before do
|
72
|
-
product.master.update(price: 49.99)
|
73
|
-
end
|
68
|
+
let(:product) { create(:product, price: 123.99) }
|
69
|
+
let!(:variant) { product.master }
|
70
|
+
let!(:other_price) { product.master.prices.create(amount: 34.56, currency: "EUR") }
|
74
71
|
|
75
72
|
it 'has a working edit page' do
|
76
73
|
within "#spree_price_#{product.master.prices.first.id}" do
|
77
74
|
click_icon :edit
|
78
75
|
end
|
79
76
|
expect(page).to have_content("Edit Price")
|
77
|
+
|
78
|
+
within("#price_price_field") do
|
79
|
+
expect(page).to have_field('price_price', with: '123.99')
|
80
|
+
end
|
81
|
+
|
82
|
+
fill_in "price_price", with: 999.99
|
83
|
+
click_button "Update"
|
84
|
+
expect(page).to have_content("Price has been successfully updated!")
|
85
|
+
expect(page).to have_content("$999.99")
|
86
|
+
expect(page).to have_content("€34.56")
|
87
|
+
end
|
88
|
+
|
89
|
+
it "will not reset the currency to default" do
|
90
|
+
within "#spree_price_#{other_price.id}" do
|
91
|
+
click_icon :edit
|
92
|
+
end
|
93
|
+
expect(page).to have_content("Edit Price")
|
94
|
+
expect(page).to_not have_field('price_currency', with: 'USD')
|
95
|
+
within("#price_price_field") do
|
96
|
+
expect(page).to have_css('.number-with-currency-addon', text: 'EUR')
|
97
|
+
end
|
80
98
|
end
|
81
99
|
end
|
82
100
|
|
@@ -54,7 +54,7 @@ describe "Products", type: :feature do
|
|
54
54
|
context "currency displaying" do
|
55
55
|
context "using Russian Rubles" do
|
56
56
|
before do
|
57
|
-
|
57
|
+
stub_spree_preferences(currency: "RUB")
|
58
58
|
end
|
59
59
|
|
60
60
|
let!(:product) do
|
@@ -72,7 +72,7 @@ describe "Products", type: :feature do
|
|
72
72
|
end
|
73
73
|
context "when none of the product prices are in the same currency as the default in the store" do
|
74
74
|
before do
|
75
|
-
|
75
|
+
stub_spree_preferences(currency: "MXN")
|
76
76
|
end
|
77
77
|
|
78
78
|
let!(:product) do
|
@@ -80,7 +80,7 @@ describe "Products", type: :feature do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'defaults it to Spree::Config.currency and sets the price as blank' do
|
83
|
-
|
83
|
+
stub_spree_preferences(currency: "USD")
|
84
84
|
visit spree.admin_product_path(product)
|
85
85
|
within("#product_price_field") do
|
86
86
|
expect(page).to have_content("USD")
|
@@ -289,7 +289,7 @@ describe "Products", type: :feature do
|
|
289
289
|
check "Show Deleted"
|
290
290
|
click_button "Search"
|
291
291
|
click_link product.name
|
292
|
-
expect(page).
|
292
|
+
expect(page).to_not have_field('Master Price')
|
293
293
|
expect(page).to_not have_content('Images')
|
294
294
|
expect(page).to_not have_content('Prices')
|
295
295
|
expect(page).to_not have_content('Product Properties')
|
@@ -299,7 +299,7 @@ describe "Products", type: :feature do
|
|
299
299
|
|
300
300
|
context 'with only product permissions' do
|
301
301
|
before do
|
302
|
-
allow_any_instance_of(Spree::Admin::BaseController).to receive(:
|
302
|
+
allow_any_instance_of(Spree::Admin::BaseController).to receive(:try_spree_current_user).and_return(nil)
|
303
303
|
end
|
304
304
|
|
305
305
|
custom_authorization! do |_user|
|
@@ -44,31 +44,45 @@ describe "Product Stock", type: :feature do
|
|
44
44
|
it "can create a positive stock adjustment", js: true do
|
45
45
|
adjust_count_on_hand('14')
|
46
46
|
stock_item.reload
|
47
|
-
expect(stock_item.count_on_hand).to eq
|
47
|
+
expect(stock_item.count_on_hand).to eq 24
|
48
48
|
expect(stock_item.stock_movements.count).to eq 1
|
49
|
-
expect(stock_item.stock_movements.first.quantity).to eq
|
49
|
+
expect(stock_item.stock_movements.first.quantity).to eq 14
|
50
50
|
end
|
51
51
|
|
52
52
|
it "can create a negative stock adjustment", js: true do
|
53
|
-
adjust_count_on_hand('4')
|
53
|
+
adjust_count_on_hand('-4')
|
54
54
|
stock_item.reload
|
55
|
-
expect(stock_item.count_on_hand).to eq
|
55
|
+
expect(stock_item.count_on_hand).to eq 6
|
56
56
|
expect(stock_item.stock_movements.count).to eq 1
|
57
|
-
expect(stock_item.stock_movements.first.quantity).to eq(-
|
57
|
+
expect(stock_item.stock_movements.first.quantity).to eq(-4)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "can toggle backorderable", js: true do
|
61
|
+
toggle_backorderable(value: false)
|
62
|
+
|
63
|
+
click_link "Product Stock"
|
64
|
+
within("tr#spree_variant_#{variant.id}") do
|
65
|
+
expect(find(:css, "input[type='checkbox']")).not_to be_checked
|
66
|
+
end
|
58
67
|
end
|
59
68
|
|
60
69
|
def adjust_count_on_hand(count_on_hand)
|
61
|
-
within(
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
70
|
+
within("tr#spree_variant_#{variant.id}") do
|
71
|
+
find(:css, "input[type='number']").set(count_on_hand)
|
72
|
+
click_icon :check
|
73
|
+
end
|
74
|
+
expect(page).to have_content('Updated Successfully')
|
75
|
+
end
|
76
|
+
|
77
|
+
def toggle_backorderable(value: true)
|
78
|
+
within("tr#spree_variant_#{variant.id}") do
|
79
|
+
find(:css, "input[type='checkbox']").set(value)
|
80
|
+
click_icon :check
|
67
81
|
end
|
68
|
-
expect(page).to have_content('Updated
|
82
|
+
expect(page).to have_content('Updated Successfully')
|
69
83
|
end
|
70
84
|
|
71
|
-
context "with
|
85
|
+
context "with stock locations that don't have stock items for variant yet" do
|
72
86
|
before do
|
73
87
|
create(:stock_location, name: 'Other location', propagate_all_variants: false)
|
74
88
|
end
|
@@ -18,13 +18,13 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
18
18
|
click_button "Create"
|
19
19
|
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
|
20
20
|
|
21
|
-
select "Item
|
21
|
+
select "Item Total", from: "Discount Rules"
|
22
22
|
within('#rule_fields') { click_button "Add" }
|
23
23
|
|
24
24
|
find('[id$=_preferred_amount]').set(30)
|
25
25
|
within('#rule_fields') { click_button "Update" }
|
26
26
|
|
27
|
-
select "Create whole-order adjustment", from: "
|
27
|
+
select "Create whole-order adjustment", from: "Adjustment type"
|
28
28
|
within('#action_fields') do
|
29
29
|
click_button "Add"
|
30
30
|
select "Flat Rate", from: I18n.t('spree.admin.promotions.actions.calculator_label')
|
@@ -55,7 +55,7 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
55
55
|
click_button "Create"
|
56
56
|
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
|
57
57
|
|
58
|
-
select "Create whole-order adjustment", from: "
|
58
|
+
select "Create whole-order adjustment", from: "Adjustment type"
|
59
59
|
within('#action_fields') do
|
60
60
|
click_button "Add"
|
61
61
|
select "Flat Rate", from: I18n.t('spree.admin.promotions.actions.calculator_label')
|
@@ -81,13 +81,13 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
81
81
|
click_button "Create"
|
82
82
|
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
|
83
83
|
|
84
|
-
select "Item
|
84
|
+
select "Item Total", from: "Discount Rules"
|
85
85
|
within('#rule_fields') { click_button "Add" }
|
86
86
|
|
87
87
|
find('[id$=_preferred_amount]').set(30)
|
88
88
|
within('#rule_fields') { click_button "Update" }
|
89
89
|
|
90
|
-
select "Create whole-order adjustment", from: "
|
90
|
+
select "Create whole-order adjustment", from: "Adjustment type"
|
91
91
|
within('#action_fields') do
|
92
92
|
click_button "Add"
|
93
93
|
select "Flat Percent", from: I18n.t('spree.admin.promotions.actions.calculator_label')
|
@@ -118,12 +118,12 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
118
118
|
click_button "Create"
|
119
119
|
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
|
120
120
|
|
121
|
-
select "Product(s)", from: "
|
121
|
+
select "Product(s)", from: "Discount Rules"
|
122
122
|
within("#rule_fields") { click_button "Add" }
|
123
123
|
select2_search "RoR Mug", from: "Choose products"
|
124
124
|
within('#rule_fields') { click_button "Update" }
|
125
125
|
|
126
|
-
select "Create per-line-item adjustment", from: "
|
126
|
+
select "Create per-line-item adjustment", from: "Adjustment type"
|
127
127
|
within('#action_fields') do
|
128
128
|
click_button "Add"
|
129
129
|
select "Percent Per Item", from: I18n.t('spree.admin.promotions.actions.calculator_label')
|
@@ -152,12 +152,12 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
152
152
|
click_button "Create"
|
153
153
|
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
|
154
154
|
|
155
|
-
select "Item
|
155
|
+
select "Item Total", from: "Discount Rules"
|
156
156
|
within('#rule_fields') { click_button "Add" }
|
157
157
|
find('[id$=_preferred_amount]').set(30)
|
158
158
|
within('#rule_fields') { click_button "Update" }
|
159
159
|
|
160
|
-
select "Free
|
160
|
+
select "Free Shipping", from: "Adjustment type"
|
161
161
|
within('#action_fields') { click_button "Add" }
|
162
162
|
expect(page).to have_content('Makes all shipments for the order free')
|
163
163
|
|
@@ -205,12 +205,12 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
205
205
|
click_button "Create"
|
206
206
|
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
|
207
207
|
|
208
|
-
select "Item
|
208
|
+
select "Item Total", from: "Discount Rules"
|
209
209
|
within('#rule_fields') { click_button "Add" }
|
210
210
|
find('[id$=_preferred_amount]').set(50)
|
211
211
|
within('#rule_fields') { click_button "Update" }
|
212
212
|
|
213
|
-
select "Create whole-order adjustment", from: "
|
213
|
+
select "Create whole-order adjustment", from: "Adjustment type"
|
214
214
|
within('#action_fields') do
|
215
215
|
click_button "Add"
|
216
216
|
select "Flat Rate", from: I18n.t('spree.admin.promotions.actions.calculator_label')
|
@@ -257,7 +257,7 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
257
257
|
click_button "Create"
|
258
258
|
expect(page).to have_title("SAVE SAVE SAVE - Promotions")
|
259
259
|
|
260
|
-
select "Create per-line-item adjustment", from: "
|
260
|
+
select "Create per-line-item adjustment", from: "Adjustment type"
|
261
261
|
within('#action_fields') do
|
262
262
|
click_button "Add"
|
263
263
|
select "Complex Calculator", from: I18n.t('spree.admin.promotions.actions.calculator_label')
|
@@ -16,7 +16,7 @@ feature 'Promotion with option value rule' do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
scenario "adding an option value rule", js: true do
|
19
|
-
select "Option Value(s)", from: "
|
19
|
+
select "Option Value(s)", from: "Discount Rules"
|
20
20
|
within("#rules_container") { click_button "Add" }
|
21
21
|
|
22
22
|
within("#rules_container .promotion-block") do
|
@@ -46,7 +46,7 @@ feature 'Promotion with option value rule' do
|
|
46
46
|
option_value.update!(name: xss_string)
|
47
47
|
end
|
48
48
|
scenario "adding an option value rule", js: true do
|
49
|
-
select "Option Value(s)", from: "
|
49
|
+
select "Option Value(s)", from: "Discount Rules"
|
50
50
|
within("#rules_container") { click_button "Add" }
|
51
51
|
|
52
52
|
within("#rules_container .promotion-block") do
|
@@ -12,7 +12,7 @@ feature 'Promotion with product rule', js: true do
|
|
12
12
|
given(:promotion) { create :promotion }
|
13
13
|
|
14
14
|
def add_promotion_rule_of_type(type)
|
15
|
-
select type, from: "
|
15
|
+
select type, from: "Discount Rules"
|
16
16
|
within("#rules_container") { click_button "Add" }
|
17
17
|
end
|
18
18
|
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
feature 'Promotions' do
|
6
|
+
stub_authorization!
|
7
|
+
|
8
|
+
context 'index' do
|
9
|
+
context 'when no promotions' do
|
10
|
+
scenario 'shows no promotions found message' do
|
11
|
+
visit spree.admin_promotions_path
|
12
|
+
expect(page).to have_content('No Promotions found.')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'when promotion is active' do
|
17
|
+
given!(:promotion) { create :promotion }
|
18
|
+
|
19
|
+
scenario 'promotion status is active' do
|
20
|
+
visit spree.admin_promotions_path
|
21
|
+
|
22
|
+
within_row(1) do
|
23
|
+
expect(column_text(3)).to eq("Active")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'when promotion is in the future' do
|
29
|
+
given!(:promotion) { create :promotion, starts_at: 1.day.after }
|
30
|
+
|
31
|
+
scenario 'promotion status is not started' do
|
32
|
+
visit spree.admin_promotions_path
|
33
|
+
|
34
|
+
within_row(1) do
|
35
|
+
expect(column_text(3)).to eq("Not started")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'when promotion is in the past' do
|
41
|
+
given!(:promotion) { create :promotion, expires_at: 1.day.ago }
|
42
|
+
|
43
|
+
scenario 'promotion status is expired' do
|
44
|
+
visit spree.admin_promotions_path
|
45
|
+
|
46
|
+
within_row(1) do
|
47
|
+
expect(column_text(3)).to eq("Expired")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -12,7 +12,7 @@ feature "Tiered Calculator Promotions" do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
scenario "adding a tiered percent calculator", js: true do
|
15
|
-
select "Create whole-order adjustment", from: "
|
15
|
+
select "Create whole-order adjustment", from: "Adjustment type"
|
16
16
|
within('#action_fields') { click_button "Add" }
|
17
17
|
|
18
18
|
select "Tiered Percent", from: I18n.t('spree.admin.promotions.actions.calculator_label')
|
@@ -16,7 +16,7 @@ feature 'Promotion with user rule', js: true do
|
|
16
16
|
let!(:other_user) { create(:user, email: 'bar@example.com') }
|
17
17
|
|
18
18
|
scenario "searching a user" do
|
19
|
-
select "User", from: "
|
19
|
+
select "User", from: "Discount Rules"
|
20
20
|
within("#rules_container") { click_button "Add" }
|
21
21
|
|
22
22
|
select2_search "foo", from: "Choose users", select: false
|
@@ -31,7 +31,7 @@ feature 'Promotion with user rule', js: true do
|
|
31
31
|
given!(:user) { create(:user, email: xss_string) }
|
32
32
|
|
33
33
|
scenario "adding an option value rule" do
|
34
|
-
select "User", from: "
|
34
|
+
select "User", from: "Discount Rules"
|
35
35
|
within("#rules_container") { click_button "Add" }
|
36
36
|
|
37
37
|
select2_search "<script>", from: "Choose users"
|