solidus_backend 2.10.5 → 2.11.0
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/app/assets/javascripts/spree/backend.js +4 -1
- data/app/assets/javascripts/spree/backend/adjustments.js +1 -1
- data/app/assets/javascripts/spree/backend/admin.js +18 -29
- data/app/assets/javascripts/spree/backend/collections/states.js +1 -1
- data/app/assets/javascripts/spree/backend/components/selectable_table.js +5 -0
- data/app/assets/javascripts/spree/backend/components/selectable_table/return_items.js +5 -0
- data/app/assets/javascripts/spree/backend/components/selectable_table/summary.js +7 -0
- data/app/assets/javascripts/spree/backend/components/sortable_table.js +31 -25
- data/app/assets/javascripts/spree/backend/models/order.js +3 -3
- data/app/assets/javascripts/spree/backend/models/payment.js +1 -1
- data/app/assets/javascripts/spree/backend/models/shipment.js +1 -1
- data/app/assets/javascripts/spree/backend/models/stock_item.js +1 -1
- 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/product_picker.js +2 -2
- data/app/assets/javascripts/spree/backend/routes.js +40 -21
- data/app/assets/javascripts/spree/backend/shipments.js +5 -5
- data/app/assets/javascripts/spree/backend/shipping_methods/stock_locations_picker.js +18 -0
- data/app/assets/javascripts/spree/backend/stock_management.js +4 -2
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/taxons.js +3 -3
- data/app/assets/javascripts/spree/backend/templates/index.js +2 -0
- data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +2 -2
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +5 -1
- data/app/assets/javascripts/spree/backend/templates/tables/return_item_sum_amount.hbs +7 -0
- data/app/assets/javascripts/spree/backend/templates/tables/selectable_label.hbs +6 -0
- data/app/assets/javascripts/spree/backend/user_picker.js +3 -4
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/views/cart/empty_cart_button.js +2 -2
- data/app/assets/javascripts/spree/backend/views/index.js +4 -0
- data/app/assets/javascripts/spree/backend/views/order/address.js +1 -1
- data/app/assets/javascripts/spree/backend/views/order/customer_select.js +2 -3
- data/app/assets/javascripts/spree/backend/views/order/details_adjustments.js +4 -1
- data/app/assets/javascripts/spree/backend/views/stock/edit_stock_item_row.js +4 -0
- data/app/assets/javascripts/spree/backend/views/tables/return_items.js +9 -0
- data/app/assets/javascripts/spree/backend/views/tables/selectable_table.js +70 -0
- data/app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js +32 -0
- data/app/assets/javascripts/spree/backend/views/tables/selectable_table/summary.js +45 -0
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +4 -5
- data/app/assets/stylesheets/spree/backend/sections/_orders.scss +5 -1
- data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +4 -0
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +1 -0
- data/app/controllers/spree/admin/base_controller.rb +6 -0
- data/app/controllers/spree/admin/cancellations_controller.rb +2 -0
- data/app/controllers/spree/admin/customer_returns_controller.rb +4 -4
- data/app/controllers/spree/admin/images_controller.rb +2 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -0
- data/app/controllers/spree/admin/orders_controller.rb +7 -2
- data/app/controllers/spree/admin/payments_controller.rb +3 -1
- data/app/controllers/spree/admin/product_properties_controller.rb +1 -1
- data/app/controllers/spree/admin/products_controller.rb +18 -24
- data/app/controllers/spree/admin/promotion_codes_controller.rb +9 -4
- data/app/controllers/spree/admin/refunds_controller.rb +19 -0
- data/app/controllers/spree/admin/resource_controller.rb +27 -7
- data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
- data/app/controllers/spree/admin/root_controller.rb +1 -1
- data/app/controllers/spree/admin/search_controller.rb +1 -2
- data/app/controllers/spree/admin/stock_items_controller.rb +6 -5
- data/app/controllers/spree/admin/stock_locations_controller.rb +4 -0
- data/app/controllers/spree/admin/stock_movements_controller.rb +7 -0
- data/app/controllers/spree/admin/taxons_controller.rb +12 -1
- data/app/controllers/spree/admin/users/api_key_controller.rb +29 -0
- data/app/controllers/spree/admin/users_controller.rb +37 -20
- data/app/controllers/spree/admin/variants_controller.rb +4 -2
- data/app/controllers/spree/admin/zones_controller.rb +1 -1
- data/app/helpers/spree/admin/base_helper.rb +4 -0
- data/app/helpers/spree/admin/customer_returns_helper.rb +1 -1
- data/app/helpers/spree/admin/navigation_helper.rb +1 -1
- data/app/helpers/spree/admin/orders_helper.rb +8 -4
- data/app/helpers/spree/admin/stock_movements_helper.rb +8 -4
- data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +2 -3
- data/app/views/spree/admin/images/index.html.erb +25 -21
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +8 -1
- data/app/views/spree/admin/option_types/edit.html.erb +3 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +13 -13
- data/app/views/spree/admin/orders/index.html.erb +23 -13
- data/app/views/spree/admin/payment_methods/_form.html.erb +7 -2
- data/app/views/spree/admin/payments/index.html.erb +3 -1
- data/app/views/spree/admin/prices/_master_variant_table.html.erb +3 -3
- data/app/views/spree/admin/prices/_table.html.erb +3 -3
- data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +7 -2
- data/app/views/spree/admin/product_properties/index.html.erb +14 -2
- data/app/views/spree/admin/products/_form.html.erb +13 -2
- data/app/views/spree/admin/products/index.html.erb +1 -1
- data/app/views/spree/admin/promotion_codes/index.html.erb +1 -1
- data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
- data/app/views/spree/admin/promotions/_activations_new.html.erb +1 -1
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/edit.html.erb +2 -2
- data/app/views/spree/admin/promotions/index.html.erb +12 -5
- data/app/views/spree/admin/return_authorizations/_form.html.erb +3 -10
- data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
- data/app/views/spree/admin/search/users.json.jbuilder +15 -1
- data/app/views/spree/admin/shared/_address.html.erb +6 -6
- data/app/views/spree/admin/shared/_address_form.html.erb +15 -8
- data/app/views/spree/admin/shared/_order_submenu.html.erb +4 -4
- data/app/views/spree/admin/shared/_payments_tabs.html.erb +1 -1
- data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +5 -5
- data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +6 -6
- data/app/views/spree/admin/shared/_shipping_tabs.html.erb +3 -3
- data/app/views/spree/admin/shared/_taxes_tabs.html.erb +2 -2
- data/app/views/spree/admin/shared/preference_fields/_encrypted_string.html.erb +12 -0
- data/app/views/spree/admin/shipping_methods/_form.html.erb +18 -0
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/edit.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/index.html.erb +3 -1
- data/app/views/spree/admin/stock_movements/index.html.erb +30 -1
- data/app/views/spree/admin/stores/_form.html.erb +6 -0
- data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +27 -3
- data/app/views/spree/admin/tax_categories/_form.html.erb +1 -0
- data/app/views/spree/admin/users/_form.html.erb +2 -2
- data/app/views/spree/admin/users/_tabs.html.erb +1 -1
- data/app/views/spree/admin/users/edit.html.erb +4 -4
- data/app/views/spree/admin/users/items.html.erb +5 -3
- data/app/views/spree/admin/users/orders.html.erb +5 -3
- data/app/views/spree/admin/variants/_table_filter.html.erb +1 -1
- data/app/views/spree/admin/variants/index.html.erb +2 -2
- data/config/initializers/form_builder.rb +2 -2
- data/lib/spree/backend/engine.rb +0 -2
- data/lib/spree/backend_configuration.rb +14 -1
- data/solidus_backend.gemspec +4 -4
- metadata +21 -120
- data/app/assets/javascripts/spree/backend/returns/return_item_selection.js +0 -35
- data/script/rails +0 -10
- data/spec/controllers/spree/admin/base_controller_spec.rb +0 -26
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -83
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -235
- data/spec/controllers/spree/admin/locale_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -128
- data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -408
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -95
- data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -194
- data/spec/controllers/spree/admin/prices_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/product_properties_controller_spec.rb +0 -71
- data/spec/controllers/spree/admin/products_controller_spec.rb +0 -270
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -23
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -32
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -36
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -35
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -137
- data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -201
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -291
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -29
- data/spec/controllers/spree/admin/root_controller_spec.rb +0 -43
- data/spec/controllers/spree/admin/search_controller_spec.rb +0 -106
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -16
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -52
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -44
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -311
- data/spec/controllers/spree/admin/users_controller_spec.rb +0 -287
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -71
- data/spec/features/admin/configuration/payment_methods_spec.rb +0 -176
- data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -126
- data/spec/features/admin/configuration/stock_locations_spec.rb +0 -54
- data/spec/features/admin/configuration/store_spec.rb +0 -62
- data/spec/features/admin/configuration/tax_categories_spec.rb +0 -58
- data/spec/features/admin/configuration/tax_rates_spec.rb +0 -31
- data/spec/features/admin/configuration/taxonomies_spec.rb +0 -61
- data/spec/features/admin/configuration/zones_spec.rb +0 -41
- data/spec/features/admin/homepage_spec.rb +0 -86
- data/spec/features/admin/javascript_format_money_spec.rb +0 -22
- data/spec/features/admin/locale_spec.rb +0 -34
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -55
- data/spec/features/admin/orders/adjustments_spec.rb +0 -130
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -45
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -50
- data/spec/features/admin/orders/customer_details_spec.rb +0 -203
- data/spec/features/admin/orders/customer_returns_spec.rb +0 -41
- data/spec/features/admin/orders/line_items_spec.rb +0 -52
- data/spec/features/admin/orders/listing_spec.rb +0 -186
- data/spec/features/admin/orders/log_entries_spec.rb +0 -56
- data/spec/features/admin/orders/new_order_spec.rb +0 -379
- data/spec/features/admin/orders/new_refund_spec.rb +0 -35
- data/spec/features/admin/orders/order_details_spec.rb +0 -591
- data/spec/features/admin/orders/payments_spec.rb +0 -330
- data/spec/features/admin/orders/return_authorizations_spec.rb +0 -56
- data/spec/features/admin/orders/return_payment_state_spec.rb +0 -65
- data/spec/features/admin/orders/risk_analysis_spec.rb +0 -49
- data/spec/features/admin/orders/shipments_spec.rb +0 -145
- data/spec/features/admin/payments/store_credits_spec.rb +0 -23
- data/spec/features/admin/products/edit/images_spec.rb +0 -76
- data/spec/features/admin/products/edit/products_spec.rb +0 -92
- data/spec/features/admin/products/edit/taxons_spec.rb +0 -57
- data/spec/features/admin/products/edit/variants_spec.rb +0 -63
- data/spec/features/admin/products/option_types_spec.rb +0 -116
- data/spec/features/admin/products/pricing_spec.rb +0 -127
- data/spec/features/admin/products/products_spec.rb +0 -348
- data/spec/features/admin/products/properties_spec.rb +0 -141
- data/spec/features/admin/products/stock_management_spec.rb +0 -101
- data/spec/features/admin/products/variant_spec.rb +0 -89
- data/spec/features/admin/promotion_adjustments_spec.rb +0 -286
- data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -90
- data/spec/features/admin/promotions/product_rule_spec.rb +0 -35
- data/spec/features/admin/promotions/promotion_categories_spec.rb +0 -83
- data/spec/features/admin/promotions/promotion_code_batches_spec.rb +0 -37
- data/spec/features/admin/promotions/promotion_code_spec.rb +0 -31
- data/spec/features/admin/promotions/promotion_spec.rb +0 -52
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -76
- data/spec/features/admin/promotions/user_rule_spec.rb +0 -42
- data/spec/features/admin/reimbursements_spec.rb +0 -18
- data/spec/features/admin/store_credits_spec.rb +0 -132
- data/spec/features/admin/stores_spec.rb +0 -37
- data/spec/features/admin/style_guide_spec.rb +0 -14
- data/spec/features/admin/taxons_spec.rb +0 -90
- data/spec/features/admin/users_spec.rb +0 -412
- data/spec/fixtures/files/ror_ringer.jpeg +0 -0
- data/spec/helpers/admin/base_helper_spec.rb +0 -49
- data/spec/helpers/admin/navigation_helper_spec.rb +0 -139
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -97
- data/spec/helpers/promotion_rules_helper_spec.rb +0 -14
- data/spec/javascripts/fixtures/_boot.html.erb +0 -8
- data/spec/javascripts/fixtures/number_with_currency/with_currency_select.html.erb +0 -3
- data/spec/javascripts/fixtures/number_with_currency/without_select.html.erb +0 -3
- data/spec/javascripts/format_money_spec.js +0 -48
- data/spec/javascripts/spec_helper.js +0 -13
- data/spec/javascripts/support/show_errors.js +0 -8
- data/spec/javascripts/support/with_translations.js +0 -11
- data/spec/javascripts/translation_spec.js +0 -58
- data/spec/javascripts/views/number_with_currency_spec.js +0 -72
- data/spec/lib/spree/backend_configuration/menu_item_spec.rb +0 -17
- data/spec/lib/spree/backend_configuration_spec.rb +0 -22
- data/spec/spec_helper.rb +0 -123
- data/spec/support/appear_before_matcher.rb +0 -10
- data/spec/support/feature/base_feature_helper.rb +0 -17
- data/spec/support/feature/order_feature_helper.rb +0 -27
- data/spec/teaspoon_env.rb +0 -51
- data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
- data/spec/views/spree/admin/shared/navigation_footer_spec.rb +0 -67
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Tax Categories", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
visit spree.admin_path
|
10
|
-
click_link "Taxes"
|
11
|
-
end
|
12
|
-
|
13
|
-
context "admin visiting tax categories list" do
|
14
|
-
it "should display the existing tax categories" do
|
15
|
-
create(:tax_category, name: "Clothing", tax_code: "CL001", description: "For Clothing")
|
16
|
-
click_link "Tax Categories"
|
17
|
-
expect(page).to have_content("SettingsTaxesTax Categories")
|
18
|
-
within_row(1) do
|
19
|
-
expect(column_text(1)).to eq("Clothing")
|
20
|
-
expect(column_text(2)).to eq("CL001")
|
21
|
-
expect(column_text(3)).to eq("For Clothing")
|
22
|
-
expect(column_text(4)).to eq("No")
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "admin creating new tax category" do
|
28
|
-
before(:each) do
|
29
|
-
click_link "Tax Categories"
|
30
|
-
click_link "admin_new_tax_categories_link"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should be able to create new tax category" do
|
34
|
-
expect(page).to have_content("New Tax Category")
|
35
|
-
fill_in "tax_category_name", with: "sports goods"
|
36
|
-
fill_in "tax_category_description", with: "sports goods desc"
|
37
|
-
click_button "Create"
|
38
|
-
expect(page).to have_content("successfully created!")
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should show validation errors if there are any" do
|
42
|
-
click_button "Create"
|
43
|
-
expect(page).to have_content("Name can't be blank")
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "admin editing a tax category" do
|
48
|
-
it "should be able to update an existing tax category" do
|
49
|
-
create(:tax_category)
|
50
|
-
click_link "Tax Categories"
|
51
|
-
within_row(1) { click_icon :edit }
|
52
|
-
fill_in "tax_category_description", with: "desc 99"
|
53
|
-
click_button "Update"
|
54
|
-
expect(page).to have_content("successfully updated!")
|
55
|
-
expect(page).to have_content("desc 99")
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Tax Rates", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
let!(:tax_rate) { create(:tax_rate, calculator: stub_model(Spree::Calculator)) }
|
9
|
-
|
10
|
-
before do
|
11
|
-
visit spree.admin_path
|
12
|
-
click_link "Taxes"
|
13
|
-
end
|
14
|
-
|
15
|
-
# Regression test for https://github.com/spree/spree/issues/535
|
16
|
-
it "can see a tax rate in the list if the tax category has been deleted" do
|
17
|
-
tax_rate.tax_categories.first.update_column(:deleted_at, Time.current)
|
18
|
-
click_link "Tax Rates"
|
19
|
-
|
20
|
-
expect(find("table tbody td:nth-child(3)")).to have_content('N/A')
|
21
|
-
end
|
22
|
-
|
23
|
-
# Regression test for https://github.com/spree/spree/issues/1422
|
24
|
-
it "can create a new tax rate" do
|
25
|
-
click_link "Tax Rates"
|
26
|
-
click_link "New Tax Rate"
|
27
|
-
fill_in "Rate", with: "0.05"
|
28
|
-
click_button "Create"
|
29
|
-
expect(page).to have_content("Tax Rate has been successfully created!")
|
30
|
-
end
|
31
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Taxonomies", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
visit spree.admin_path
|
10
|
-
click_link "Settings"
|
11
|
-
end
|
12
|
-
|
13
|
-
context "show" do
|
14
|
-
it "should display existing taxonomies" do
|
15
|
-
create(:taxonomy, name: 'Brand')
|
16
|
-
create(:taxonomy, name: 'Categories')
|
17
|
-
click_nav "Products", "Taxonomies"
|
18
|
-
within_row(1) { expect(page).to have_content("Brand") }
|
19
|
-
within_row(2) { expect(page).to have_content("Categories") }
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
context "create" do
|
24
|
-
before(:each) do
|
25
|
-
click_nav "Products", "Taxonomies"
|
26
|
-
click_link "admin_new_taxonomy_link"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should allow an admin to create a new taxonomy" do
|
30
|
-
expect(page).to have_content("New Taxonomy")
|
31
|
-
fill_in "taxonomy_name", with: "sports"
|
32
|
-
click_button "Create"
|
33
|
-
expect(page).to have_content("successfully created!")
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should display validation errors" do
|
37
|
-
fill_in "taxonomy_name", with: ""
|
38
|
-
click_button "Create"
|
39
|
-
expect(page).to have_content("can't be blank")
|
40
|
-
end
|
41
|
-
|
42
|
-
it "disables the button at submit", :js do
|
43
|
-
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
|
44
|
-
fill_in "taxonomy_name", with: "sports"
|
45
|
-
click_button "Create"
|
46
|
-
expect(page).to have_button("Create", disabled: true)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context "edit" do
|
51
|
-
it "should allow an admin to update an existing taxonomy" do
|
52
|
-
create(:taxonomy)
|
53
|
-
click_nav "Products", "Taxonomies"
|
54
|
-
within_row(1) { click_icon :edit }
|
55
|
-
fill_in "taxonomy_name", with: "sports 99"
|
56
|
-
click_button "Update"
|
57
|
-
expect(page).to have_content("successfully updated!")
|
58
|
-
expect(page).to have_content("sports 99")
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Zones", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
Spree::Zone.delete_all
|
10
|
-
visit spree.admin_path
|
11
|
-
click_link "Zones"
|
12
|
-
end
|
13
|
-
|
14
|
-
context "show" do
|
15
|
-
it "should display existing zones" do
|
16
|
-
create(:zone, name: "eastern", description: "zone is eastern")
|
17
|
-
create(:zone, name: "western", description: "cool san fran")
|
18
|
-
click_link "Zones"
|
19
|
-
|
20
|
-
within_row(1) { expect(page).to have_content("eastern") }
|
21
|
-
within_row(2) { expect(page).to have_content("western") }
|
22
|
-
|
23
|
-
click_link "zones_order_by_description_title"
|
24
|
-
|
25
|
-
within_row(1) { expect(page).to have_content("western") }
|
26
|
-
within_row(2) { expect(page).to have_content("eastern") }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context "create" do
|
31
|
-
it "should allow an admin to create a new zone" do
|
32
|
-
click_link "Zones"
|
33
|
-
click_link "admin_new_zone_link"
|
34
|
-
expect(page).to have_content("New Zone")
|
35
|
-
fill_in "zone_name", with: "japan"
|
36
|
-
fill_in "zone_description", with: "japanese time zone"
|
37
|
-
click_button "Create"
|
38
|
-
expect(page).to have_content("successfully created!")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Homepage", type: :feature do
|
6
|
-
context 'as admin user' do
|
7
|
-
stub_authorization!
|
8
|
-
|
9
|
-
context "visiting the homepage" do
|
10
|
-
before(:each) do
|
11
|
-
visit spree.admin_path
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should have a link to overview" do
|
15
|
-
within(".admin-nav-header") { expect(page).to have_link(nil, href: "/admin") }
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should have a link to orders" do
|
19
|
-
expect(page).to have_link("Orders", href: "/admin/orders")
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should have a link to products" do
|
23
|
-
expect(page).to have_link("Products", href: "/admin/products", count: 2)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should have a link to configuration" do
|
27
|
-
expect(page).to have_link("Settings", href: "/admin/stores")
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should have a link to promotions" do
|
31
|
-
expect(page).to have_link("Promotions", href: "/admin/promotions", count: 2)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "visiting the products tab" do
|
36
|
-
before(:each) do
|
37
|
-
visit spree.admin_products_path
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should have a link to products" do
|
41
|
-
within('.selected .admin-subnav') { expect(page).to have_link("Products", href: "/admin/products") }
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should have a link to option types" do
|
45
|
-
within('.selected .admin-subnav') { expect(page).to have_link("Option Types", href: "/admin/option_types") }
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should have a link to property types" do
|
49
|
-
within('.selected .admin-subnav') { expect(page).to have_link("Property Types", href: "/admin/properties") }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context "visiting the promotions tab" do
|
54
|
-
before(:each) do
|
55
|
-
visit spree.admin_promotions_path
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should have a link to promotions" do
|
59
|
-
within('.selected .admin-subnav') { expect(page).to have_link("Promotions", href: "/admin/promotions") }
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should have a link to promotion categories" do
|
63
|
-
within('.selected .admin-subnav') { expect(page).to have_link("Promotion Categories", href: "/admin/promotion_categories") }
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'as fakedispatch user' do
|
69
|
-
before do
|
70
|
-
allow_any_instance_of(Spree::Admin::BaseController).to receive(:try_spree_current_user).and_return(nil)
|
71
|
-
end
|
72
|
-
|
73
|
-
custom_authorization! do |_user|
|
74
|
-
can [:admin, :home], :dashboards
|
75
|
-
can [:admin, :edit, :index, :read], Spree::Order
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'should only display tabs fakedispatch has access to' do
|
79
|
-
visit spree.admin_path
|
80
|
-
expect(page).to have_link('Orders')
|
81
|
-
expect(page).not_to have_link('Products')
|
82
|
-
expect(page).not_to have_link('Promotions')
|
83
|
-
expect(page).not_to have_link('Settings')
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
RSpec.describe 'JS Spree.formatMoney', js: true do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
# This is a slightly hacky spec to ensure that our JS will format money in
|
9
|
-
# the same was as our ruby code.
|
10
|
-
# This should probably replaced with a pure JS test in the future.
|
11
|
-
it 'should behave identically to Spree::Money#to_s' do
|
12
|
-
visit '/admin'
|
13
|
-
|
14
|
-
Money::Currency.all.map(&:id).map(&:to_s).map(&:upcase).uniq.each do |currency|
|
15
|
-
money = Spree::Money.new(1234, currency: currency)
|
16
|
-
|
17
|
-
js_result = page.evaluate_script("Spree.formatMoney(#{money.to_d}, '#{currency}')")
|
18
|
-
|
19
|
-
expect(js_result).to eq money.to_s
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "setting locale", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
before do
|
9
|
-
ActionView::Base.raise_on_missing_translations = false
|
10
|
-
I18n.locale = I18n.default_locale
|
11
|
-
I18n.backend.store_translations(:fr,
|
12
|
-
date: {
|
13
|
-
month_names: []
|
14
|
-
},
|
15
|
-
spree: {
|
16
|
-
i18n: { this_file_language: "Français" },
|
17
|
-
admin: {
|
18
|
-
tab: { orders: "Ordres" }
|
19
|
-
},
|
20
|
-
listing_orders: "Ordres"
|
21
|
-
})
|
22
|
-
stub_spree_preferences(Spree::Backend::Config, locale: "fr")
|
23
|
-
end
|
24
|
-
|
25
|
-
after do
|
26
|
-
I18n.locale = I18n.default_locale
|
27
|
-
ActionView::Base.raise_on_missing_translations = true
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should be in french" do
|
31
|
-
visit spree.admin_path
|
32
|
-
expect(page).to have_content("Ordres")
|
33
|
-
end
|
34
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Adjustments Promotions", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
before(:each) do
|
9
|
-
create(:promotion_with_item_adjustment,
|
10
|
-
name: "$10 off",
|
11
|
-
path: 'test',
|
12
|
-
code: "10_off",
|
13
|
-
starts_at: 1.day.ago,
|
14
|
-
expires_at: 1.day.from_now,
|
15
|
-
adjustment_rate: 10)
|
16
|
-
|
17
|
-
order = create(:order_with_totals)
|
18
|
-
line_item = order.line_items.first
|
19
|
-
# so we can be sure of a determinate price in our assertions
|
20
|
-
line_item.update_column(:price, 10)
|
21
|
-
|
22
|
-
visit spree.admin_order_adjustments_path(order)
|
23
|
-
end
|
24
|
-
|
25
|
-
context "admin adding a promotion" do
|
26
|
-
context "successfully" do
|
27
|
-
it "should create a new adjustment", js: true do
|
28
|
-
fill_in "coupon_code", with: "10_off"
|
29
|
-
click_button "Add Coupon Code"
|
30
|
-
expect(page).to have_content("$10 off")
|
31
|
-
expect(page).to have_content("-$10.00")
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "for non-existing promotion" do
|
36
|
-
it "should show an error message", js: true do
|
37
|
-
fill_in "coupon_code", with: "does_not_exist"
|
38
|
-
click_button "Add Coupon Code"
|
39
|
-
expect(page).to have_content("doesn't exist.")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "for already applied promotion" do
|
44
|
-
it "should show an error message", js: true do
|
45
|
-
fill_in "coupon_code", with: "10_off"
|
46
|
-
click_button "Add Coupon Code"
|
47
|
-
expect(page).to have_content('-$10.00')
|
48
|
-
|
49
|
-
fill_in "coupon_code", with: "10_off"
|
50
|
-
click_button "Add Coupon Code"
|
51
|
-
expect(page).to have_content("already been applied")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,130 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Adjustments", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
let!(:ship_address) { create(:address) }
|
9
|
-
let!(:tax_zone) { create(:global_zone) } # will include the above address
|
10
|
-
let!(:tax_rate) { create(:tax_rate, amount: 0.20, zone: tax_zone, tax_categories: [tax_category]) }
|
11
|
-
|
12
|
-
let!(:order) do
|
13
|
-
create(
|
14
|
-
:completed_order_with_totals,
|
15
|
-
line_items_attributes: [{ price: 10, variant: variant }] * 5,
|
16
|
-
ship_address: ship_address,
|
17
|
-
)
|
18
|
-
end
|
19
|
-
let!(:line_item) { order.line_items[0] }
|
20
|
-
|
21
|
-
let(:tax_category) { create(:tax_category) }
|
22
|
-
let(:variant) { create(:variant, tax_category: tax_category) }
|
23
|
-
|
24
|
-
let!(:adjustment) { order.adjustments.create!(order: order, label: 'Rebate', amount: 10) }
|
25
|
-
|
26
|
-
before(:each) do
|
27
|
-
order.recalculate
|
28
|
-
|
29
|
-
visit spree.admin_path
|
30
|
-
click_link "Orders"
|
31
|
-
within_row(1) { click_icon :edit }
|
32
|
-
click_link "Adjustments"
|
33
|
-
end
|
34
|
-
|
35
|
-
context "admin managing adjustments" do
|
36
|
-
it "should display the correct values for existing order adjustments" do
|
37
|
-
within first('table tr', text: 'Tax') do
|
38
|
-
expect(column_text(2)).to match(/TaxCategory - \d+ 20\.000%/)
|
39
|
-
expect(column_text(3)).to eq("$2.00")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
it "only shows eligible adjustments" do
|
44
|
-
expect(page).not_to have_content("ineligible")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "admin creating a new adjustment" do
|
49
|
-
before(:each) do
|
50
|
-
click_link "New Adjustment"
|
51
|
-
end
|
52
|
-
|
53
|
-
context "successfully" do
|
54
|
-
it "should create a new adjustment" do
|
55
|
-
fill_in "adjustment_amount", with: "10"
|
56
|
-
fill_in "adjustment_label", with: "rebate"
|
57
|
-
click_button "Continue"
|
58
|
-
|
59
|
-
order.reload.all_adjustments.each do |adjustment|
|
60
|
-
expect(adjustment.order_id).to equal(order.id)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
context "with validation errors" do
|
66
|
-
it "should not create a new adjustment" do
|
67
|
-
fill_in "adjustment_amount", with: ""
|
68
|
-
fill_in "adjustment_label", with: ""
|
69
|
-
click_button "Continue"
|
70
|
-
expect(page).to have_content("Label can't be blank")
|
71
|
-
expect(page).to have_content("Amount is not a number")
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context "admin editing an adjustment" do
|
77
|
-
before(:each) do
|
78
|
-
within('table tr', text: 'Rebate') do
|
79
|
-
click_icon :edit
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context "successfully" do
|
84
|
-
it "should update the adjustment" do
|
85
|
-
fill_in "adjustment_amount", with: "99"
|
86
|
-
fill_in "adjustment_label", with: "rebate 99"
|
87
|
-
click_button "Continue"
|
88
|
-
expect(page).to have_content("successfully updated!")
|
89
|
-
expect(page).to have_content("rebate 99")
|
90
|
-
within(".adjustments") do
|
91
|
-
expect(page).to have_content("$99.00")
|
92
|
-
end
|
93
|
-
|
94
|
-
expect(page).to have_content("Total: $259.00")
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
context "with validation errors" do
|
99
|
-
it "should not update the adjustment" do
|
100
|
-
fill_in "adjustment_amount", with: ""
|
101
|
-
fill_in "adjustment_label", with: ""
|
102
|
-
click_button "Continue"
|
103
|
-
expect(page).to have_content("Label can't be blank")
|
104
|
-
expect(page).to have_content("Amount is not a number")
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
context "deleting an adjustment" do
|
110
|
-
context 'when the adjustment is finalized' do
|
111
|
-
let!(:adjustment) { super().tap(&:finalize!) }
|
112
|
-
|
113
|
-
it 'should not be possible' do
|
114
|
-
within('table tr', text: 'Rebate') do
|
115
|
-
expect(page).not_to have_css('.fa-trash')
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
it "should update the total", js: true do
|
121
|
-
accept_alert do
|
122
|
-
within('table tr', text: 'Rebate') do
|
123
|
-
click_icon(:trash)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
expect(page).to have_content('Total: $170.00', normalize_ws: true)
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|