solidus_backend 2.7.4 → 2.8.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.

Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -8
  3. data/app/assets/images/favicon.ico +0 -0
  4. data/app/assets/javascripts/spree/backend.js +0 -2
  5. data/app/assets/javascripts/spree/backend/adjustments.js +1 -1
  6. data/app/assets/javascripts/spree/backend/components/tooltips.js +21 -17
  7. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +1 -1
  8. data/app/assets/javascripts/spree/backend/product_picker.js +1 -1
  9. data/app/assets/javascripts/spree/backend/shipments.js +6 -1
  10. data/app/assets/javascripts/spree/backend/stock_management.js +9 -0
  11. data/app/assets/javascripts/spree/backend/store_credits.js +18 -2
  12. data/app/assets/javascripts/spree/backend/taxons.js +1 -1
  13. data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +24 -25
  14. data/app/assets/javascripts/spree/backend/user_picker.js +1 -1
  15. data/app/assets/javascripts/spree/backend/variant_autocomplete.js +1 -1
  16. data/app/assets/javascripts/spree/backend/views/order/customer_select.js +1 -1
  17. data/app/assets/javascripts/spree/backend/views/order/summary.js +2 -2
  18. data/app/assets/javascripts/spree/backend/views/stock/add_stock_item.js +15 -4
  19. data/app/assets/javascripts/spree/backend/views/stock/edit_stock_item_row.js +30 -10
  20. data/app/assets/stylesheets/spree/backend/globals/_functions.scss +1 -2
  21. data/app/assets/stylesheets/spree/backend/sections/_orders.scss +8 -0
  22. data/app/assets/stylesheets/spree/backend/sections/_stock_management.scss +77 -2
  23. data/app/assets/stylesheets/spree/backend/spree_admin.scss +0 -1
  24. data/app/controllers/spree/admin/cancellations_controller.rb +2 -2
  25. data/app/controllers/spree/admin/locale_controller.rb +1 -1
  26. data/app/controllers/spree/admin/orders/customer_details_controller.rb +8 -1
  27. data/app/controllers/spree/admin/orders_controller.rb +1 -11
  28. data/app/controllers/spree/admin/products_controller.rb +10 -6
  29. data/app/controllers/spree/admin/promotion_codes_controller.rb +19 -1
  30. data/app/controllers/spree/admin/promotions_controller.rb +1 -1
  31. data/app/controllers/spree/admin/reimbursements_controller.rb +7 -2
  32. data/app/controllers/spree/admin/resource_controller.rb +1 -0
  33. data/app/controllers/spree/admin/store_credit_reasons_controller.rb +8 -0
  34. data/app/controllers/spree/admin/store_credits_controller.rb +11 -11
  35. data/app/helpers/spree/admin/navigation_helper.rb +1 -1
  36. data/app/models/spree/backend_configuration.rb +38 -21
  37. data/app/views/spree/admin/cancellations/index.html.erb +3 -1
  38. data/app/views/spree/admin/images/_image_row.html.erb +1 -1
  39. data/app/views/spree/admin/images/edit.html.erb +3 -3
  40. data/app/views/spree/admin/images/index.html.erb +2 -2
  41. data/app/views/spree/admin/log_entries/index.html.erb +2 -2
  42. data/app/views/spree/admin/orders/_carton_manifest.html.erb +3 -1
  43. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +3 -1
  44. data/app/views/spree/admin/orders/confirm/_line_items.html.erb +3 -2
  45. data/app/views/spree/admin/orders/confirm/_shipment_manifest.html.erb +3 -1
  46. data/app/views/spree/admin/orders/index.html.erb +1 -1
  47. data/app/views/spree/admin/products/_form.html.erb +7 -7
  48. data/app/views/spree/admin/products/edit.html.erb +5 -0
  49. data/app/views/spree/admin/products/index.html.erb +3 -1
  50. data/app/views/spree/admin/promotion_categories/index.html.erb +1 -1
  51. data/app/views/spree/admin/promotion_code_batches/index.html.erb +1 -1
  52. data/app/views/spree/admin/promotion_codes/index.html.erb +5 -1
  53. data/app/views/spree/admin/promotion_codes/new.html.erb +31 -0
  54. data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
  55. data/app/views/spree/admin/promotions/_activations_edit.html.erb +1 -1
  56. data/app/views/spree/admin/promotions/_form.html.erb +4 -3
  57. data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
  58. data/app/views/spree/admin/promotions/edit.html.erb +3 -1
  59. data/app/views/spree/admin/refunds/new.html.erb +1 -1
  60. data/app/views/spree/admin/shared/_address_form.html.erb +10 -3
  61. data/app/views/spree/admin/shared/_edit_resource_links.html.erb +1 -1
  62. data/app/views/spree/admin/shared/_head.html.erb +1 -0
  63. data/app/views/spree/admin/shared/_image.html.erb +2 -2
  64. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +1 -1
  65. data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +4 -0
  66. data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +3 -3
  67. data/app/views/spree/admin/shared/_tabs.html.erb +3 -2
  68. data/app/views/spree/admin/shared/_variant_search.html.erb +1 -1
  69. data/app/views/spree/admin/stock_items/_stock_management.html.erb +56 -38
  70. data/app/views/spree/admin/stock_locations/_form.html.erb +133 -121
  71. data/app/views/spree/admin/stock_locations/edit.html.erb +4 -2
  72. data/app/views/spree/admin/store_credit_reasons/edit.html.erb +15 -0
  73. data/app/views/spree/admin/store_credit_reasons/index.html.erb +56 -0
  74. data/app/views/spree/admin/store_credit_reasons/new.html.erb +18 -0
  75. data/app/views/spree/admin/store_credit_reasons/shared/_form.html.erb +15 -0
  76. data/app/views/spree/admin/store_credits/_store_credit_reason_field.html.erb +7 -0
  77. data/app/views/spree/admin/store_credits/edit_amount.html.erb +1 -1
  78. data/app/views/spree/admin/store_credits/edit_validity.html.erb +1 -1
  79. data/app/views/spree/admin/store_credits/show.html.erb +2 -2
  80. data/app/views/spree/admin/users/items.html.erb +3 -1
  81. data/app/views/spree/admin/users/orders.html.erb +1 -1
  82. data/config/routes.rb +2 -8
  83. data/lib/spree/backend.rb +1 -1
  84. data/solidus_backend.gemspec +3 -4
  85. data/spec/controllers/spree/admin/base_controller_spec.rb +1 -1
  86. data/spec/controllers/spree/admin/cancellations_controller_spec.rb +7 -3
  87. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +50 -2
  88. data/spec/controllers/spree/admin/orders_controller_spec.rb +23 -11
  89. data/spec/controllers/spree/admin/payments_controller_spec.rb +1 -1
  90. data/spec/controllers/spree/admin/products_controller_spec.rb +72 -0
  91. data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +13 -1
  92. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +11 -0
  93. data/spec/controllers/spree/admin/resource_controller_spec.rb +22 -0
  94. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +1 -1
  95. data/spec/controllers/spree/admin/store_credits_controller_spec.rb +7 -7
  96. data/spec/features/admin/configuration/payment_methods_spec.rb +2 -2
  97. data/spec/features/admin/configuration/shipping_methods_spec.rb +2 -2
  98. data/spec/features/admin/homepage_spec.rb +1 -6
  99. data/spec/features/admin/orders/listing_spec.rb +1 -1
  100. data/spec/features/admin/orders/new_order_spec.rb +117 -0
  101. data/spec/features/admin/orders/new_refund_spec.rb +35 -0
  102. data/spec/features/admin/orders/order_details_spec.rb +2 -2
  103. data/spec/features/admin/orders/payments_spec.rb +2 -2
  104. data/spec/features/admin/orders/return_payment_state_spec.rb +3 -0
  105. data/spec/features/admin/orders/shipments_spec.rb +28 -0
  106. data/spec/features/admin/products/products_spec.rb +1 -1
  107. data/spec/features/admin/products/stock_management_spec.rb +10 -13
  108. data/spec/features/admin/promotion_adjustments_spec.rb +12 -12
  109. data/spec/features/admin/promotions/option_value_rule_spec.rb +2 -2
  110. data/spec/features/admin/promotions/product_rule_spec.rb +1 -1
  111. data/spec/features/admin/promotions/tiered_calculator_spec.rb +1 -1
  112. data/spec/features/admin/promotions/user_rule_spec.rb +2 -2
  113. data/spec/features/admin/reimbursements_spec.rb +1 -1
  114. data/spec/features/admin/store_credits_spec.rb +51 -2
  115. data/spec/features/admin/taxons_spec.rb +35 -0
  116. data/spec/features/admin/users_spec.rb +22 -11
  117. data/spec/helpers/admin/navigation_helper_spec.rb +4 -2
  118. data/spec/helpers/admin/store_credit_events_helper_spec.rb +2 -2
  119. data/spec/javascripts/spec_helper.js +2 -0
  120. data/spec/models/spree/backend_configuration/menu_item_spec.rb +17 -0
  121. data/spec/models/spree/backend_configuration_spec.rb +22 -0
  122. data/spec/spec_helper.rb +1 -0
  123. data/spec/support/feature/order_feature_helper.rb +1 -1
  124. data/spec/views/spree/admin/shared/navigation_footer_spec.rb +1 -1
  125. data/vendor/assets/javascripts/solidus_admin/select2_locales/select2_locale_en-US.js +10 -0
  126. metadata +26 -34
  127. data/app/controllers/spree/admin/reports_controller.rb +0 -82
  128. data/app/views/spree/admin/reports/index.html.erb +0 -19
  129. data/app/views/spree/admin/reports/sales_total.html.erb +0 -35
  130. data/app/views/spree/admin/shared/_report_order_criteria.html.erb +0 -19
  131. data/app/views/spree/admin/store_credits/_update_reason_field.html.erb +0 -7
  132. data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -133
  133. data/spec/features/admin/reports_spec.rb +0 -63
@@ -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 total", from: "Add rule of type"
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: "Add action of type"
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: "Add action of type"
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 total", from: "Add rule of type"
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: "Add action of type"
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: "Add rule of type"
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: "Add action of type"
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 total", from: "Add rule of type"
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 shipping", from: "Add action of type"
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 total", from: "Add rule of type"
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: "Add action of type"
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: "Add action of type"
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: "Add rule of type"
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: "Add rule of type"
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: "Add rule of type"
15
+ select type, from: "Discount Rules"
16
16
  within("#rules_container") { click_button "Add" }
17
17
  end
18
18
 
@@ -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: "Add action of type"
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: "Add rule of type"
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: "Add rule of type"
34
+ select "User", from: "Discount Rules"
35
35
  within("#rules_container") { click_button "Add" }
36
36
 
37
37
  select2_search "<script>", from: "Choose users"
@@ -11,7 +11,7 @@ describe 'Promotions', type: :feature do
11
11
  expect(page).to have_css('table thead tr th', text: 'Product')
12
12
  expect(page).to have_css('table thead tr th', text: 'Preferred Reimbursement Type')
13
13
  expect(page).to have_css('table thead tr th', text: 'Reimbursement Type Override')
14
- expect(page).to have_css('table thead tr th', text: 'Exchange for')
14
+ expect(page).to have_css('table thead tr th', text: 'Exchange For')
15
15
  expect(page).to have_css('table thead tr th', text: 'Amount Before Sales Tax')
16
16
  expect(page).to have_css('table thead tr th', text: 'Total')
17
17
  end
@@ -56,9 +56,58 @@ describe "Store credits admin" do
56
56
  end
57
57
  end
58
58
 
59
+ describe "displaying a store credit details page" do
60
+ before do
61
+ visit spree.admin_path
62
+ click_link "Users"
63
+ click_link store_credit.user.email
64
+ click_link "Store Credit"
65
+ page.find(".sc-table td.actions a.fa-edit").click
66
+ end
67
+
68
+ it "shows the store credit's information" do
69
+ within ".content" do
70
+ expect(page).to have_content "Credited #{store_credit.display_amount}"
71
+ expect(page).to have_content "Created By #{store_credit.created_by.email}"
72
+ expect(page).to have_content "Type #{store_credit.category_name}"
73
+ expect(page).to have_content 'Store credit history'
74
+ end
75
+ end
76
+
77
+ it "lets edit store credit's memo", js: true do
78
+ allow_any_instance_of(Spree::Admin::StoreCreditsController)
79
+ .to receive(:try_spree_current_user)
80
+ .and_return(admin_user)
81
+
82
+ # When there are no errors
83
+ within '.store-credit-memo-row' do
84
+ click_button 'Edit'
85
+ fill_in 'store_credit_memo', with: 'Lottery Won'
86
+ click_button 'Save'
87
+ expect(page).to have_content "Memo Lottery Won"
88
+ end
89
+ expect(page).to have_content "Store Credit has been successfully updated!"
90
+
91
+ # When there are errors
92
+ allow_any_instance_of(Spree::StoreCredit).to receive(:save) { false }
93
+ allow_any_instance_of(Spree::StoreCredit)
94
+ .to receive_message_chain(:errors, :full_messages)
95
+ .and_return(["Memo is not valid"])
96
+
97
+ within '.store-credit-memo-row' do
98
+ find(:css, ".edit-memo").click
99
+ fill_in 'store_credit_memo', with: 'Lottery Won Twice'
100
+ find(:css, ".save-memo").click
101
+ expect(page).to have_content "Memo Lottery Won"
102
+ expect(page).not_to have_content "Memo Lottery Won Twice"
103
+ end
104
+ expect(page).to have_content "Unable to update store credit [\"Memo is not valid\"]"
105
+ end
106
+ end
107
+
59
108
  describe "updating store credit" do
60
109
  let(:updated_amount) { "99.0" }
61
- let!(:update_reason) { create(:store_credit_update_reason) }
110
+ let!(:store_credit_reason) { create(:store_credit_reason) }
62
111
 
63
112
  before do
64
113
  visit spree.admin_path
@@ -74,7 +123,7 @@ describe "Store credits admin" do
74
123
  click_link "Change amount"
75
124
  expect(page).to have_content 'Editing store credit amount'
76
125
  page.fill_in 'store_credit_amount', with: updated_amount
77
- page.select update_reason.name, from: 'update_reason_id'
126
+ page.select store_credit_reason.name, from: 'store_credit_reason_id'
78
127
  click_button "Update"
79
128
  expect(page.find('#sc-detail-table')).to have_content "$99.00"
80
129
  expect(store_credit.reload.amount.to_f).to eq updated_amount.to_f
@@ -40,4 +40,39 @@ describe "Taxonomies and taxons", type: :feature do
40
40
 
41
41
  expect(page).to have_current_path %r{/admin/taxonomies/\d+/taxons/\d+/edit}
42
42
  end
43
+
44
+ context "inside sidebar menu" do
45
+ def only_one_selected_tab_inside?(sub_tab_selector, tab_name, tab_path)
46
+ within(sub_tab_selector) do
47
+ expect(page).to have_selector('.selected', count: 1)
48
+
49
+ within('.selected') { expect(page).to have_link(tab_name, href: tab_path) }
50
+ end
51
+ end
52
+
53
+ context "on display taxonomies page", js: true do
54
+ it "should be selected only one tab 'Taxonomies' in product sub tabs" do
55
+ visit spree.admin_taxonomies_path
56
+ only_one_selected_tab_inside?('[data-hook=admin_product_sub_tabs]', 'Taxonomies', spree.admin_taxonomies_path)
57
+ end
58
+ end
59
+
60
+ context "on edit taxonomy page", js: true do
61
+ it "should be selected only one tab 'Taxonomies' in product sub tabs" do
62
+ taxonomy = create :taxonomy
63
+
64
+ visit spree.edit_admin_taxonomy_path(taxonomy)
65
+ only_one_selected_tab_inside?('[data-hook=admin_product_sub_tabs]', 'Taxonomies', spree.admin_taxonomies_path)
66
+ end
67
+ end
68
+
69
+ context "on edit taxonomy's taxon page", js: true do
70
+ it "should be selected only one tab 'Taxonomies' in product sub tabs" do
71
+ taxonomy = create :taxonomy
72
+
73
+ visit spree.edit_admin_taxonomy_taxon_path(taxonomy, taxonomy.root.id)
74
+ only_one_selected_tab_inside?('[data-hook=admin_product_sub_tabs]', 'Taxonomies', spree.admin_taxonomies_path)
75
+ end
76
+ end
77
+ end
43
78
  end
@@ -16,6 +16,7 @@ describe 'Users', type: :feature do
16
16
  create(:completed_order_with_totals, user: user_a, number: "R456").tap do |o|
17
17
  li = o.line_items.last
18
18
  li.update_column(:price, li.price + 10)
19
+ o.recalculate
19
20
  end
20
21
  end
21
22
 
@@ -37,7 +38,7 @@ describe 'Users', type: :feature do
37
38
  end
38
39
 
39
40
  it 'can go back to the users list' do
40
- expect(page).to have_link Spree::LegacyUser.model_name.human(count: :other), href: spree.admin_users_path
41
+ expect(page).to have_link Spree::LegacyUser.model_name.human(count: Spree::I18N_GENERIC_PLURAL), href: spree.admin_users_path
41
42
  end
42
43
 
43
44
  it 'can navigate to the account page' do
@@ -302,14 +303,24 @@ describe 'Users', type: :feature do
302
303
  end
303
304
  end
304
305
 
305
- [:number, :total].each do |attr|
306
- context attr do
307
- it_behaves_like "a sortable attribute" do
308
- let(:text_match_1) { order.send(attr).to_s }
309
- let(:text_match_2) { order_2.send(attr).to_s }
310
- let(:table_id) { "listing_orders" }
311
- let(:sort_link) { "orders_#{attr}_title" }
312
- end
306
+ context :number do
307
+ it_behaves_like "a sortable attribute" do
308
+ let(:text_match_1) { order.number }
309
+ let(:text_match_2) { order_2.number }
310
+ let(:table_id) { "listing_orders" }
311
+ let(:sort_link) { "orders_number_title" }
312
+ end
313
+ end
314
+
315
+ context :total do
316
+ it_behaves_like "a sortable attribute" do
317
+ # Since Spree::Money renders each piece of the total in it's own span,
318
+ # we are just checking the dollar total matches. Mainly due to how
319
+ # RSpec matcher appear_before works since it can't index the broken up total.
320
+ let(:text_match_1) { order.total.to_i.to_s }
321
+ let(:text_match_2) { order_2.total.to_i.to_s }
322
+ let(:table_id) { "listing_orders" }
323
+ let(:sort_link) { "orders_total_title" }
313
324
  end
314
325
  end
315
326
 
@@ -359,9 +370,9 @@ describe 'Users', type: :feature do
359
370
  within_table('listing_items') do
360
371
  items.each do |item|
361
372
  expect(page).to have_selector(".item-name", text: item.product.name)
362
- expect(page).to have_selector(".item-price", text: item.single_money.to_html)
373
+ expect(page).to have_selector(".item-price", text: item.single_money.to_html(html_wrap: false))
363
374
  expect(page).to have_selector(".item-quantity", text: item.quantity)
364
- expect(page).to have_selector(".item-total", text: item.money.to_html)
375
+ expect(page).to have_selector(".item-total", text: item.money.to_html(html_wrap: false))
365
376
  end
366
377
  end
367
378
  end
@@ -83,8 +83,10 @@ describe Spree::Admin::NavigationHelper, type: :helper do
83
83
  # object_url is provided by the ResourceController abstract controller.
84
84
  # as we cannot set a custom controller for helper tests, we need to fake it
85
85
  before do
86
- allow(helper).to receive(:object_url) do |o|
87
- "/stock_items/#{o.to_param}"
86
+ without_partial_double_verification do
87
+ allow(helper).to receive(:object_url) do |o|
88
+ "/stock_items/#{o.to_param}"
89
+ end
88
90
  end
89
91
  end
90
92
 
@@ -87,10 +87,10 @@ describe Spree::Admin::StoreCreditEventsHelper, type: :helper do
87
87
  end
88
88
 
89
89
  context "originator is not specifically handled" do
90
- let(:originator) { create(:store_credit_update_reason) }
90
+ let(:originator) { create(:store_credit) }
91
91
 
92
92
  it "raises an error" do
93
- expect { subject }.to raise_error(RuntimeError, "Unexpected originator type Spree::StoreCreditUpdateReason")
93
+ expect { subject }.to raise_error(RuntimeError, "Unexpected originator type Spree::StoreCredit")
94
94
  end
95
95
  end
96
96
  end
@@ -4,6 +4,8 @@
4
4
  //= require support/chai-jq-0.0.7
5
5
 
6
6
  //= require_self
7
+ //= require jquery
8
+ //= require rails-ujs
7
9
  //= require spree/backend
8
10
  //= require_tree ./support
9
11
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Spree::BackendConfiguration::MenuItem do
6
+ describe '#match_path' do
7
+ subject do
8
+ described_class.new([], nil, {
9
+ match_path: '/stock_items'
10
+ }).match_path
11
+ end
12
+
13
+ it 'can be read' do
14
+ is_expected.to eq('/stock_items')
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Spree::BackendConfiguration do
6
+ describe '#menu_items' do
7
+ subject do
8
+ described_class.new.menu_items
9
+ end
10
+
11
+ describe 'menu tab for stock items' do
12
+ let(:stock_menu_item) do
13
+ subject.detect { |item| item.label == :stock }
14
+ end
15
+
16
+ # Regression for https://github.com/solidusio/solidus/issues/2950
17
+ it 'has match_path set to /stock_items' do
18
+ expect(stock_menu_item.match_path).to eq('/stock_items')
19
+ end
20
+ end
21
+ end
22
+ end
data/spec/spec_helper.rb CHANGED
@@ -27,6 +27,7 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
27
27
  require 'database_cleaner'
28
28
  require 'with_model'
29
29
 
30
+ require 'spree/testing_support/partial_double_verification'
30
31
  require 'spree/testing_support/authorization_helpers'
31
32
  require 'spree/testing_support/factories'
32
33
  require 'spree/testing_support/preferences'
@@ -16,7 +16,7 @@ module OrderFeatureHelper
16
16
  destination = destination.name
17
17
  end
18
18
 
19
- select2_no_label(destination, from: 'Choose location')
19
+ select2_no_label(destination, from: 'Choose Location')
20
20
 
21
21
  if quantity
22
22
  fill_in 'item_quantity', with: quantity
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- describe "spree/admin/shared/_navigation_footer", type: :view do
5
+ describe "spree/admin/shared/_navigation_footer", type: :view, partial_double_verification: false do
6
6
  let(:user) { FactoryBot.build_stubbed(:admin_user) }
7
7
  let(:ability) { Object.new.extend(CanCan::Ability) }
8
8
  before do
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Select2 English US translations
3
+ */
4
+ (function ($) {
5
+ "use strict";
6
+
7
+ $.fn.select2.locales['en-US'] = {};
8
+
9
+ $.extend($.fn.select2.defaults, $.fn.select2.locales['en-US']);
10
+ })(jQuery);