solidus_backend 1.3.2 → 1.4.0.beta1

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 (290) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +38 -0
  3. data/app/assets/javascripts/spree/backend/components/tooltips.js +2 -0
  4. data/app/assets/javascripts/spree/backend/product_picker.js +2 -2
  5. data/app/assets/javascripts/spree/backend/routes.js +0 -1
  6. data/app/assets/javascripts/spree/backend/shipments.js +147 -118
  7. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +16 -14
  8. data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +1 -1
  9. data/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb +1 -1
  10. data/app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs +1 -1
  11. data/app/assets/javascripts/spree/backend/templates/variants/split.hbs +25 -27
  12. data/app/assets/javascripts/spree/backend/user_picker.js +14 -8
  13. data/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss +3 -3
  14. data/app/assets/stylesheets/spree/backend/components/_breadcrumb.scss +4 -0
  15. data/app/assets/stylesheets/spree/backend/components/_date-picker.scss +0 -1
  16. data/app/assets/stylesheets/spree/backend/components/_hint.scss +3 -0
  17. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +0 -1
  18. data/app/assets/stylesheets/spree/backend/components/_progress.scss +5 -2
  19. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +14 -5
  20. data/app/assets/stylesheets/spree/backend/components/_states.scss +1 -2
  21. data/app/assets/stylesheets/spree/backend/globals/_mixins.css +2 -0
  22. data/app/assets/stylesheets/spree/backend/globals/mixins/_line_through.scss +22 -0
  23. data/app/assets/stylesheets/spree/backend/plugins/_select2.scss +12 -3
  24. data/app/assets/stylesheets/spree/backend/sections/_products.scss +25 -7
  25. data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +0 -1
  26. data/app/assets/stylesheets/spree/backend/sections/_transfer_items.scss +0 -1
  27. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +4 -6
  28. data/app/assets/stylesheets/spree/backend/shared/_header.scss +5 -2
  29. data/app/assets/stylesheets/spree/backend/shared/_layout.scss +36 -3
  30. data/app/assets/stylesheets/spree/backend/shared/_tables.scss +1 -3
  31. data/app/assets/stylesheets/spree/backend/shared/_typography.scss +0 -2
  32. data/app/assets/stylesheets/spree/backend/spree_admin.scss +3 -1
  33. data/app/controllers/spree/admin/cancellations_controller.rb +1 -1
  34. data/app/controllers/spree/admin/general_settings_controller.rb +0 -6
  35. data/app/controllers/spree/admin/orders/customer_details_controller.rb +7 -0
  36. data/app/controllers/spree/admin/orders_controller.rb +1 -1
  37. data/app/controllers/spree/admin/payment_methods_controller.rb +8 -3
  38. data/app/controllers/spree/admin/payments_controller.rb +12 -5
  39. data/app/controllers/spree/admin/products_controller.rb +1 -1
  40. data/app/controllers/spree/admin/refunds_controller.rb +1 -1
  41. data/app/controllers/spree/admin/reimbursements_controller.rb +1 -1
  42. data/app/controllers/spree/admin/root_controller.rb +1 -1
  43. data/app/controllers/spree/admin/stock_items_controller.rb +0 -8
  44. data/app/controllers/spree/admin/stock_transfers_controller.rb +6 -6
  45. data/app/controllers/spree/admin/users_controller.rb +7 -3
  46. data/app/helpers/spree/admin/base_helper.rb +11 -0
  47. data/app/helpers/spree/admin/navigation_helper.rb +46 -3
  48. data/app/helpers/spree/admin/orders_helper.rb +0 -1
  49. data/app/helpers/spree/admin/stock_locations_helper.rb +1 -5
  50. data/app/models/spree/backend_configuration.rb +100 -0
  51. data/app/views/spree/admin/adjustment_reasons/edit.html.erb +4 -7
  52. data/app/views/spree/admin/adjustment_reasons/index.html.erb +4 -4
  53. data/app/views/spree/admin/adjustment_reasons/new.html.erb +4 -4
  54. data/app/views/spree/admin/adjustments/edit.html.erb +4 -6
  55. data/app/views/spree/admin/adjustments/index.html.erb +3 -6
  56. data/app/views/spree/admin/adjustments/new.html.erb +5 -6
  57. data/app/views/spree/admin/cancellations/index.html.erb +4 -3
  58. data/app/views/spree/admin/countries/edit.html.erb +4 -6
  59. data/app/views/spree/admin/countries/index.html.erb +4 -4
  60. data/app/views/spree/admin/countries/new.html.erb +4 -4
  61. data/app/views/spree/admin/customer_returns/_return_item_decision.html.erb +1 -1
  62. data/app/views/spree/admin/customer_returns/edit.html.erb +4 -6
  63. data/app/views/spree/admin/customer_returns/index.html.erb +2 -5
  64. data/app/views/spree/admin/customer_returns/new.html.erb +5 -6
  65. data/app/views/spree/admin/general_settings/edit.html.erb +4 -28
  66. data/app/views/spree/admin/images/edit.html.erb +6 -2
  67. data/app/views/spree/admin/images/index.html.erb +3 -0
  68. data/app/views/spree/admin/images/new.html.erb +3 -3
  69. data/app/views/spree/admin/log_entries/index.html.erb +4 -8
  70. data/app/views/spree/admin/option_types/edit.html.erb +7 -9
  71. data/app/views/spree/admin/option_types/index.html.erb +4 -4
  72. data/app/views/spree/admin/orders/_shipment.html.erb +4 -1
  73. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +4 -1
  74. data/app/views/spree/admin/orders/cart.html.erb +4 -8
  75. data/app/views/spree/admin/orders/confirm.html.erb +3 -4
  76. data/app/views/spree/admin/orders/confirm/_payments.html.erb +1 -1
  77. data/app/views/spree/admin/orders/confirm_advance.html.erb +3 -4
  78. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  79. data/app/views/spree/admin/orders/customer_details/edit.html.erb +2 -4
  80. data/app/views/spree/admin/orders/customer_details/show.html.erb +3 -5
  81. data/app/views/spree/admin/orders/edit.html.erb +1 -8
  82. data/app/views/spree/admin/orders/index.html.erb +11 -5
  83. data/app/views/spree/admin/payment_methods/edit.html.erb +5 -7
  84. data/app/views/spree/admin/payment_methods/index.html.erb +6 -5
  85. data/app/views/spree/admin/payment_methods/new.html.erb +6 -7
  86. data/app/views/spree/admin/payments/_capture_events.html.erb +1 -1
  87. data/app/views/spree/admin/payments/credit.html.erb +3 -3
  88. data/app/views/spree/admin/payments/index.html.erb +4 -7
  89. data/app/views/spree/admin/payments/new.html.erb +4 -5
  90. data/app/views/spree/admin/payments/show.html.erb +4 -7
  91. data/app/views/spree/admin/prices/_form.html.erb +1 -0
  92. data/app/views/spree/admin/prices/index.html.erb +2 -2
  93. data/app/views/spree/admin/product_properties/index.html.erb +3 -1
  94. data/app/views/spree/admin/products/_form.html.erb +11 -18
  95. data/app/views/spree/admin/products/_properties_form.erb +1 -1
  96. data/app/views/spree/admin/products/edit.html.erb +3 -2
  97. data/app/views/spree/admin/products/index.html.erb +19 -28
  98. data/app/views/spree/admin/products/new.html.erb +4 -2
  99. data/app/views/spree/admin/promotion_categories/edit.html.erb +4 -3
  100. data/app/views/spree/admin/promotion_categories/index.html.erb +4 -4
  101. data/app/views/spree/admin/promotion_categories/new.html.erb +4 -3
  102. data/app/views/spree/admin/promotion_rules/create.js.erb +1 -1
  103. data/app/views/spree/admin/promotions/_actions.html.erb +3 -3
  104. data/app/views/spree/admin/promotions/_rules.html.erb +2 -2
  105. data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +1 -1
  106. data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +1 -1
  107. data/app/views/spree/admin/promotions/edit.html.erb +4 -5
  108. data/app/views/spree/admin/promotions/index.html.erb +3 -5
  109. data/app/views/spree/admin/promotions/new.html.erb +3 -3
  110. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +2 -2
  111. data/app/views/spree/admin/properties/edit.html.erb +3 -6
  112. data/app/views/spree/admin/properties/index.html.erb +5 -5
  113. data/app/views/spree/admin/prototypes/_form.html.erb +3 -3
  114. data/app/views/spree/admin/prototypes/_prototypes.html.erb +1 -1
  115. data/app/views/spree/admin/prototypes/edit.html.erb +3 -6
  116. data/app/views/spree/admin/prototypes/index.html.erb +4 -4
  117. data/app/views/spree/admin/prototypes/show.html.erb +2 -2
  118. data/app/views/spree/admin/refund_reasons/edit.html.erb +4 -4
  119. data/app/views/spree/admin/refund_reasons/index.html.erb +5 -4
  120. data/app/views/spree/admin/refund_reasons/new.html.erb +5 -4
  121. data/app/views/spree/admin/refunds/edit.html.erb +5 -6
  122. data/app/views/spree/admin/refunds/new.html.erb +6 -6
  123. data/app/views/spree/admin/reimbursement_types/index.html.erb +4 -3
  124. data/app/views/spree/admin/reimbursements/edit.html.erb +5 -6
  125. data/app/views/spree/admin/reimbursements/index.html.erb +2 -4
  126. data/app/views/spree/admin/reimbursements/show.html.erb +3 -4
  127. data/app/views/spree/admin/reports/index.html.erb +2 -3
  128. data/app/views/spree/admin/reports/sales_total.html.erb +2 -4
  129. data/app/views/spree/admin/return_authorizations/edit.html.erb +15 -16
  130. data/app/views/spree/admin/return_authorizations/index.html.erb +3 -5
  131. data/app/views/spree/admin/return_authorizations/new.html.erb +5 -6
  132. data/app/views/spree/admin/return_reasons/edit.html.erb +3 -2
  133. data/app/views/spree/admin/return_reasons/index.html.erb +3 -1
  134. data/app/views/spree/admin/return_reasons/new.html.erb +4 -2
  135. data/app/views/spree/admin/shared/_areas_tabs.html.erb +3 -3
  136. data/app/views/spree/admin/shared/_configuration_menu.html.erb +2 -2
  137. data/app/views/spree/admin/shared/_edit_resource_links.html.erb +2 -2
  138. data/app/views/spree/admin/shared/_head.html.erb +1 -8
  139. data/app/views/spree/admin/shared/_header.html.erb +8 -12
  140. data/app/views/spree/admin/shared/_new_resource_links.html.erb +2 -2
  141. data/app/views/spree/admin/shared/_no_objects_found.html.erb +1 -1
  142. data/app/views/spree/admin/shared/_order_submenu.html.erb +10 -10
  143. data/app/views/spree/admin/shared/_order_summary.html.erb +1 -1
  144. data/app/views/spree/admin/shared/_order_tabs.html.erb +3 -3
  145. data/app/views/spree/admin/shared/_payments_tabs.html.erb +1 -1
  146. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +2 -2
  147. data/app/views/spree/admin/shared/_product_tabs.html.erb +8 -9
  148. data/app/views/spree/admin/shared/_report_criteria.html.erb +2 -2
  149. data/app/views/spree/admin/shared/_report_order_criteria.html.erb +2 -2
  150. data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +4 -4
  151. data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +5 -5
  152. data/app/views/spree/admin/shared/_shipping_tabs.html.erb +4 -3
  153. data/app/views/spree/admin/shared/_sidebar.html.erb +1 -1
  154. data/app/views/spree/admin/shared/_tabs.html.erb +12 -37
  155. data/app/views/spree/admin/shared/_taxes_tabs.html.erb +2 -2
  156. data/app/views/spree/admin/shared/_variant_search.html.erb +1 -1
  157. data/app/views/spree/admin/shared/named_types/_edit.html.erb +5 -5
  158. data/app/views/spree/admin/shared/named_types/_index.html.erb +5 -4
  159. data/app/views/spree/admin/shared/named_types/_new.html.erb +5 -4
  160. data/app/views/spree/admin/shipping_categories/edit.html.erb +5 -6
  161. data/app/views/spree/admin/shipping_categories/index.html.erb +5 -4
  162. data/app/views/spree/admin/shipping_categories/new.html.erb +5 -6
  163. data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
  164. data/app/views/spree/admin/shipping_methods/edit.html.erb +5 -6
  165. data/app/views/spree/admin/shipping_methods/index.html.erb +5 -5
  166. data/app/views/spree/admin/shipping_methods/new.html.erb +5 -6
  167. data/app/views/spree/admin/states/edit.html.erb +5 -6
  168. data/app/views/spree/admin/states/index.html.erb +5 -4
  169. data/app/views/spree/admin/states/new.html.erb +5 -3
  170. data/app/views/spree/admin/stock_items/index.html.erb +4 -7
  171. data/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +2 -2
  172. data/app/views/spree/admin/stock_locations/edit.html.erb +5 -5
  173. data/app/views/spree/admin/stock_locations/index.html.erb +16 -9
  174. data/app/views/spree/admin/stock_locations/new.html.erb +5 -4
  175. data/app/views/spree/admin/stock_movements/index.html.erb +3 -4
  176. data/app/views/spree/admin/stock_movements/new.html.erb +2 -3
  177. data/app/views/spree/admin/stock_transfers/_location.html.erb +7 -0
  178. data/app/views/spree/admin/stock_transfers/_transfer_item_table.html.erb +1 -1
  179. data/app/views/spree/admin/stock_transfers/edit.html.erb +5 -6
  180. data/app/views/spree/admin/stock_transfers/index.html.erb +5 -5
  181. data/app/views/spree/admin/stock_transfers/new.html.erb +6 -8
  182. data/app/views/spree/admin/stock_transfers/receive.html.erb +4 -12
  183. data/app/views/spree/admin/stock_transfers/show.html.erb +6 -12
  184. data/app/views/spree/admin/stock_transfers/tracking_info.html.erb +5 -13
  185. data/app/views/spree/admin/store_credits/edit_amount.html.erb +6 -4
  186. data/app/views/spree/admin/store_credits/edit_validity.html.erb +8 -6
  187. data/app/views/spree/admin/store_credits/index.html.erb +5 -5
  188. data/app/views/spree/admin/store_credits/new.html.erb +5 -4
  189. data/app/views/spree/admin/store_credits/show.html.erb +5 -4
  190. data/app/views/spree/admin/style_guide/topics/typography/_icons.html.erb +2 -2
  191. data/app/views/spree/admin/tax_categories/edit.html.erb +5 -4
  192. data/app/views/spree/admin/tax_categories/index.html.erb +5 -4
  193. data/app/views/spree/admin/tax_categories/new.html.erb +5 -4
  194. data/app/views/spree/admin/tax_rates/edit.html.erb +5 -6
  195. data/app/views/spree/admin/tax_rates/index.html.erb +5 -4
  196. data/app/views/spree/admin/tax_rates/new.html.erb +5 -6
  197. data/app/views/spree/admin/taxonomies/edit.erb +7 -9
  198. data/app/views/spree/admin/taxonomies/index.html.erb +4 -4
  199. data/app/views/spree/admin/taxonomies/new.html.erb +5 -7
  200. data/app/views/spree/admin/taxons/edit.html.erb +5 -6
  201. data/app/views/spree/admin/taxons/index.html.erb +2 -3
  202. data/app/views/spree/admin/trackers/edit.html.erb +5 -6
  203. data/app/views/spree/admin/trackers/index.html.erb +4 -4
  204. data/app/views/spree/admin/trackers/new.html.erb +4 -6
  205. data/app/views/spree/admin/users/_form.html.erb +2 -2
  206. data/app/views/spree/admin/users/_tabs.html.erb +5 -5
  207. data/app/views/spree/admin/users/_user_page_actions.html.erb +1 -4
  208. data/app/views/spree/admin/users/addresses.html.erb +5 -4
  209. data/app/views/spree/admin/users/edit.html.erb +6 -6
  210. data/app/views/spree/admin/users/index.html.erb +4 -5
  211. data/app/views/spree/admin/users/items.html.erb +4 -3
  212. data/app/views/spree/admin/users/new.html.erb +2 -9
  213. data/app/views/spree/admin/users/orders.html.erb +4 -3
  214. data/app/views/spree/admin/variants/_form.html.erb +1 -0
  215. data/app/views/spree/admin/variants/edit.html.erb +4 -3
  216. data/app/views/spree/admin/variants/index.html.erb +10 -8
  217. data/app/views/spree/admin/variants/new.html.erb +5 -0
  218. data/app/views/spree/admin/zones/_country_members.html.erb +2 -2
  219. data/app/views/spree/admin/zones/_state_members.html.erb +2 -2
  220. data/app/views/spree/admin/zones/edit.html.erb +5 -6
  221. data/app/views/spree/admin/zones/index.html.erb +5 -4
  222. data/app/views/spree/admin/zones/new.html.erb +6 -7
  223. data/app/views/spree/layouts/admin.html.erb +28 -15
  224. data/config/initializers/form_builder.rb +6 -0
  225. data/config/routes.rb +2 -6
  226. data/spec/controllers/spree/admin/cancellations_controller_spec.rb +3 -3
  227. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +4 -4
  228. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +1 -1
  229. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +5 -5
  230. data/spec/controllers/spree/admin/orders_controller_spec.rb +28 -28
  231. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +5 -5
  232. data/spec/controllers/spree/admin/payments_controller_spec.rb +7 -7
  233. data/spec/controllers/spree/admin/prices_controller_spec.rb +2 -2
  234. data/spec/controllers/spree/admin/product_properties_controller_spec.rb +1 -1
  235. data/spec/controllers/spree/admin/products_controller_spec.rb +6 -6
  236. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +2 -2
  237. data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +1 -1
  238. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +2 -2
  239. data/spec/controllers/spree/admin/promotions_controller_spec.rb +7 -7
  240. data/spec/controllers/spree/admin/refunds_controller_spec.rb +1 -1
  241. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +5 -5
  242. data/spec/controllers/spree/admin/reports_controller_spec.rb +2 -2
  243. data/spec/controllers/spree/admin/resource_controller_spec.rb +6 -6
  244. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +11 -11
  245. data/spec/controllers/spree/admin/return_items_controller_spec.rb +1 -1
  246. data/spec/controllers/spree/admin/search_controller_spec.rb +2 -2
  247. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +1 -1
  248. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +3 -3
  249. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +3 -3
  250. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +10 -10
  251. data/spec/controllers/spree/admin/store_credits_controller_spec.rb +10 -10
  252. data/spec/controllers/spree/admin/users_controller_spec.rb +139 -141
  253. data/spec/controllers/spree/admin/variants_controller_spec.rb +2 -2
  254. data/spec/features/admin/configuration/general_settings_spec.rb +7 -16
  255. data/spec/features/admin/configuration/payment_methods_spec.rb +7 -7
  256. data/spec/features/admin/configuration/stock_locations_spec.rb +1 -1
  257. data/spec/features/admin/configuration/tax_categories_spec.rb +1 -1
  258. data/spec/features/admin/configuration/zones_spec.rb +1 -1
  259. data/spec/features/admin/homepage_spec.rb +2 -2
  260. data/spec/features/admin/orders/adjustments_spec.rb +1 -1
  261. data/spec/features/admin/orders/cancelling_inventory_spec.rb +8 -8
  262. data/spec/features/admin/orders/customer_details_spec.rb +20 -5
  263. data/spec/features/admin/orders/listing_spec.rb +97 -70
  264. data/spec/features/admin/orders/new_order_spec.rb +35 -6
  265. data/spec/features/admin/orders/order_details_spec.rb +37 -58
  266. data/spec/features/admin/orders/payments_spec.rb +57 -4
  267. data/spec/features/admin/orders/return_authorizations_spec.rb +25 -0
  268. data/spec/features/admin/orders/shipments_spec.rb +5 -5
  269. data/spec/features/admin/products/edit/products_spec.rb +1 -1
  270. data/spec/features/admin/products/edit/taxons_spec.rb +5 -5
  271. data/spec/features/admin/products/edit/variants_spec.rb +1 -1
  272. data/spec/features/admin/products/option_types_spec.rb +2 -2
  273. data/spec/features/admin/products/products_spec.rb +6 -6
  274. data/spec/features/admin/products/properties_spec.rb +6 -6
  275. data/spec/features/admin/products/prototypes_spec.rb +1 -1
  276. data/spec/features/admin/products/stock_management_spec.rb +5 -5
  277. data/spec/features/admin/promotion_adjustments_spec.rb +8 -8
  278. data/spec/features/admin/promotions/option_value_rule_spec.rb +4 -4
  279. data/spec/features/admin/promotions/product_rule_spec.rb +33 -0
  280. data/spec/features/admin/promotions/tiered_calculator_spec.rb +2 -2
  281. data/spec/features/admin/promotions/user_rule_spec.rb +15 -0
  282. data/spec/features/admin/reports_spec.rb +1 -1
  283. data/spec/features/admin/users_spec.rb +27 -2
  284. data/spec/helpers/admin/base_helper_spec.rb +30 -0
  285. data/spec/helpers/admin/navigation_helper_spec.rb +40 -2
  286. data/spec/spec_helper.rb +10 -8
  287. data/spec/support/feature/order_feature_helper.rb +17 -0
  288. metadata +18 -11
  289. data/app/assets/javascripts/spree/backend/general_settings.js.coffee +0 -13
  290. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
@@ -2,6 +2,8 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe "Order Details", type: :feature, js: true do
5
+ include OrderFeatureHelper
6
+
5
7
  let!(:stock_location) { create(:stock_location_with_items) }
6
8
  let!(:product) { create(:product, name: 'spree t-shirt', price: 20.00) }
7
9
  let!(:tote) { create(:product, name: "Tote", price: 15.00) }
@@ -11,8 +13,12 @@ describe "Order Details", type: :feature, js: true do
11
13
  let!(:shipping_method) { create(:shipping_method, name: "Default") }
12
14
 
13
15
  before do
14
- order.shipments.create(stock_location_id: stock_location.id)
16
+ @shipment1 = order.shipments.create(stock_location_id: stock_location.id)
15
17
  order.contents.add(product.master, 2)
18
+ # order.contents.add causes things (like line items & shipments) to get
19
+ # cached, and these are going to change during this spec so we go ahead and
20
+ # reload now
21
+ order.reload
16
22
  end
17
23
 
18
24
  context 'as Admin' do
@@ -45,7 +51,7 @@ describe "Order Details", type: :feature, js: true do
45
51
  fill_in "quantity_0", with: 2
46
52
  end
47
53
 
48
- click_icon :plus
54
+ click_button "Add"
49
55
 
50
56
  within("#order_total") do
51
57
  expect(page).to have_content("$80.00")
@@ -61,7 +67,7 @@ describe "Order Details", type: :feature, js: true do
61
67
  end
62
68
  end
63
69
 
64
- expect(page).to have_content("YOUR ORDER IS EMPTY") # wait for page refresh
70
+ expect(page).to have_content("Your order is empty") # wait for page refresh
65
71
  expect(page).not_to have_content("spree t-shirt")
66
72
  end
67
73
 
@@ -133,7 +139,7 @@ describe "Order Details", type: :feature, js: true do
133
139
  fill_in "variant_quantity", with: 1
134
140
  end
135
141
 
136
- click_icon :plus
142
+ click_button 'Add'
137
143
 
138
144
  within(".line-items") do
139
145
  expect(page).to have_content(tote.name)
@@ -152,7 +158,7 @@ describe "Order Details", type: :feature, js: true do
152
158
 
153
159
  expect(page).to have_selector('.select2-no-results')
154
160
  within(".select2-no-results") do
155
- expect(page).to have_content("NO MATCHES FOUND")
161
+ expect(page).to have_content("No matches found")
156
162
  end
157
163
  end
158
164
  end
@@ -179,8 +185,7 @@ describe "Order Details", type: :feature, js: true do
179
185
  expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
180
186
 
181
187
  within_row(1) { click_icon 'arrows-h' }
182
- targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
183
- click_icon :ok
188
+ complete_split_to(stock_location2)
184
189
 
185
190
  expect(page).to have_css('.shipment', count: 2)
186
191
 
@@ -194,11 +199,9 @@ describe "Order Details", type: :feature, js: true do
194
199
  expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
195
200
 
196
201
  within_row(1) { click_icon 'arrows-h' }
197
- targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
198
- fill_in 'item_quantity', with: 2
199
- click_icon :ok
202
+ complete_split_to(stock_location2, quantity: 2)
200
203
 
201
- expect(page).to have_content("PENDING PACKAGE FROM 'CLARKSVILLE'")
204
+ expect(page).to have_content("pending package from 'Clarksville'")
202
205
 
203
206
  expect(order.shipments.count).to eq(1)
204
207
  expect(order.shipments.last.backordered?).to eq(false)
@@ -210,11 +213,9 @@ describe "Order Details", type: :feature, js: true do
210
213
  expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
211
214
 
212
215
  within_row(1) { click_icon 'arrows-h' }
213
- targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
214
- fill_in 'item_quantity', with: 5
215
- click_icon :ok
216
+ complete_split_to(stock_location2, quantity: 5)
216
217
 
217
- expect(page).to have_content("PENDING PACKAGE FROM 'CLARKSVILLE'")
218
+ expect(page).to have_content("pending package from 'Clarksville'")
218
219
 
219
220
  expect(order.shipments.count).to eq(1)
220
221
  expect(order.shipments.last.backordered?).to eq(false)
@@ -226,9 +227,7 @@ describe "Order Details", type: :feature, js: true do
226
227
  expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
227
228
 
228
229
  within_row(1) { click_icon 'arrows-h' }
229
- targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
230
- fill_in 'item_quantity', with: 'ff'
231
- click_icon :ok
230
+ complete_split_to(stock_location2, quantity: 'ff')
232
231
 
233
232
  wait_for_ajax
234
233
 
@@ -241,9 +240,7 @@ describe "Order Details", type: :feature, js: true do
241
240
  expect(order.shipments.first.stock_location.id).to eq(stock_location.id)
242
241
 
243
242
  within_row(1) { click_icon 'arrows-h' }
244
- targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
245
- fill_in 'item_quantity', with: 0
246
- click_icon :ok
243
+ complete_split_to(stock_location2, quantity: 0)
247
244
 
248
245
  wait_for_ajax
249
246
 
@@ -283,9 +280,7 @@ describe "Order Details", type: :feature, js: true do
283
280
  product.master.stock_items.last.update_column(:count_on_hand, 0)
284
281
 
285
282
  within_row(1) { click_icon 'arrows-h' }
286
- targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
287
- fill_in 'item_quantity', with: 2
288
- click_icon :ok
283
+ complete_split_to(stock_location2, quantity: 2)
289
284
 
290
285
  wait_for_ajax
291
286
 
@@ -301,11 +296,9 @@ describe "Order Details", type: :feature, js: true do
301
296
  product.master.stock_items.last.update_column(:backorderable, true)
302
297
 
303
298
  within_row(1) { click_icon 'arrows-h' }
304
- targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
305
- fill_in 'item_quantity', with: 2
306
- click_icon :ok
299
+ complete_split_to(stock_location2, quantity: 2)
307
300
 
308
- expect(page).to have_content("PENDING PACKAGE FROM 'CLARKSVILLE'")
301
+ expect(page).to have_content("pending package from 'Clarksville'")
309
302
 
310
303
  expect(order.shipments.count).to eq(1)
311
304
  expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
@@ -317,12 +310,13 @@ describe "Order Details", type: :feature, js: true do
317
310
  context 'multiple items in cart' do
318
311
  it 'should have no problem splitting if multiple items are in the from shipment' do
319
312
  order.contents.add(create(:variant), 2)
313
+ order.reload
314
+
320
315
  expect(order.shipments.count).to eq(1)
321
316
  expect(order.shipments.first.manifest.count).to eq(2)
322
317
 
323
318
  within_row(1) { click_icon 'arrows-h' }
324
- targetted_select2 stock_location2.name, from: '#s2id_item_stock_location'
325
- click_icon :ok
319
+ complete_split_to(stock_location2)
326
320
 
327
321
  expect(page).to have_css('.shipment', count: 2)
328
322
 
@@ -360,9 +354,7 @@ describe "Order Details", type: :feature, js: true do
360
354
  expect(order.shipments.count).to eq(2)
361
355
 
362
356
  within_row(1) { click_icon 'arrows-h' }
363
- targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
364
- fill_in 'item_quantity', with: 2
365
- click_icon :ok
357
+ complete_split_to(@shipment2, quantity: 2)
366
358
 
367
359
  expect(page).not_to have_content(/Move .* to/)
368
360
 
@@ -380,17 +372,13 @@ describe "Order Details", type: :feature, js: true do
380
372
  expect(page).to have_css('.item-name', text: product.name, count: 1)
381
373
 
382
374
  within_row(1) { click_icon 'arrows-h' }
383
- targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
384
- fill_in 'item_quantity', with: 1
385
- click_icon :ok
375
+ complete_split_to(@shipment2, quantity: 1)
386
376
 
387
377
  expect(page).to have_css('.item-name', text: product.name, count: 2)
388
378
 
389
379
  within(all('.stock-contents', count: 2).first) do
390
380
  within_row(1) { click_icon 'arrows-h' }
391
- targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
392
- fill_in 'item_quantity', with: 200
393
- click_icon :ok
381
+ complete_split_to(@shipment2, quantity: 200)
394
382
  end
395
383
 
396
384
  wait_for_ajax
@@ -402,25 +390,20 @@ describe "Order Details", type: :feature, js: true do
402
390
 
403
391
  it 'should not allow a shipment to split stock to itself' do
404
392
  within_row(1) { click_icon 'arrows-h' }
405
- targetted_select2 order.shipments.first.number, from: '#s2id_item_stock_location'
406
- fill_in 'item_quantity', with: 1
407
- click_icon :ok
408
-
409
- wait_for_ajax
410
-
411
- expect(order.shipments.count).to eq(2)
412
- expect(order.shipments.first.inventory_units_for(product.master).count).to eq(2)
393
+ click_on 'Choose location'
394
+ within '.select2-results' do
395
+ expect(page).to have_content(@shipment2.number)
396
+ expect(page).not_to have_content(@shipment1.number)
397
+ end
413
398
  end
414
399
 
415
400
  it 'should split fine if more than one line_item is in the receiving shipment' do
416
401
  variant2 = create(:variant)
417
402
  order.contents.add(variant2, 2, shipment: @shipment2)
403
+ order.reload
418
404
 
419
405
  within_row(1) { click_icon 'arrows-h' }
420
- targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
421
- fill_in 'item_quantity', with: 1
422
-
423
- click_icon :ok
406
+ complete_split_to(@shipment2, quantity: 1)
424
407
 
425
408
  expect(page).not_to have_content(/Move .* to/)
426
409
  expect(page).to have_css('.shipment', count: 2)
@@ -440,17 +423,13 @@ describe "Order Details", type: :feature, js: true do
440
423
  expect(@shipment2.reload.backordered?).to eq(false)
441
424
 
442
425
  within_row(1) { click_icon 'arrows-h' }
443
- targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
444
- fill_in 'item_quantity', with: 1
445
- click_icon :ok
426
+ complete_split_to(@shipment2, quantity: 1)
446
427
 
447
428
  expect(page).to have_content("1 x backordered")
448
429
 
449
430
  within('.stock-contents', text: "1 x on hand") do
450
431
  within_row(1) { click_icon 'arrows-h' }
451
- targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
452
- fill_in 'item_quantity', with: 1
453
- click_icon :ok
432
+ complete_split_to(@shipment2, quantity: 1)
454
433
  end
455
434
 
456
435
  # Empty shipment should be removed
@@ -535,7 +514,7 @@ describe "Order Details", type: :feature, js: true do
535
514
  wait_for_ajax
536
515
 
537
516
  within '.carton-state' do
538
- expect(page).to have_content('SHIPPED')
517
+ expect(page).to have_content('shipped')
539
518
  end
540
519
  end
541
520
  end
@@ -66,17 +66,17 @@ describe 'Payments', type: :feature do
66
66
  within_row(1) do
67
67
  expect(column_text(3)).to eq('$150.00')
68
68
  expect(column_text(4)).to eq('Credit Card')
69
- expect(column_text(6)).to eq('CHECKOUT')
69
+ expect(column_text(6)).to eq('checkout')
70
70
  end
71
71
 
72
72
  click_icon :void
73
- expect(page).to have_css('#payment_status', text: 'BALANCE DUE')
73
+ expect(page).to have_css('#payment_status', text: 'balance due')
74
74
  expect(page).to have_content('Payment Updated')
75
75
 
76
76
  within_row(1) do
77
77
  expect(column_text(3)).to eq('$150.00')
78
78
  expect(column_text(4)).to eq('Credit Card')
79
- expect(column_text(6)).to eq('VOID')
79
+ expect(column_text(6)).to eq('void')
80
80
  end
81
81
 
82
82
  click_on 'New Payment'
@@ -86,7 +86,7 @@ describe 'Payments', type: :feature do
86
86
 
87
87
  click_icon(:capture)
88
88
 
89
- expect(page).to have_selector('#payment_status', text: 'PAID')
89
+ expect(page).to have_selector('#payment_status', text: 'paid')
90
90
  expect(page).not_to have_selector('#new_payment_section')
91
91
  end
92
92
 
@@ -222,6 +222,30 @@ describe 'Payments', type: :feature do
222
222
  expect(page).to have_content("Payment Updated")
223
223
  end
224
224
  end
225
+
226
+ context 'with a soft-deleted payment method' do
227
+ let(:order) { create(:completed_order_with_totals, line_items_count: 1) }
228
+ let!(:payment_method) { create(:check_payment_method) }
229
+ let!(:payment) do
230
+ create(:payment,
231
+ order: order,
232
+ amount: order.outstanding_balance,
233
+ payment_method: payment_method
234
+ )
235
+ end
236
+
237
+ before do
238
+ payment_method.destroy
239
+ visit spree.admin_order_payments_path(order.reload)
240
+ end
241
+
242
+ it "can list and view the payment" do
243
+ expect(page).to have_content(payment.number)
244
+ click_on payment.number
245
+ expect(page).to have_current_path("/admin/orders/#{order.number}/payments/#{payment.id}")
246
+ expect(page).to have_content(payment.amount)
247
+ end
248
+ end
225
249
  end
226
250
 
227
251
  # Previously this would fail unless the method was named "Credit Card"
@@ -244,4 +268,33 @@ describe 'Payments', type: :feature do
244
268
  expect(page).to have_content("Payment has been successfully created!")
245
269
  end
246
270
  end
271
+
272
+ context "when required quantity is more than available" do
273
+ let(:product) { create(:product_not_backorderable) }
274
+
275
+ let(:order) do
276
+ create(:order_with_line_items, {
277
+ line_items_count: 1,
278
+ line_items_attributes: [{ quantity: 11, product: product }],
279
+ stock_location: product.master.stock_locations.first
280
+ })
281
+ end
282
+
283
+ let!(:chequing_payment_method) { create(:check_payment_method) }
284
+ let!(:payment_method) { create(:credit_card_payment_method, name: "Multipass!") }
285
+
286
+ before do
287
+ visit spree.admin_order_payments_path(order.reload)
288
+ end
289
+
290
+ it "displays an error" do
291
+ choose payment_method.name
292
+ fill_in "Card Number", with: "4111 1111 1111 1111"
293
+ fill_in "Name", with: "Test User"
294
+ fill_in "Expiration", with: "09 / #{Time.current.year + 1}"
295
+ fill_in "Card Code", with: "007"
296
+ click_button "Continue"
297
+ expect(page).to have_content Spree.t(:insufficient_stock_for_order)
298
+ end
299
+ end
247
300
  end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ReturnAuthorizations", type: :feature do
4
+ include OrderFeatureHelper
5
+
6
+ stub_authorization!
7
+
8
+ let!(:order) { create(:shipped_order) }
9
+ let!(:return_authorization) { create(:return_authorization, order: order) }
10
+
11
+ it "can visit the return authorizations list page" do
12
+ visit spree.admin_order_return_authorizations_path(order)
13
+ end
14
+
15
+ describe "edit" do
16
+ it "can visit the return authorizations edit page" do
17
+ visit spree.edit_admin_order_return_authorization_path(order, return_authorization)
18
+ end
19
+
20
+ it "return authorizations edit page has a data hook for extensions to add content above, below or within the RA form" do
21
+ visit spree.edit_admin_order_return_authorization_path(order, return_authorization)
22
+ expect(page).to have_selector("[data-hook=return-authorization-form-wrapper]")
23
+ end
24
+ end
25
+ end
@@ -1,6 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Shipments", type: :feature do
4
+ include OrderFeatureHelper
5
+
4
6
  stub_authorization!
5
7
 
6
8
  let!(:order) { create(:order_ready_to_ship, number: "R100", state: "complete", line_items_count: 5) }
@@ -32,7 +34,7 @@ describe "Shipments", type: :feature do
32
34
  find(".ship-shipment-button").click
33
35
  wait_for_ajax
34
36
 
35
- expect(page).to have_content("SHIPPED PACKAGE")
37
+ expect(page).to have_content("shipped package")
36
38
  expect(order.reload.shipment_state).to eq("shipped")
37
39
  end
38
40
  end
@@ -53,16 +55,14 @@ describe "Shipments", type: :feature do
53
55
  shipment1 = order.shipments[0]
54
56
 
55
57
  within_row(1) { click_icon 'arrows-h' }
56
- targetted_select2 'LA', from: '#s2id_item_stock_location'
57
- click_icon :ok
58
+ complete_split_to('LA')
58
59
 
59
60
  expect(page).to have_css("#shipment_#{shipment1.id} tr.stock-item", count: 4)
60
61
  shipment2 = (order.reload.shipments.to_a - [shipment1]).first
61
62
  expect(page).to have_css("#shipment_#{shipment2.id} tr.stock-item", count: 1)
62
63
 
63
64
  within_row(2) { click_icon 'arrows-h' }
64
- targetted_select2 "LA(#{shipment2.number})", from: '#s2id_item_stock_location'
65
- click_icon :ok
65
+ complete_split_to("LA(#{shipment2.number})")
66
66
  expect(page).to have_css("#shipment_#{shipment2.id} tr.stock-item", count: 2)
67
67
  expect(page).to have_css("#shipment_#{shipment1.id} tr.stock-item", count: 3)
68
68
  end
@@ -15,7 +15,7 @@ describe 'Product Details', type: :feature do
15
15
 
16
16
  click_link 'Product Details'
17
17
 
18
- expect(page).to have_css('.page-title', text: 'Products / Bún thịt nướng')
18
+ expect(page).to have_content('ProductsBún thịt nướng')
19
19
  expect(page).to have_field('product_name', with: 'Bún thịt nướng')
20
20
  expect(page).to have_field('product_slug', with: 'bun-th-t-n-ng')
21
21
  expect(page).to have_field('product_description', with: 'lorem ipsum')
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Product Taxons", type: :feature do
3
+ describe "Product Display Order", type: :feature do
4
4
  stub_authorization!
5
5
 
6
- context "managing taxons", js: true do
6
+ context "managing display order", js: true do
7
7
  def assert_selected_taxons(taxons)
8
8
  # Regression test for https://github.com/spree/spree/issues/2139
9
9
  taxons.each do |taxon|
@@ -16,7 +16,7 @@ describe "Product Taxons", type: :feature do
16
16
 
17
17
  let(:product) { create(:product) }
18
18
 
19
- it "should allow an admin to manage taxons" do
19
+ it "should allow an admin to manage display order (taxons)" do
20
20
  taxon_1 = create(:taxon)
21
21
  taxon_2 = create(:taxon, name: 'Clothing')
22
22
  product.taxons << taxon_1
@@ -25,7 +25,7 @@ describe "Product Taxons", type: :feature do
25
25
 
26
26
  assert_selected_taxons([taxon_1])
27
27
 
28
- select2_search "Clothing", from: "Taxons"
28
+ select2_search "Clothing", from: "Taxon"
29
29
  click_button "Update"
30
30
  assert_selected_taxons([taxon_1, taxon_2])
31
31
  end
@@ -36,7 +36,7 @@ describe "Product Taxons", type: :feature do
36
36
  it "displays the escaped HTML without executing it" do
37
37
  visit spree.edit_admin_product_path(product)
38
38
 
39
- select2_search "<script>", from: "Taxons"
39
+ select2_search "<script>", from: "Taxon"
40
40
 
41
41
  expect(page).to have_content(taxon_name)
42
42
  end
@@ -16,7 +16,7 @@ describe "Product Variants", type: :feature do
16
16
  within_row(1) { click_icon :edit }
17
17
 
18
18
  within('nav > ul.tabs') { click_link "Variants" }
19
- expect(page).to have_content("TO ADD VARIANTS, YOU MUST FIRST DEFINE")
19
+ expect(page).to have_content("To add variants, you must first define")
20
20
  end
21
21
 
22
22
  it "allows admin to create a variant if there are option types" do