solidus_backend 2.10.0 → 2.11.1

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 (233) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend.js +4 -1
  3. data/app/assets/javascripts/spree/backend/adjustments.js +1 -1
  4. data/app/assets/javascripts/spree/backend/admin.js +18 -29
  5. data/app/assets/javascripts/spree/backend/collections/states.js +1 -1
  6. data/app/assets/javascripts/spree/backend/components/selectable_table.js +5 -0
  7. data/app/assets/javascripts/spree/backend/components/selectable_table/return_items.js +5 -0
  8. data/app/assets/javascripts/spree/backend/components/selectable_table/summary.js +7 -0
  9. data/app/assets/javascripts/spree/backend/components/sortable_table.js +31 -25
  10. data/app/assets/javascripts/spree/backend/models/order.js +3 -3
  11. data/app/assets/javascripts/spree/backend/models/payment.js +1 -1
  12. data/app/assets/javascripts/spree/backend/models/shipment.js +1 -1
  13. data/app/assets/javascripts/spree/backend/models/stock_item.js +1 -1
  14. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +2 -2
  15. data/app/assets/javascripts/spree/backend/option_value_picker.js +2 -2
  16. data/app/assets/javascripts/spree/backend/product_picker.js +2 -2
  17. data/app/assets/javascripts/spree/backend/routes.js +40 -21
  18. data/app/assets/javascripts/spree/backend/shipments.js +5 -5
  19. data/app/assets/javascripts/spree/backend/shipping_methods/stock_locations_picker.js +18 -0
  20. data/app/assets/javascripts/spree/backend/stock_management.js +4 -2
  21. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +2 -2
  22. data/app/assets/javascripts/spree/backend/taxons.js +3 -3
  23. data/app/assets/javascripts/spree/backend/templates/index.js +2 -0
  24. data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +2 -2
  25. data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +5 -1
  26. data/app/assets/javascripts/spree/backend/templates/tables/return_item_sum_amount.hbs +7 -0
  27. data/app/assets/javascripts/spree/backend/templates/tables/selectable_label.hbs +6 -0
  28. data/app/assets/javascripts/spree/backend/user_picker.js +3 -4
  29. data/app/assets/javascripts/spree/backend/variant_autocomplete.js +2 -2
  30. data/app/assets/javascripts/spree/backend/views/cart/empty_cart_button.js +2 -2
  31. data/app/assets/javascripts/spree/backend/views/index.js +4 -0
  32. data/app/assets/javascripts/spree/backend/views/order/address.js +1 -1
  33. data/app/assets/javascripts/spree/backend/views/order/customer_select.js +2 -3
  34. data/app/assets/javascripts/spree/backend/views/order/details_adjustments.js +4 -1
  35. data/app/assets/javascripts/spree/backend/views/stock/edit_stock_item_row.js +4 -0
  36. data/app/assets/javascripts/spree/backend/views/tables/return_items.js +9 -0
  37. data/app/assets/javascripts/spree/backend/views/tables/selectable_table.js +70 -0
  38. data/app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js +32 -0
  39. data/app/assets/javascripts/spree/backend/views/tables/selectable_table/summary.js +45 -0
  40. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +4 -5
  41. data/app/assets/stylesheets/spree/backend/sections/_orders.scss +5 -1
  42. data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +4 -0
  43. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +1 -0
  44. data/app/controllers/spree/admin/base_controller.rb +6 -0
  45. data/app/controllers/spree/admin/cancellations_controller.rb +2 -0
  46. data/app/controllers/spree/admin/customer_returns_controller.rb +4 -4
  47. data/app/controllers/spree/admin/images_controller.rb +2 -1
  48. data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -0
  49. data/app/controllers/spree/admin/orders_controller.rb +7 -2
  50. data/app/controllers/spree/admin/payments_controller.rb +3 -1
  51. data/app/controllers/spree/admin/product_properties_controller.rb +1 -1
  52. data/app/controllers/spree/admin/products_controller.rb +18 -24
  53. data/app/controllers/spree/admin/promotion_codes_controller.rb +9 -4
  54. data/app/controllers/spree/admin/refunds_controller.rb +19 -0
  55. data/app/controllers/spree/admin/resource_controller.rb +27 -7
  56. data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
  57. data/app/controllers/spree/admin/root_controller.rb +1 -1
  58. data/app/controllers/spree/admin/search_controller.rb +1 -2
  59. data/app/controllers/spree/admin/stock_items_controller.rb +6 -5
  60. data/app/controllers/spree/admin/stock_locations_controller.rb +4 -0
  61. data/app/controllers/spree/admin/stock_movements_controller.rb +7 -0
  62. data/app/controllers/spree/admin/taxons_controller.rb +12 -1
  63. data/app/controllers/spree/admin/users/api_key_controller.rb +29 -0
  64. data/app/controllers/spree/admin/users_controller.rb +37 -20
  65. data/app/controllers/spree/admin/variants_controller.rb +4 -2
  66. data/app/controllers/spree/admin/zones_controller.rb +1 -1
  67. data/app/helpers/spree/admin/base_helper.rb +4 -0
  68. data/app/helpers/spree/admin/customer_returns_helper.rb +1 -1
  69. data/app/helpers/spree/admin/navigation_helper.rb +1 -1
  70. data/app/helpers/spree/admin/orders_helper.rb +8 -4
  71. data/app/helpers/spree/admin/stock_movements_helper.rb +8 -4
  72. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +2 -3
  73. data/app/views/spree/admin/images/index.html.erb +25 -21
  74. data/app/views/spree/admin/option_types/_option_value_fields.html.erb +8 -1
  75. data/app/views/spree/admin/option_types/edit.html.erb +3 -1
  76. data/app/views/spree/admin/orders/customer_details/_form.html.erb +13 -13
  77. data/app/views/spree/admin/orders/index.html.erb +23 -13
  78. data/app/views/spree/admin/payment_methods/_form.html.erb +7 -2
  79. data/app/views/spree/admin/payments/index.html.erb +3 -1
  80. data/app/views/spree/admin/prices/_master_variant_table.html.erb +3 -3
  81. data/app/views/spree/admin/prices/_table.html.erb +3 -3
  82. data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +7 -2
  83. data/app/views/spree/admin/product_properties/index.html.erb +14 -2
  84. data/app/views/spree/admin/products/_form.html.erb +13 -2
  85. data/app/views/spree/admin/products/index.html.erb +1 -1
  86. data/app/views/spree/admin/promotion_codes/index.html.erb +1 -1
  87. data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
  88. data/app/views/spree/admin/promotions/_activations_new.html.erb +1 -1
  89. data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
  90. data/app/views/spree/admin/promotions/edit.html.erb +2 -2
  91. data/app/views/spree/admin/promotions/index.html.erb +12 -5
  92. data/app/views/spree/admin/return_authorizations/_form.html.erb +3 -10
  93. data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
  94. data/app/views/spree/admin/search/users.json.jbuilder +15 -1
  95. data/app/views/spree/admin/shared/_address.html.erb +6 -6
  96. data/app/views/spree/admin/shared/_address_form.html.erb +15 -8
  97. data/app/views/spree/admin/shared/_order_submenu.html.erb +4 -4
  98. data/app/views/spree/admin/shared/_payments_tabs.html.erb +1 -1
  99. data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +5 -5
  100. data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +6 -6
  101. data/app/views/spree/admin/shared/_shipping_tabs.html.erb +3 -3
  102. data/app/views/spree/admin/shared/_taxes_tabs.html.erb +2 -2
  103. data/app/views/spree/admin/shared/preference_fields/_encrypted_string.html.erb +12 -0
  104. data/app/views/spree/admin/shipping_methods/_form.html.erb +18 -0
  105. data/app/views/spree/admin/stock_items/_stock_management.html.erb +1 -1
  106. data/app/views/spree/admin/stock_locations/edit.html.erb +1 -1
  107. data/app/views/spree/admin/stock_locations/index.html.erb +3 -1
  108. data/app/views/spree/admin/stock_movements/index.html.erb +30 -1
  109. data/app/views/spree/admin/stores/_form.html.erb +6 -0
  110. data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +27 -3
  111. data/app/views/spree/admin/tax_categories/_form.html.erb +1 -0
  112. data/app/views/spree/admin/users/_form.html.erb +2 -2
  113. data/app/views/spree/admin/users/_tabs.html.erb +1 -1
  114. data/app/views/spree/admin/users/edit.html.erb +4 -4
  115. data/app/views/spree/admin/users/items.html.erb +5 -3
  116. data/app/views/spree/admin/users/orders.html.erb +5 -3
  117. data/app/views/spree/admin/variants/_table_filter.html.erb +1 -1
  118. data/app/views/spree/admin/variants/index.html.erb +2 -2
  119. data/config/initializers/form_builder.rb +2 -2
  120. data/lib/spree/backend/engine.rb +0 -2
  121. data/lib/spree/backend_configuration.rb +14 -1
  122. data/solidus_backend.gemspec +4 -4
  123. metadata +24 -123
  124. data/app/assets/javascripts/spree/backend/returns/return_item_selection.js +0 -35
  125. data/script/rails +0 -10
  126. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -26
  127. data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -83
  128. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -235
  129. data/spec/controllers/spree/admin/locale_controller_spec.rb +0 -45
  130. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
  131. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -128
  132. data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -408
  133. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -95
  134. data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -194
  135. data/spec/controllers/spree/admin/prices_controller_spec.rb +0 -45
  136. data/spec/controllers/spree/admin/product_properties_controller_spec.rb +0 -71
  137. data/spec/controllers/spree/admin/products_controller_spec.rb +0 -270
  138. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -23
  139. data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -32
  140. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -36
  141. data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
  142. data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -35
  143. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -137
  144. data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -201
  145. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -291
  146. data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -29
  147. data/spec/controllers/spree/admin/root_controller_spec.rb +0 -43
  148. data/spec/controllers/spree/admin/search_controller_spec.rb +0 -106
  149. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -16
  150. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -52
  151. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -44
  152. data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -311
  153. data/spec/controllers/spree/admin/users_controller_spec.rb +0 -287
  154. data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -71
  155. data/spec/features/admin/configuration/payment_methods_spec.rb +0 -176
  156. data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -126
  157. data/spec/features/admin/configuration/stock_locations_spec.rb +0 -54
  158. data/spec/features/admin/configuration/store_spec.rb +0 -62
  159. data/spec/features/admin/configuration/tax_categories_spec.rb +0 -58
  160. data/spec/features/admin/configuration/tax_rates_spec.rb +0 -31
  161. data/spec/features/admin/configuration/taxonomies_spec.rb +0 -61
  162. data/spec/features/admin/configuration/zones_spec.rb +0 -41
  163. data/spec/features/admin/homepage_spec.rb +0 -86
  164. data/spec/features/admin/javascript_format_money_spec.rb +0 -22
  165. data/spec/features/admin/locale_spec.rb +0 -34
  166. data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -55
  167. data/spec/features/admin/orders/adjustments_spec.rb +0 -130
  168. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -45
  169. data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -50
  170. data/spec/features/admin/orders/customer_details_spec.rb +0 -203
  171. data/spec/features/admin/orders/customer_returns_spec.rb +0 -41
  172. data/spec/features/admin/orders/line_items_spec.rb +0 -52
  173. data/spec/features/admin/orders/listing_spec.rb +0 -186
  174. data/spec/features/admin/orders/log_entries_spec.rb +0 -56
  175. data/spec/features/admin/orders/new_order_spec.rb +0 -379
  176. data/spec/features/admin/orders/new_refund_spec.rb +0 -35
  177. data/spec/features/admin/orders/order_details_spec.rb +0 -591
  178. data/spec/features/admin/orders/payments_spec.rb +0 -330
  179. data/spec/features/admin/orders/return_authorizations_spec.rb +0 -56
  180. data/spec/features/admin/orders/return_payment_state_spec.rb +0 -65
  181. data/spec/features/admin/orders/risk_analysis_spec.rb +0 -49
  182. data/spec/features/admin/orders/shipments_spec.rb +0 -145
  183. data/spec/features/admin/payments/store_credits_spec.rb +0 -23
  184. data/spec/features/admin/products/edit/images_spec.rb +0 -76
  185. data/spec/features/admin/products/edit/products_spec.rb +0 -92
  186. data/spec/features/admin/products/edit/taxons_spec.rb +0 -57
  187. data/spec/features/admin/products/edit/variants_spec.rb +0 -63
  188. data/spec/features/admin/products/option_types_spec.rb +0 -116
  189. data/spec/features/admin/products/pricing_spec.rb +0 -127
  190. data/spec/features/admin/products/products_spec.rb +0 -348
  191. data/spec/features/admin/products/properties_spec.rb +0 -141
  192. data/spec/features/admin/products/stock_management_spec.rb +0 -101
  193. data/spec/features/admin/products/variant_spec.rb +0 -89
  194. data/spec/features/admin/promotion_adjustments_spec.rb +0 -286
  195. data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -90
  196. data/spec/features/admin/promotions/product_rule_spec.rb +0 -35
  197. data/spec/features/admin/promotions/promotion_categories_spec.rb +0 -83
  198. data/spec/features/admin/promotions/promotion_code_batches_spec.rb +0 -37
  199. data/spec/features/admin/promotions/promotion_code_spec.rb +0 -31
  200. data/spec/features/admin/promotions/promotion_spec.rb +0 -52
  201. data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -76
  202. data/spec/features/admin/promotions/user_rule_spec.rb +0 -42
  203. data/spec/features/admin/reimbursements_spec.rb +0 -18
  204. data/spec/features/admin/store_credits_spec.rb +0 -132
  205. data/spec/features/admin/stores_spec.rb +0 -37
  206. data/spec/features/admin/style_guide_spec.rb +0 -14
  207. data/spec/features/admin/taxons_spec.rb +0 -90
  208. data/spec/features/admin/users_spec.rb +0 -412
  209. data/spec/fixtures/files/ror_ringer.jpeg +0 -0
  210. data/spec/helpers/admin/base_helper_spec.rb +0 -49
  211. data/spec/helpers/admin/navigation_helper_spec.rb +0 -139
  212. data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
  213. data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -97
  214. data/spec/helpers/promotion_rules_helper_spec.rb +0 -14
  215. data/spec/javascripts/fixtures/_boot.html.erb +0 -8
  216. data/spec/javascripts/fixtures/number_with_currency/with_currency_select.html.erb +0 -3
  217. data/spec/javascripts/fixtures/number_with_currency/without_select.html.erb +0 -3
  218. data/spec/javascripts/format_money_spec.js +0 -48
  219. data/spec/javascripts/spec_helper.js +0 -13
  220. data/spec/javascripts/support/show_errors.js +0 -8
  221. data/spec/javascripts/support/with_translations.js +0 -11
  222. data/spec/javascripts/translation_spec.js +0 -58
  223. data/spec/javascripts/views/number_with_currency_spec.js +0 -72
  224. data/spec/lib/spree/backend_configuration/menu_item_spec.rb +0 -17
  225. data/spec/lib/spree/backend_configuration_spec.rb +0 -22
  226. data/spec/spec_helper.rb +0 -123
  227. data/spec/support/appear_before_matcher.rb +0 -10
  228. data/spec/support/feature/base_feature_helper.rb +0 -17
  229. data/spec/support/feature/order_feature_helper.rb +0 -27
  230. data/spec/teaspoon_env.rb +0 -51
  231. data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
  232. data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
  233. data/spec/views/spree/admin/shared/navigation_footer_spec.rb +0 -67
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Spree::Admin::BaseHelper, type: :helper do
6
- include Spree::Admin::BaseHelper
7
-
8
- context "#datepicker_field_value" do
9
- it "should return nil when date is empty" do
10
- date = nil
11
- expect(datepicker_field_value(date)).to be_nil
12
- end
13
-
14
- it "should return a formatted date when date is present" do
15
- date = "2013-08-14".to_time
16
- expect(datepicker_field_value(date)).to eq("2013/08/14")
17
- end
18
- end
19
-
20
- describe "#admin_layout" do
21
- subject { admin_layout(value) }
22
-
23
- context "when no initial value has been set" do
24
- context "and an argument is sent" do
25
- let(:value) { "full-width" }
26
- it { is_expected.to eq "full-width" }
27
- end
28
-
29
- context "and no argument is sent" do
30
- let(:value) { nil }
31
- it { is_expected.to be_nil }
32
- end
33
- end
34
-
35
- context "when an initial value is set" do
36
- before { admin_layout("full-width") }
37
-
38
- context "and it is called again without an argument" do
39
- let(:value) { nil }
40
- it { is_expected.to eq "full-width" }
41
- end
42
-
43
- context "and it is called again with an argument" do
44
- let(:value) { "centered" }
45
- it { is_expected.to eq "centered" }
46
- end
47
- end
48
- end
49
- end
@@ -1,139 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Spree::Admin::NavigationHelper, type: :helper do
6
- describe "#tab" do
7
- context "creating an admin tab" do
8
- it "should capitalize the first letter of each word in the tab's label" do
9
- admin_tab = helper.tab(:orders)
10
- expect(admin_tab).to include("Orders")
11
- end
12
- end
13
-
14
- describe "selection" do
15
- context "when match_path option is not supplied" do
16
- subject(:tab) { helper.tab(:orders) }
17
-
18
- it "should be selected if the controller matches" do
19
- allow(controller).to receive(:controller_name).and_return("orders")
20
- expect(subject).to include('class="selected"')
21
- end
22
-
23
- it "should not be selected if the controller does not match" do
24
- allow(controller).to receive(:controller_name).and_return("bonobos")
25
- expect(subject).not_to include('class="selected"')
26
- end
27
-
28
- it "should be selected if the current path" do
29
- allow(helper).to receive(:request).and_return(double(ActionDispatch::Request, fullpath: "/admin/orders"))
30
- expect(subject).to include('class="selected"')
31
- end
32
-
33
- it "should not be selected if not current path" do
34
- allow(helper).to receive(:request).and_return(double(ActionDispatch::Request, fullpath: "/admin/products"))
35
- expect(subject).not_to include('class="selected"')
36
- end
37
- end
38
-
39
- context "when match_path option is supplied" do
40
- before do
41
- allow(helper).to receive(:request).and_return(double(ActionDispatch::Request, fullpath: "/admin/orders/edit/1"))
42
- end
43
-
44
- it "should be selected if the fullpath matches" do
45
- allow(controller).to receive(:controller_name).and_return("bonobos")
46
- tab = helper.tab(:orders, match_path: '/orders')
47
- expect(tab).to include('class="selected"')
48
- end
49
-
50
- it "should be selected if the fullpath matches a regular expression" do
51
- allow(controller).to receive(:controller_name).and_return("bonobos")
52
- tab = helper.tab(:orders, match_path: /orders$|orders\//)
53
- expect(tab).to include('class="selected"')
54
- end
55
-
56
- it "should not be selected if the fullpath does not match" do
57
- allow(controller).to receive(:controller_name).and_return("bonobos")
58
- tab = helper.tab(:orders, match_path: '/shady')
59
- expect(tab).not_to include('class="selected"')
60
- end
61
-
62
- it "should not be selected if the fullpath does not match a regular expression" do
63
- allow(controller).to receive(:controller_name).and_return("bonobos")
64
- tab = helper.tab(:orders, match_path: /shady$|shady\//)
65
- expect(tab).not_to include('class="selected"')
66
- end
67
- end
68
- end
69
-
70
- it "should accept a block of content to append" do
71
- admin_tab = helper.tab(:orders){ 'foo' }
72
- expect(admin_tab).to end_with("foo</li>")
73
- end
74
- end
75
-
76
- describe "#link_to_delete" do
77
- let!(:item) { create(:stock_item) }
78
- let(:options) { {} }
79
- let(:link) { subject }
80
-
81
- subject { helper.link_to_delete(item, options) }
82
-
83
- # object_url is provided by the ResourceController abstract controller.
84
- # as we cannot set a custom controller for helper tests, we need to fake it
85
- before do
86
- without_partial_double_verification do
87
- allow(helper).to receive(:object_url) do |o|
88
- "/stock_items/#{o.to_param}"
89
- end
90
- end
91
- end
92
-
93
- it "generates a deletion link for the resource" do
94
- expect(link).to include("href=\"/stock_items/#{item.to_param}\"")
95
- expect(link).to include("data-action=\"remove\"")
96
- expect(link).to include("data-confirm=\"Are you sure?\"")
97
- expect(link).to include("<span class=\"text\">Delete</span>")
98
- end
99
-
100
- it "allows customization of the url" do
101
- options[:url] = "/test/url"
102
- expect(link).to include("href=\"/test/url\"")
103
- end
104
-
105
- it "allows customization of the link name" do
106
- options[:name] = "Delete Item"
107
- expect(link).to include("name=\"Delete Item\"")
108
- expect(link).to include("<span class=\"text\">Delete Item</span>")
109
- end
110
-
111
- it "allows customization of the confirmation message" do
112
- options[:confirm] = "Please confirm."
113
- expect(link).to include("data-confirm=\"Please confirm.\"")
114
- end
115
- end
116
-
117
- describe "#solidus_icon" do
118
- context "if given an icon_name" do
119
- subject(:solidus_icon) { helper.solidus_icon('example-icon-name') }
120
-
121
- it { is_expected.to eq "<i class=\"example-icon-name\"></i>" }
122
- end
123
-
124
- context "if not given nil icon_name" do
125
- subject(:solidus_icon) { helper.solidus_icon(nil) }
126
-
127
- it { is_expected.to eq "" }
128
- end
129
- end
130
-
131
- describe "#icon" do
132
- subject(:icon) { helper.icon('icon-name') }
133
-
134
- it "is a deprecated way to use #solidus_icon" do
135
- expect(Spree::Deprecation).to receive(:warn).with("icon is deprecated and will be removed from Solidus 3.0 (use solidus_icon instead)", instance_of(Array))
136
- expect(subject).to eq helper.solidus_icon('icon-name')
137
- end
138
- end
139
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Spree::Admin::StockMovementsHelper, type: :helper do
6
- describe "#pretty_originator" do
7
- let!(:stock_location) { create(:stock_location_with_items) }
8
- let!(:stock_item) { stock_location.stock_items.first }
9
- let(:stock_movement) { create(:stock_movement, stock_item: stock_item, originator: originator) }
10
-
11
- subject { helper.pretty_originator(stock_movement) }
12
-
13
- context "originator has a number" do
14
- let(:originator) { create(:order) }
15
-
16
- it "returns the originator's number" do
17
- expect(subject).to eq originator.number
18
- end
19
- end
20
-
21
- context "originator doesn't have a number" do
22
- let(:originator) { create(:user) }
23
-
24
- it "returns an empty string" do
25
- expect(subject).to eq ""
26
- end
27
- end
28
- end
29
- end
@@ -1,97 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- describe Spree::Admin::StoreCreditEventsHelper, type: :helper do
6
- describe "#store_credit_event_admin_action_name" do
7
- let(:store_credit_event) { create(:store_credit_event, action: action) }
8
-
9
- subject { store_credit_event_admin_action_name(store_credit_event) }
10
-
11
- context "capture event" do
12
- let(:action) { Spree::StoreCredit::CAPTURE_ACTION }
13
-
14
- it "returns the action's display text" do
15
- expect(subject).to eq "Used"
16
- end
17
- end
18
-
19
- context "authorize event" do
20
- let(:action) { Spree::StoreCredit::AUTHORIZE_ACTION }
21
-
22
- it "returns the action's display text" do
23
- expect(subject).to eq "Authorized"
24
- end
25
- end
26
-
27
- context "eligible event" do
28
- let(:action) { Spree::StoreCredit::ELIGIBLE_ACTION }
29
-
30
- it "returns the action's display text" do
31
- expect(subject).to eq "Eligibility Verified"
32
- end
33
- end
34
-
35
- context "allocation event" do
36
- let(:action) { Spree::StoreCredit::ALLOCATION_ACTION }
37
-
38
- it "returns the action's display text" do
39
- expect(subject).to eq "Added"
40
- end
41
- end
42
-
43
- context "void event" do
44
- let(:action) { Spree::StoreCredit::VOID_ACTION }
45
-
46
- it "returns the action's display text" do
47
- expect(subject).to eq "Voided"
48
- end
49
- end
50
-
51
- context "credit event" do
52
- let(:action) { Spree::StoreCredit::CREDIT_ACTION }
53
-
54
- it "returns the action's display text" do
55
- expect(subject).to eq "Credit"
56
- end
57
- end
58
- end
59
-
60
- describe "#store_credit_event_originator_link" do
61
- let(:store_credit_event) { create(:store_credit_adjustment_event, originator: originator) }
62
-
63
- subject { store_credit_event_originator_link(store_credit_event) }
64
-
65
- context "originator is a user" do
66
- let(:originator) { create(:user) }
67
-
68
- it "returns a link to the user's edit page" do
69
- expect(subject).to eq %(<a target=\"_blank\" href=\"/admin/users/#{originator.id}/edit\">User - #{originator.email}</a>)
70
- end
71
- end
72
-
73
- context "originator is a payment" do
74
- let(:originator) { create(:payment) }
75
-
76
- it "returns a link to the order's payments page" do
77
- expect(subject).to eq %(<a target=\"_blank\" href=\"/admin/orders/#{originator.order.number}/payments/#{originator.id}\">Payment - Order ##{originator.order.number}</a>)
78
- end
79
- end
80
-
81
- context "originator is a refund" do
82
- let(:originator) { create(:refund, amount: 1.0) }
83
-
84
- it "returns a link to the order's payments page" do
85
- expect(subject).to eq %(<a target=\"_blank\" href=\"/admin/orders/#{originator.payment.order.number}/payments\">Refund - Order ##{originator.payment.order.number}</a>)
86
- end
87
- end
88
-
89
- context "originator is not specifically handled" do
90
- let(:originator) { create(:store_credit) }
91
-
92
- it "raises an error" do
93
- expect { subject }.to raise_error(RuntimeError, "Unexpected originator type Spree::StoreCredit")
94
- end
95
- end
96
- end
97
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- module Spree
5
- describe Spree::PromotionRulesHelper, type: :helper do
6
- it "does not include existing rules in options" do
7
- promotion = Spree::Promotion.new
8
- promotion.promotion_rules << Spree::Promotion::Rules::ItemTotal.new
9
-
10
- options = helper.options_for_promotion_rule_types(promotion)
11
- expect(options).not_to match(/ItemTotal/)
12
- end
13
- end
14
- end
@@ -1,8 +0,0 @@
1
- <%= javascript_include_tag *@suite.spec_assets, debug: @suite.config.expand_assets, allow_non_precompiled: true %>
2
- <%= render "spree/admin/shared/js_locale_data" %>
3
- <%= javascript_tag do -%>
4
- Spree.env = "<%= Rails.env %>";
5
- <% end %>
6
- <script type="text/javascript">
7
- Teaspoon.onWindowLoad(Teaspoon.execute);
8
- </script>
@@ -1,3 +0,0 @@
1
- <%= fields_for 'price', Spree::Price.new do |f| %>
2
- <%= render 'spree/admin/shared/number_with_currency', f: f %>
3
- <% end %>
@@ -1,3 +0,0 @@
1
- <%= fields_for 'price', Spree::Price.new() do |f| %>
2
- <%= render 'spree/admin/shared/number_with_currency', f: f, currency: 'USD' %>
3
- <% end %>
@@ -1,48 +0,0 @@
1
- describe('Spree.formatMoney', function() {
2
- it('can format USD', function() {
3
- expect(Spree.formatMoney(10, 'USD')).to.equal('$10.00');
4
- expect(Spree.formatMoney('10', 'USD')).to.equal('$10.00');
5
- expect(Spree.formatMoney(12.34, 'USD')).to.equal('$12.34');
6
- expect(Spree.formatMoney('12.34', 'USD')).to.equal('$12.34');
7
- expect(Spree.formatMoney(1000, 'USD')).to.equal('$1,000.00');
8
- });
9
-
10
- it('can format CAD', function() {
11
- expect(Spree.formatMoney(1000, 'CAD')).to.equal('$1,000.00');
12
- });
13
-
14
- it('can format GBP', function() {
15
- expect(Spree.formatMoney(1000, 'GBP')).to.equal('£1,000.00');
16
- });
17
-
18
- it('can format EUR', function() {
19
- expect(Spree.formatMoney(1000, 'EUR')).to.equal('€1,000.00');
20
- });
21
-
22
- it('can format YEN', function() {
23
- expect(Spree.formatMoney(1000, 'JPY')).to.equal('¥1,000');
24
- });
25
-
26
- describe('with comma as decimal', function() {
27
- support.withTranslations({
28
- currency_delimiter: ".",
29
- currency_separator: ","
30
- });
31
-
32
- it('can format USD', function() {
33
- expect(Spree.formatMoney(10, 'USD')).to.equal('$10,00');
34
- expect(Spree.formatMoney('10', 'USD')).to.equal('$10,00');
35
- expect(Spree.formatMoney(12.34, 'USD')).to.equal('$12,34');
36
- expect(Spree.formatMoney('12.34', 'USD')).to.equal('$12,34');
37
- expect(Spree.formatMoney(1000, 'GBP')).to.equal('£1.000,00');
38
- });
39
-
40
- it('can format EUR', function() {
41
- expect(Spree.formatMoney(1000, 'EUR')).to.equal('€1.000,00');
42
- });
43
-
44
- it('can format YEN', function() {
45
- expect(Spree.formatMoney(1000, 'JPY')).to.equal('¥1.000');
46
- });
47
- });
48
- });
@@ -1,13 +0,0 @@
1
- //= require ./support/show_errors
2
- //= require support/sinon
3
- //= require support/chai
4
- //= require support/chai-jq-0.0.7
5
-
6
- //= require_self
7
- //= require jquery
8
- //= require rails-ujs
9
- //= require spree/backend
10
- //= require_tree ./support
11
-
12
- window.support = {};
13
- window.expect = chai.expect;
@@ -1,8 +0,0 @@
1
- /* Teaspoon doesn't show errors by default */
2
- window.onerror = function(message) {
3
- Teaspoon.log(JSON.stringify({
4
- _teaspoon: true,
5
- type: "exception",
6
- message: message
7
- }));
8
- }
@@ -1,11 +0,0 @@
1
- support.withTranslations = function(translations) {
2
- beforeEach(function() {
3
- this._oldTranslations = Spree.translations;
4
- Spree.translations = translations;
5
- });
6
-
7
- afterEach(function() {
8
- Spree.translations = this._oldTranslations;
9
- });
10
- };
11
-
@@ -1,58 +0,0 @@
1
- describe('Spree.t', function() {
2
- support.withTranslations({
3
- simple: "simple",
4
- nested: {
5
- key: "nested key"
6
- },
7
- deeply: {
8
- nested: {
9
- key: "deeply nested key"
10
- }
11
- }
12
- })
13
-
14
- it('can get a simple key', function() {
15
- expect(Spree.t('simple')).to.equal('simple');
16
- });
17
-
18
- it('can get a nested key', function() {
19
- expect(Spree.t('nested.key')).to.equal('nested key');
20
- });
21
-
22
- it('can get a nested key using scope', function() {
23
- expect(Spree.t('key', {scope: 'nested'})).to.equal('nested key');
24
- });
25
-
26
- it('can get a deeply nested key', function() {
27
- expect(Spree.t('deeply.nested.key')).to.equal('deeply nested key');
28
- });
29
-
30
- it('can get a deeply nested key using scope', function() {
31
- expect(Spree.t('nested.key', {scope: 'deeply'})).to.equal('deeply nested key');
32
- expect(Spree.t('key', {scope: 'deeply.nested'})).to.equal('deeply nested key');
33
- });
34
-
35
- it('ignores default when key exists', function() {
36
- expect(Spree.t('simple', {default: 'foo'})).to.equal('simple');
37
- });
38
-
39
- it('returns a default for a missing key', function() {
40
- expect(Spree.t('does_not_exist', {default: 'foo'})).to.equal('foo');
41
- });
42
- });
43
-
44
- describe('Spree.human_attribute_name', function() {
45
- support.withTranslations({
46
- activerecord: {
47
- attributes: {
48
- "spree/model": {
49
- "name": "Name"
50
- }
51
- }
52
- }
53
- });
54
-
55
- it('can get attribute names', function() {
56
- expect(Spree.human_attribute_name('spree/model', "name")).to.equal('Name');
57
- });
58
- });