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
@@ -27,7 +27,7 @@ describe "Option Types", type: :feature do
27
27
  it "should allow an admin to create a new option type", js: true do
28
28
  click_link "Option Types"
29
29
  click_link "new_option_type_link"
30
- expect(page).to have_content("NEW OPTION TYPE")
30
+ expect(page).to have_content("New Option Type")
31
31
  fill_in "option_type_name", with: "shirt colors"
32
32
  fill_in "option_type_presentation", with: "colors"
33
33
  click_button "Create"
@@ -61,7 +61,7 @@ describe "Option Types", type: :feature do
61
61
  create(:option_value)
62
62
  click_link "Option Types"
63
63
  within('table#listing_option_types') { click_icon :edit }
64
- expect(page).to have_content("Editing Option Type")
64
+ expect(page).to have_content("ProductsOption Typesfoo-size-")
65
65
  expect(page).to have_css("tbody#option_values tr", count: 1)
66
66
  within("tbody#option_values") do
67
67
  find('.spree_remove_fields').click
@@ -80,11 +80,11 @@ describe "Products", type: :feature do
80
80
  expect(page).to have_content("zomg shirt")
81
81
  expect(page).not_to have_content("apache baseball cap")
82
82
  check "Show Deleted"
83
- click_icon :search
83
+ click_button 'Search'
84
84
  expect(page).to have_content("zomg shirt")
85
85
  expect(page).to have_content("apache baseball cap")
86
86
  uncheck "Show Deleted"
87
- click_icon :search
87
+ click_button 'Search'
88
88
  expect(page).to have_content("zomg shirt")
89
89
  expect(page).not_to have_content("apache baseball cap")
90
90
  end
@@ -96,13 +96,13 @@ describe "Products", type: :feature do
96
96
 
97
97
  click_nav "Products"
98
98
  fill_in "q_name_cont", with: "ap"
99
- click_icon :search
99
+ click_button 'Search'
100
100
  expect(page).to have_content("apache baseball cap")
101
101
  expect(page).to have_content("apache baseball cap2")
102
102
  expect(page).not_to have_content("zomg shirt")
103
103
 
104
104
  fill_in "q_variants_including_master_sku_cont", with: "A1"
105
- click_icon :search
105
+ click_button "Search"
106
106
  expect(page).to have_content("apache baseball cap")
107
107
  expect(page).not_to have_content("apache baseball cap2")
108
108
  expect(page).not_to have_content("zomg shirt")
@@ -317,7 +317,7 @@ describe "Products", type: :feature do
317
317
  it 'should add option_types when selecting a prototype' do
318
318
  visit spree.admin_product_path(product)
319
319
  click_link 'Product Properties'
320
- expect(page).to have_content("SELECT FROM PROTOTYPE")
320
+ expect(page).to have_content("Select From Prototype")
321
321
  click_link "Select From Prototype"
322
322
 
323
323
  row = find('#prototypes tr', text: 'Size')
@@ -349,7 +349,7 @@ describe "Products", type: :feature do
349
349
 
350
350
  # This will show our deleted product
351
351
  check "Show Deleted"
352
- click_icon :search
352
+ click_button "Search"
353
353
  click_link product.name
354
354
  expect(page).to have_field('Master Price', with: product.price.to_f)
355
355
  end
@@ -12,7 +12,7 @@ describe "Properties", type: :feature do
12
12
  before do
13
13
  create(:property, name: 'shirt size', presentation: 'size')
14
14
  create(:property, name: 'shirt fit', presentation: 'fit')
15
- click_link "Properties"
15
+ click_link "Property Types"
16
16
  end
17
17
 
18
18
  context "listing product properties" do
@@ -32,7 +32,7 @@ describe "Properties", type: :feature do
32
32
  context "searching properties" do
33
33
  it 'should list properties matching search query', js: true do
34
34
  fill_in "q_name_cont", with: "size"
35
- click_icon :search
35
+ click_button 'Search'
36
36
 
37
37
  expect(page).to have_content("shirt size")
38
38
  expect(page).not_to have_content("shirt fit")
@@ -42,9 +42,9 @@ describe "Properties", type: :feature do
42
42
 
43
43
  context "creating a property" do
44
44
  it "should allow an admin to create a new product property", js: true do
45
- click_link "Properties"
45
+ click_link "Property Types"
46
46
  click_link "new_property_link"
47
- within('#new_property') { expect(page).to have_content("NEW PROPERTY") }
47
+ within('#new_property') { expect(page).to have_content("New Property Type") }
48
48
 
49
49
  fill_in "property_name", with: "color of band"
50
50
  fill_in "property_presentation", with: "color"
@@ -53,10 +53,10 @@ describe "Properties", type: :feature do
53
53
  end
54
54
  end
55
55
 
56
- context "editing a property" do
56
+ context "editing a property type" do
57
57
  before(:each) do
58
58
  create(:property)
59
- click_link "Properties"
59
+ click_link "Property Types"
60
60
  within_row(1) { click_icon :edit }
61
61
  end
62
62
 
@@ -48,7 +48,7 @@ describe "Prototypes", type: :feature do
48
48
  click_link "Prototypes"
49
49
  click_link "new_prototype_link"
50
50
  within('#new_prototype') do
51
- expect(page).to have_content("NEW PROTOTYPE")
51
+ expect(page).to have_content("New Prototype")
52
52
  end
53
53
  fill_in "prototype_name", with: "male shirts"
54
54
  click_button "Create"
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe "Stock Management", type: :feature do
3
+ describe "Product Stock", type: :feature do
4
4
  stub_authorization!
5
5
 
6
6
  before(:each) do
@@ -18,7 +18,7 @@ describe "Stock Management", type: :feature do
18
18
 
19
19
  click_nav "Products"
20
20
  within_row(1) { click_icon :edit }
21
- click_link "Stock Management"
21
+ click_link "Product Stock"
22
22
  end
23
23
 
24
24
  # Regression test for https://github.com/spree/spree/issues/3304
@@ -28,15 +28,15 @@ describe "Stock Management", type: :feature do
28
28
  @product = create(:product, name: 'apache baseball cap', price: 10)
29
29
  @product.variants.create!(sku: 'FOOBAR')
30
30
  Spree::StockLocation.destroy_all
31
- click_link "Back To Products List"
31
+ find_by_id('content-header').click_link('Products')
32
32
  within_row(1) do
33
33
  click_icon :edit
34
34
  end
35
- click_link "Stock Management"
35
+ click_link "Product Stock"
36
36
  end
37
37
 
38
38
  it "renders" do
39
- expect(page).to have_content('Products / apache baseball cap')
39
+ expect(page).to have_content('Productsapache baseball cap')
40
40
  expect(page.current_url).to match("admin/products/apache-baseball-cap/stock")
41
41
  end
42
42
  end
@@ -15,7 +15,7 @@ describe "Promotion Adjustments", type: :feature do
15
15
  fill_in "Base code", with: "order"
16
16
  fill_in "Number of codes", with: "1"
17
17
  click_button "Create"
18
- expect(page).to have_content("Editing Promotion")
18
+ expect(page).to have_content("PromotionsPromotion")
19
19
 
20
20
  select2 "Item total", from: "Add rule of type"
21
21
  within('#rule_fields') { click_button "Add" }
@@ -51,7 +51,7 @@ describe "Promotion Adjustments", type: :feature do
51
51
  fill_in "Base code", with: "single_use"
52
52
  fill_in "Number of codes", with: "1"
53
53
  click_button "Create"
54
- expect(page).to have_content("Editing Promotion")
54
+ expect(page).to have_content("PromotionsPromotion")
55
55
 
56
56
  select2 "Create whole-order adjustment", from: "Add action of type"
57
57
  within('#action_fields') { click_button "Add" }
@@ -74,7 +74,7 @@ describe "Promotion Adjustments", type: :feature do
74
74
  it "should allow an admin to create an automatic promo with flat percent discount" do
75
75
  fill_in "Name", with: "Promotion"
76
76
  click_button "Create"
77
- expect(page).to have_content("Editing Promotion")
77
+ expect(page).to have_content("PromotionsPromotion")
78
78
 
79
79
  select2 "Item total", from: "Add rule of type"
80
80
  within('#rule_fields') { click_button "Add" }
@@ -108,7 +108,7 @@ describe "Promotion Adjustments", type: :feature do
108
108
 
109
109
  fill_in "Name", with: "Promotion"
110
110
  click_button "Create"
111
- expect(page).to have_content("Editing Promotion")
111
+ expect(page).to have_content("PromotionsPromotion")
112
112
 
113
113
  select2 "Product(s)", from: "Add rule of type"
114
114
  within("#rule_fields") { click_button "Add" }
@@ -139,7 +139,7 @@ describe "Promotion Adjustments", type: :feature do
139
139
  it "should allow an admin to create an automatic promotion with free shipping (no code)" do
140
140
  fill_in "Name", with: "Promotion"
141
141
  click_button "Create"
142
- expect(page).to have_content("Editing Promotion")
142
+ expect(page).to have_content("PromotionsPromotion")
143
143
 
144
144
  select2 "Item total", from: "Add rule of type"
145
145
  within('#rule_fields') { click_button "Add" }
@@ -148,7 +148,7 @@ describe "Promotion Adjustments", type: :feature do
148
148
 
149
149
  select2 "Free shipping", from: "Add action of type"
150
150
  within('#action_fields') { click_button "Add" }
151
- expect(page).to have_content('MAKES ALL SHIPMENTS FOR THE ORDER FREE')
151
+ expect(page).to have_content('Makes all shipments for the order free')
152
152
 
153
153
  promotion = Spree::Promotion.find_by_name("Promotion")
154
154
  expect(promotion.codes).to be_empty
@@ -160,7 +160,7 @@ describe "Promotion Adjustments", type: :feature do
160
160
  fill_in "Name", with: "Promotion"
161
161
  fill_in "Path", with: "content/cvv"
162
162
  click_button "Create"
163
- expect(page).to have_content("Editing Promotion")
163
+ expect(page).to have_content("PromotionsPromotion")
164
164
 
165
165
  select2 "Create whole-order adjustment", from: "Add action of type"
166
166
  within('#action_fields') { click_button "Add" }
@@ -184,7 +184,7 @@ describe "Promotion Adjustments", type: :feature do
184
184
  it "ceasing to be eligible for a promotion with item total rule then becoming eligible again" do
185
185
  fill_in "Name", with: "Promotion"
186
186
  click_button "Create"
187
- expect(page).to have_content("Editing Promotion")
187
+ expect(page).to have_content("PromotionsPromotion")
188
188
 
189
189
  select2 "Item total", from: "Add rule of type"
190
190
  within('#rule_fields') { click_button "Add" }
@@ -18,8 +18,8 @@ feature 'Promotion with option value rule' do
18
18
  within("#rules_container") { click_button "Add" }
19
19
 
20
20
  within("#rules_container .promotion-block") do
21
- expect(page).to have_content("PRODUCT")
22
- expect(page).to have_content("OPTION VALUES")
21
+ expect(page).to have_content("Product")
22
+ expect(page).to have_content("Option Values")
23
23
 
24
24
  click_button "Add"
25
25
  end
@@ -31,7 +31,7 @@ feature 'Promotion with option value rule' do
31
31
 
32
32
  within('#rules_container') { click_button "Update" }
33
33
 
34
- first_rule = promotion.rules(true).first
34
+ first_rule = promotion.rules.reload.first
35
35
  expect(first_rule.class).to eq Spree::Promotion::Rules::OptionValue
36
36
  expect(first_rule.preferred_eligible_values).to eq Hash[product.id => [option_value.id]]
37
37
  end
@@ -78,7 +78,7 @@ feature 'Promotion with option value rule' do
78
78
 
79
79
  within('#rules_container') { click_button "Update" }
80
80
 
81
- first_rule = promotion.rules(true).first
81
+ first_rule = promotion.rules.reload.first
82
82
  expect(first_rule.preferred_eligible_values).to eq Hash[variant1.product_id => variant1.option_values.pluck(:id)]
83
83
  end
84
84
  end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'Promotion with product rule', js: true do
4
+ stub_authorization!
5
+
6
+ given!(:product) { create :product, name: "BlamCo Mac & Cheese", sku: "PRODUCT_SKU" }
7
+ given!(:variant) { create :variant, sku: "VARIANT_SKU", product: product }
8
+ given!(:option_value) { variant.option_values.first }
9
+
10
+ given(:promotion) { create :promotion }
11
+
12
+ def add_promotion_rule_of_type(type)
13
+ select2 type, from: "Add rule of type"
14
+ within("#rules_container") { click_button "Add" }
15
+ end
16
+
17
+ background do
18
+ visit spree.edit_admin_promotion_path(promotion)
19
+ add_promotion_rule_of_type("Product(s)")
20
+ end
21
+
22
+ it "can select by product sku" do
23
+ select2_search product.name, from: "Choose products", search: "PRODUCT_SKU"
24
+ end
25
+
26
+ it "can select by variant sku" do
27
+ select2_search product.name, from: "Choose products", search: "VARIANT_SKU"
28
+ end
29
+
30
+ it "can select by product name" do
31
+ select2_search product.name, from: "Choose products"
32
+ end
33
+ end
@@ -17,8 +17,8 @@ feature "Tiered Calculator Promotions" do
17
17
  within('#actions_container') { click_button "Update" }
18
18
 
19
19
  within("#actions_container .settings") do
20
- expect(page).to have_content("BASE PERCENT")
21
- expect(page).to have_content("TIERS")
20
+ expect(page).to have_content("Base Percent")
21
+ expect(page).to have_content("Tiers")
22
22
 
23
23
  click_button "Add"
24
24
  end
@@ -9,6 +9,21 @@ feature 'Promotion with user rule', js: true do
9
9
  visit spree.edit_admin_promotion_path(promotion)
10
10
  end
11
11
 
12
+ context "multiple users" do
13
+ let!(:user) { create(:user, email: 'foo@example.com') }
14
+ let!(:other_user) { create(:user, email: 'bar@example.com') }
15
+
16
+ scenario "searching a user" do
17
+ select2 "User", from: "Add rule of type"
18
+ within("#rules_container") { click_button "Add" }
19
+
20
+ select2_search "foo", from: "Choose users", select: false
21
+
22
+ expect(page).to have_content('foo@example.com')
23
+ expect(page).not_to have_content('bar@example.com')
24
+ end
25
+ end
26
+
12
27
  context "with an attempted XSS" do
13
28
  let(:xss_string) { %(<script>throw("XSS")</script>) }
14
29
  given!(:user) { create(:user, email: xss_string) }
@@ -9,7 +9,7 @@ describe "Reports", type: :feature do
9
9
  click_link "Reports"
10
10
  click_link "Sales Total"
11
11
 
12
- expect(page).to have_content("Sales Totals")
12
+ expect(page).to have_content("ReportsSales Total")
13
13
  expect(page).to have_content("Item Total")
14
14
  expect(page).to have_content("Adjustment Total")
15
15
  expect(page).to have_content("Sales Total")
@@ -33,7 +33,7 @@ describe 'Users', type: :feature do
33
33
  end
34
34
 
35
35
  it 'can go back to the users list' do
36
- expect(page).to have_link Spree.t(:back_to_users_list), href: spree.admin_users_path
36
+ expect(page).to have_link Spree::LegacyUser.model_name.human(count: :other), href: spree.admin_users_path
37
37
  end
38
38
 
39
39
  it 'can navigate to the account page' do
@@ -120,7 +120,7 @@ describe 'Users', type: :feature do
120
120
 
121
121
  it 'can edit user roles' do
122
122
  Spree::Role.create name: "admin"
123
- click_link user_a.email
123
+ click_link 'Account'
124
124
 
125
125
  check 'user_spree_role_admin'
126
126
  click_button 'Update'
@@ -152,6 +152,31 @@ describe 'Users', type: :feature do
152
152
  expect(user_a.reload.bill_address.address1).to eq "1313 Mockingbird Ln"
153
153
  end
154
154
 
155
+ context 'invalid entry' do
156
+ around do |example|
157
+ ::AlwaysInvalidUser = Class.new(Spree.user_class) do
158
+ validate :always_invalid_email
159
+ def always_invalid_email
160
+ errors.add(:email, "is invalid")
161
+ end
162
+ end
163
+ orig_class = Spree.user_class
164
+ Spree.user_class = "AlwaysInvalidUser"
165
+
166
+ example.run
167
+
168
+ Spree.user_class = orig_class.name
169
+ Object.send(:remove_const, "AlwaysInvalidUser")
170
+ end
171
+
172
+ it 'should show validation errors' do
173
+ fill_in 'user_email', with: 'something'
174
+ click_button 'Update'
175
+
176
+ expect(page).to have_content("Email is invalid")
177
+ end
178
+ end
179
+
155
180
  context 'no api key exists' do
156
181
  it 'can generate a new api key' do
157
182
  within("#admin_user_edit_api_key") do
@@ -14,4 +14,34 @@ describe Spree::Admin::BaseHelper, type: :helper do
14
14
  expect(datepicker_field_value(date)).to eq("2013/08/14")
15
15
  end
16
16
  end
17
+
18
+ describe "#admin_layout" do
19
+ subject { admin_layout(value) }
20
+
21
+ context "when no initial value has been set" do
22
+ context "and an argument is sent" do
23
+ let(:value) { "full-width" }
24
+ it { is_expected.to eq "full-width" }
25
+ end
26
+
27
+ context "and no argument is sent" do
28
+ let(:value) { nil }
29
+ it { is_expected.to be_nil }
30
+ end
31
+ end
32
+
33
+ context "when an initial value is set" do
34
+ before { admin_layout("full-width") }
35
+
36
+ context "and it is called again without an argument" do
37
+ let(:value) { nil }
38
+ it { is_expected.to eq "full-width" }
39
+ end
40
+
41
+ context "and it is called again with an argument" do
42
+ let(:value) { "centered" }
43
+ it { is_expected.to eq "centered" }
44
+ end
45
+ end
46
+ end
17
47
  end
@@ -37,8 +37,7 @@ describe Spree::Admin::NavigationHelper, type: :helper do
37
37
 
38
38
  context "when match_path option is supplied" do
39
39
  before do
40
- allow(helper).to receive(:admin_path).and_return("/somepath")
41
- allow(helper).to receive(:request).and_return(double(ActionDispatch::Request, fullpath: "/somepath/orders/edit/1"))
40
+ allow(helper).to receive(:request).and_return(double(ActionDispatch::Request, fullpath: "/admin/orders/edit/1"))
42
41
  end
43
42
 
44
43
  it "should be selected if the fullpath matches" do
@@ -72,4 +71,43 @@ describe Spree::Admin::NavigationHelper, type: :helper do
72
71
  expect(admin_tab).to end_with("foo</li>")
73
72
  end
74
73
  end
74
+
75
+ describe "#link_to_delete" do
76
+ let!(:item) { create(:stock_item) }
77
+ let(:options) { {} }
78
+ let(:link) { subject }
79
+
80
+ subject { helper.link_to_delete(item, options) }
81
+
82
+ # object_url is provided by the ResourceController abstract controller.
83
+ # as we cannot set a custom controller for helper tests, we need to fake it
84
+ before do
85
+ allow(helper).to receive(:object_url) do |o|
86
+ "/stock_items/#{o.to_param}"
87
+ end
88
+ end
89
+
90
+ it "generates a deletion link for the resource" do
91
+ expect(link).to include("href=\"/stock_items/#{item.to_param}\"")
92
+ expect(link).to include("data-action=\"remove\"")
93
+ expect(link).to include("data-confirm=\"Are you sure?\"")
94
+ expect(link).to include("<span class=\"text\">Delete</span>")
95
+ end
96
+
97
+ it "allows customization of the url" do
98
+ options[:url] = "/test/url"
99
+ expect(link).to include("href=\"/test/url\"")
100
+ end
101
+
102
+ it "allows customization of the link name" do
103
+ options[:name] = "Delete Item"
104
+ expect(link).to include("name=\"Delete Item\"")
105
+ expect(link).to include("<span class=\"text\">Delete Item</span>")
106
+ end
107
+
108
+ it "allows customization of the confirmation message" do
109
+ options[:confirm] = "Please confirm."
110
+ expect(link).to include("data-confirm=\"Please confirm.\"")
111
+ end
112
+ end
75
113
  end