solidus_backend 1.1.4 → 1.2.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 (205) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/solidus-style-guide-logo.png +0 -0
  3. data/app/assets/javascripts/spree/backend/admin.js.erb +1 -7
  4. data/app/assets/javascripts/spree/backend/checkouts/edit.js +2 -2
  5. data/app/assets/javascripts/spree/backend/navigation.coffee +10 -0
  6. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
  7. data/app/assets/javascripts/spree/backend/option_value_picker.js +6 -6
  8. data/app/assets/javascripts/spree/backend/product_picker.js +6 -6
  9. data/app/assets/javascripts/spree/backend/shipments.js.erb +17 -3
  10. data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
  11. data/app/assets/javascripts/spree/backend/style_guide.coffee +2 -0
  12. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
  13. data/app/assets/javascripts/spree/backend/taxonomy.js.coffee +82 -109
  14. data/app/assets/javascripts/spree/backend/taxons.js.coffee +4 -5
  15. data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
  16. data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +3 -3
  17. data/app/assets/javascripts/spree/backend.js +3 -6
  18. data/app/assets/stylesheets/spree/backend/components/_messages.scss +1 -4
  19. data/app/assets/stylesheets/spree/backend/components/_navigation.scss +99 -115
  20. data/app/assets/stylesheets/spree/backend/components/_progress.scss +1 -1
  21. data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +6 -0
  22. data/app/assets/stylesheets/spree/backend/globals/_variables.scss +18 -0
  23. data/app/assets/stylesheets/spree/backend/globals/mixins/_caret.scss +35 -0
  24. data/app/assets/stylesheets/spree/backend/plugins/_powertip.scss +1 -0
  25. data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +132 -0
  26. data/app/assets/stylesheets/spree/backend/sections/_taxonomies.scss +60 -0
  27. data/app/assets/stylesheets/spree/backend/shared/_forms.scss +2 -0
  28. data/app/assets/stylesheets/spree/backend/shared/_layout.scss +36 -4
  29. data/app/assets/stylesheets/spree/backend/shared/_typography.scss +3 -6
  30. data/app/assets/stylesheets/spree/backend/spree_admin.scss +4 -1
  31. data/app/assets/stylesheets/spree/backend.css +1 -1
  32. data/app/controllers/spree/admin/orders_controller.rb +6 -6
  33. data/app/controllers/spree/admin/payment_methods_controller.rb +1 -1
  34. data/app/controllers/spree/admin/payments_controller.rb +1 -1
  35. data/app/controllers/spree/admin/products_controller.rb +0 -1
  36. data/app/controllers/spree/admin/reports_controller.rb +2 -2
  37. data/app/controllers/spree/admin/search_controller.rb +9 -7
  38. data/app/controllers/spree/admin/stock_transfers_controller.rb +6 -14
  39. data/app/controllers/spree/admin/style_guide_controller.rb +33 -0
  40. data/app/helpers/spree/admin/adjustments_helper.rb +2 -6
  41. data/app/helpers/spree/admin/base_helper.rb +7 -6
  42. data/app/helpers/spree/admin/navigation_helper.rb +12 -5
  43. data/app/helpers/spree/admin/orders_helper.rb +1 -1
  44. data/app/helpers/spree/admin/products_helper.rb +2 -4
  45. data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
  46. data/app/views/spree/admin/adjustments/_adjustments_table.html.erb +2 -2
  47. data/app/views/spree/admin/customer_returns/_reimbursements_table.html.erb +1 -1
  48. data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +1 -1
  49. data/app/views/spree/admin/customer_returns/edit.html.erb +1 -1
  50. data/app/views/spree/admin/images/edit.html.erb +1 -3
  51. data/app/views/spree/admin/images/index.html.erb +0 -2
  52. data/app/views/spree/admin/option_types/edit.html.erb +2 -4
  53. data/app/views/spree/admin/option_types/index.html.erb +0 -2
  54. data/app/views/spree/admin/option_types/new.html.erb +0 -2
  55. data/app/views/spree/admin/orders/_shipment_manifest.html.erb +1 -1
  56. data/app/views/spree/admin/orders/index.html.erb +1 -1
  57. data/app/views/spree/admin/product_properties/index.html.erb +0 -1
  58. data/app/views/spree/admin/products/edit.html.erb +0 -2
  59. data/app/views/spree/admin/products/index.html.erb +2 -4
  60. data/app/views/spree/admin/products/new.html.erb +0 -2
  61. data/app/views/spree/admin/promotion_categories/edit.html.erb +0 -2
  62. data/app/views/spree/admin/promotion_categories/index.html.erb +0 -2
  63. data/app/views/spree/admin/promotion_categories/new.html.erb +0 -2
  64. data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +2 -28
  65. data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +2 -26
  66. data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +28 -0
  67. data/app/views/spree/admin/promotions/edit.html.erb +0 -2
  68. data/app/views/spree/admin/promotions/index.html.erb +0 -2
  69. data/app/views/spree/admin/promotions/new.html.erb +0 -2
  70. data/app/views/spree/admin/properties/edit.html.erb +0 -2
  71. data/app/views/spree/admin/properties/index.html.erb +2 -4
  72. data/app/views/spree/admin/properties/new.html.erb +0 -2
  73. data/app/views/spree/admin/properties/new.js.erb +1 -1
  74. data/app/views/spree/admin/prototypes/edit.html.erb +0 -2
  75. data/app/views/spree/admin/prototypes/index.html.erb +0 -2
  76. data/app/views/spree/admin/prototypes/new.html.erb +0 -2
  77. data/app/views/spree/admin/reimbursements/edit.html.erb +2 -2
  78. data/app/views/spree/admin/reimbursements/show.html.erb +9 -9
  79. data/app/views/spree/admin/return_authorizations/_form.html.erb +16 -16
  80. data/app/views/spree/admin/search/users.rabl +1 -1
  81. data/app/views/spree/admin/shared/_head.html.erb +11 -0
  82. data/app/views/spree/admin/shared/_header.html.erb +4 -8
  83. data/app/views/spree/admin/shared/_menu.html.erb +4 -8
  84. data/app/views/spree/admin/shared/_navigation.html.erb +9 -0
  85. data/app/views/spree/admin/shared/_navigation_footer.html.erb +3 -0
  86. data/app/views/spree/admin/shared/_product_sub_menu.html.erb +20 -22
  87. data/app/views/spree/admin/shared/_promotion_sub_menu.html.erb +8 -10
  88. data/app/views/spree/admin/shared/_stock_sub_menu.html.erb +8 -10
  89. data/app/views/spree/admin/shared/_tabs.html.erb +9 -3
  90. data/app/views/spree/admin/shipping_methods/_form.html.erb +2 -2
  91. data/app/views/spree/admin/stock_items/index.html.erb +1 -2
  92. data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -1
  93. data/app/views/spree/admin/stock_transfers/index.html.erb +0 -3
  94. data/app/views/spree/admin/stock_transfers/new.html.erb +0 -2
  95. data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
  96. data/app/views/spree/admin/stock_transfers/show.html.erb +0 -2
  97. data/app/views/spree/admin/stock_transfers/tracking_info.html.erb +0 -2
  98. data/app/views/spree/admin/style_guide/index.html.erb +5 -0
  99. data/app/views/spree/admin/style_guide/topics/forms/_building_forms.html.erb +79 -0
  100. data/app/views/spree/admin/style_guide/topics/forms/_validation.html.erb +14 -0
  101. data/app/views/spree/admin/style_guide/topics/messaging/_flashes.html.erb +13 -0
  102. data/app/views/spree/admin/style_guide/topics/messaging/_loading.html.erb +20 -0
  103. data/app/views/spree/admin/style_guide/topics/messaging/_tooltips.html.erb +16 -0
  104. data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +44 -0
  105. data/app/views/spree/admin/style_guide/topics/tables/_pagination.html.erb +11 -0
  106. data/app/views/spree/admin/style_guide/topics/typography/_colors.html.erb +64 -0
  107. data/app/views/spree/admin/style_guide/topics/typography/_fonts.html.erb +19 -0
  108. data/app/views/spree/admin/style_guide/topics/typography/_icons.html.erb +13 -0
  109. data/app/views/spree/admin/style_guide/topics/typography/_lists.html.erb +25 -0
  110. data/app/views/spree/admin/style_guide/topics/typography/_tags.html.erb +25 -0
  111. data/app/views/spree/admin/taxonomies/_js_head.html.erb +0 -0
  112. data/app/views/spree/admin/taxonomies/edit.erb +5 -6
  113. data/app/views/spree/admin/taxonomies/index.html.erb +0 -2
  114. data/app/views/spree/admin/taxonomies/new.html.erb +0 -2
  115. data/app/views/spree/admin/taxons/_form.html.erb +1 -1
  116. data/app/views/spree/admin/taxons/_list_template.html.erb +17 -0
  117. data/app/views/spree/admin/taxons/index.html.erb +0 -3
  118. data/app/views/spree/admin/users/orders.html.erb +1 -1
  119. data/app/views/spree/admin/variants/edit.html.erb +0 -2
  120. data/app/views/spree/admin/variants/index.html.erb +0 -2
  121. data/app/views/spree/layouts/admin.html.erb +3 -4
  122. data/app/views/spree/layouts/admin_style_guide.html.erb +58 -0
  123. data/config/routes.rb +4 -2
  124. data/lib/spree/backend/engine.rb +0 -1
  125. data/lib/spree/backend.rb +0 -3
  126. data/solidus_backend.gemspec +5 -7
  127. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +1 -1
  128. data/spec/controllers/spree/admin/orders_controller_spec.rb +14 -14
  129. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +2 -4
  130. data/spec/controllers/spree/admin/payments_controller_spec.rb +2 -2
  131. data/spec/controllers/spree/admin/products_controller_spec.rb +3 -3
  132. data/spec/controllers/spree/admin/reports_controller_spec.rb +4 -4
  133. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +1 -1
  134. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +1 -1
  135. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +1 -1
  136. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +13 -11
  137. data/spec/features/admin/configuration/general_settings_spec.rb +10 -7
  138. data/spec/features/admin/configuration/payment_methods_spec.rb +1 -1
  139. data/spec/features/admin/configuration/shipping_methods_spec.rb +1 -1
  140. data/spec/features/admin/configuration/states_spec.rb +1 -1
  141. data/spec/features/admin/configuration/tax_rates_spec.rb +6 -7
  142. data/spec/features/admin/configuration/taxonomies_spec.rb +3 -3
  143. data/spec/features/admin/homepage_spec.rb +6 -6
  144. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +4 -8
  145. data/spec/features/admin/orders/customer_details_spec.rb +9 -8
  146. data/spec/features/admin/orders/line_items_spec.rb +1 -1
  147. data/spec/features/admin/orders/listing_spec.rb +2 -2
  148. data/spec/features/admin/orders/log_entries_spec.rb +3 -3
  149. data/spec/features/admin/orders/new_order_spec.rb +3 -15
  150. data/spec/features/admin/orders/order_details_spec.rb +17 -20
  151. data/spec/features/admin/orders/payments_spec.rb +10 -10
  152. data/spec/features/admin/orders/shipments_spec.rb +2 -2
  153. data/spec/features/admin/products/edit/images_spec.rb +5 -3
  154. data/spec/features/admin/products/edit/products_spec.rb +11 -11
  155. data/spec/features/admin/products/edit/taxons_spec.rb +14 -38
  156. data/spec/features/admin/products/edit/variants_spec.rb +3 -3
  157. data/spec/features/admin/products/option_types_spec.rb +22 -21
  158. data/spec/features/admin/products/products_spec.rb +15 -12
  159. data/spec/features/admin/products/properties_spec.rb +3 -3
  160. data/spec/features/admin/products/prototypes_spec.rb +4 -4
  161. data/spec/features/admin/products/stock_management_spec.rb +5 -5
  162. data/spec/features/admin/products/variant_spec.rb +8 -8
  163. data/spec/features/admin/promotion_adjustments_spec.rb +6 -13
  164. data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -20
  165. data/spec/features/admin/reports_spec.rb +2 -2
  166. data/spec/features/admin/stock_transfer_spec.rb +3 -3
  167. data/spec/features/admin/store_credits_spec.rb +2 -2
  168. data/spec/features/admin/users_spec.rb +6 -6
  169. data/spec/helpers/admin/navigation_helper_spec.rb +5 -0
  170. data/spec/helpers/admin/reimbursements_helper_spec.rb +1 -1
  171. data/spec/helpers/admin/store_credit_events_helper_spec.rb +1 -1
  172. data/spec/spec_helper.rb +3 -1
  173. data/spec/support/feature/base_feature_helper.rb +10 -0
  174. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  175. data/vendor/assets/images/jquery-ui/ui-bg_flat_0_eeeeee_40x100.png +0 -0
  176. data/vendor/assets/images/jquery-ui/ui-bg_flat_55_ffffff_40x100.png +0 -0
  177. data/vendor/assets/images/jquery-ui/ui-bg_flat_75_ffffff_40x100.png +0 -0
  178. data/vendor/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  179. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_100_f6f6f6_1x100.png +0 -0
  180. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_25_0073ea_1x100.png +0 -0
  181. data/vendor/assets/images/jquery-ui/ui-bg_highlight-soft_50_dddddd_1x100.png +0 -0
  182. data/vendor/assets/images/jquery-ui/ui-icons_0073ea_256x240.png +0 -0
  183. data/vendor/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  184. data/vendor/assets/images/jquery-ui/ui-icons_666666_256x240.png +0 -0
  185. data/vendor/assets/images/jquery-ui/ui-icons_ff0084_256x240.png +0 -0
  186. data/vendor/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  187. data/vendor/assets/javascripts/jquery.powertip.js +792 -423
  188. data/vendor/assets/javascripts/jquery.sticky-kit.min.js +10 -0
  189. data/vendor/assets/javascripts/prism.js +7 -0
  190. data/vendor/assets/stylesheets/prism.css +139 -0
  191. metadata +44 -51
  192. data/app/assets/stylesheets/spree/backend/plugins/_jstree.scss +0 -135
  193. data/app/views/spree/admin/shared/_sub_menu.html.erb +0 -9
  194. data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
  195. data/vendor/assets/javascripts/equalize.js +0 -41
  196. data/vendor/assets/javascripts/jquery.jstree/jquery.jstree.js +0 -4540
  197. data/vendor/assets/javascripts/jquery.jstree/themes/apple/bg.jpg +0 -0
  198. data/vendor/assets/javascripts/jquery.jstree/themes/apple/d.png +0 -0
  199. data/vendor/assets/javascripts/jquery.jstree/themes/apple/dot_for_ie.gif +0 -0
  200. data/vendor/assets/javascripts/jquery.jstree/themes/apple/style.scss +0 -61
  201. data/vendor/assets/javascripts/jquery.jstree/themes/apple/throbber.gif +0 -0
  202. data/vendor/assets/javascripts/jquery.vAlign.js +0 -11
  203. data/vendor/assets/javascripts/modernizr.js +0 -4
  204. data/vendor/assets/javascripts/responsive-tables.js +0 -42
  205. data/vendor/assets/stylesheets/responsive-tables.css +0 -21
@@ -10,7 +10,7 @@ module Spree
10
10
 
11
11
  let(:payment_method) { GatewayWithPassword.create!(:name => "Bogus", :preferred_password => "haxme") }
12
12
 
13
- # regression test for #2094
13
+ # regression test for https://github.com/spree/spree/issues/2094
14
14
  it "does not clear password on update" do
15
15
  expect(payment_method.preferred_password).to eq("haxme")
16
16
  spree_put :update, :id => payment_method.id, :payment_method => { :type => payment_method.class.to_s, :preferred_password => "" }
@@ -22,9 +22,7 @@ module Spree
22
22
 
23
23
  context "tries to save invalid payment" do
24
24
  it "doesn't break, responds nicely" do
25
- expect {
26
- spree_post :create, :payment_method => { :name => "", :type => "Spree::Gateway::Bogus" }
27
- }.not_to raise_error
25
+ spree_post :create, :payment_method => { :name => "", :type => "Spree::Gateway::Bogus" }
28
26
  end
29
27
  end
30
28
 
@@ -23,7 +23,7 @@ module Spree
23
23
  :source_attributes => {
24
24
  :name => "Test User",
25
25
  :number => "4111 1111 1111 1111",
26
- :expiry => "09 / #{Time.now.year + 1}",
26
+ :expiry => "09 / #{Time.current.year + 1}",
27
27
  :verification_value => "123"
28
28
  }
29
29
  }
@@ -71,7 +71,7 @@ module Spree
71
71
  end
72
72
  end
73
73
 
74
- # Regression test for #3233
74
+ # Regression test for https://github.com/spree/spree/issues/3233
75
75
  context "with a backend payment method" do
76
76
  before do
77
77
  @payment_method = create(:check_payment_method, :display_on => "back_end")
@@ -6,7 +6,7 @@ describe Spree::Admin::ProductsController, :type => :controller do
6
6
  context "#index" do
7
7
  let(:ability_user) { stub_model(Spree::LegacyUser, :has_spree_role? => true) }
8
8
 
9
- # Regression test for #1259
9
+ # Regression test for https://github.com/spree/spree/issues/1259
10
10
  it "can find a product by SKU" do
11
11
  product = create(:product, :sku => "ABC123")
12
12
  spree_get :index, :q => { :sku_start => "ABC123" }
@@ -15,7 +15,7 @@ describe Spree::Admin::ProductsController, :type => :controller do
15
15
  end
16
16
  end
17
17
 
18
- # regression test for #1370
18
+ # regression test for https://github.com/spree/spree/issues/1370
19
19
  context "adding properties to a product" do
20
20
  let!(:product) { create(:product) }
21
21
  specify do
@@ -143,7 +143,7 @@ describe Spree::Admin::ProductsController, :type => :controller do
143
143
  end
144
144
  end
145
145
 
146
- # regression test for #801
146
+ # regression test for https://github.com/spree/spree/issues/801
147
147
  context "destroying a product" do
148
148
  let(:product) do
149
149
  product = create(:product)
@@ -31,10 +31,10 @@ describe Spree::Admin::ReportsController, :type => :controller do
31
31
 
32
32
  before do
33
33
  # can't set completed_at during factory creation
34
- order_complete_start_of_month.completed_at = Time.zone.now.beginning_of_month + 1.minute
34
+ order_complete_start_of_month.completed_at = Time.current.beginning_of_month + 1.minute
35
35
  order_complete_start_of_month.save!
36
36
 
37
- order_complete_mid_month.completed_at = Time.zone.now.beginning_of_month + 15.days
37
+ order_complete_mid_month.completed_at = Time.current.beginning_of_month + 15.days
38
38
  order_complete_mid_month.save!
39
39
  end
40
40
 
@@ -84,7 +84,7 @@ describe Spree::Admin::ReportsController, :type => :controller do
84
84
  end
85
85
 
86
86
  context 'when params has a completed_at_gt' do
87
- let(:params) { { q: { completed_at_gt: Time.zone.now.beginning_of_month + 1.day } } }
87
+ let(:params) { { q: { completed_at_gt: Time.current.beginning_of_month + 1.day } } }
88
88
 
89
89
  it_behaves_like 'sales total report' do
90
90
  let(:expected_returned_orders) { [order_complete_mid_month] }
@@ -101,7 +101,7 @@ describe Spree::Admin::ReportsController, :type => :controller do
101
101
  end
102
102
 
103
103
  context 'when params has a compeleted_at_lt' do
104
- let(:params) { { q: { completed_at_lt: Time.zone.now.beginning_of_month } } }
104
+ let(:params) { { q: { completed_at_lt: Time.current.beginning_of_month } } }
105
105
 
106
106
  it_behaves_like 'sales total report' do
107
107
  let(:expected_returned_orders) { [order_complete_start_of_month] }
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Spree::Admin::ReturnAuthorizationsController, :type => :controller do
4
4
  stub_authorization!
5
5
 
6
- # Regression test for #1370 #3
6
+ # Regression test for https://github.com/spree/spree/issues/1370 #3
7
7
  let!(:order) { create(:shipped_order, line_items_count: 3) }
8
8
  let!(:return_reason) { create(:return_reason) }
9
9
  let(:inventory_unit_1) { order.inventory_units.order('id asc')[0] }
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Spree::Admin::ShippingMethodsController, :type => :controller do
4
4
  stub_authorization!
5
5
 
6
- # Regression test for #1240
6
+ # Regression test for https://github.com/spree/spree/issues/1240
7
7
  it "should not hard-delete shipping methods" do
8
8
  shipping_method = stub_model(Spree::ShippingMethod)
9
9
  allow(Spree::ShippingMethod).to receive_messages :find => shipping_method
@@ -5,7 +5,7 @@ module Spree
5
5
  describe StockLocationsController, :type => :controller do
6
6
  stub_authorization!
7
7
 
8
- # Regression for #4272
8
+ # Regression for https://github.com/spree/spree/issues/4272
9
9
  context "with no countries present" do
10
10
  it "cannot create a new stock location" do
11
11
  spree_get :new
@@ -20,8 +20,8 @@ module Spree
20
20
  StockTransfer.create do |transfer|
21
21
  transfer.source_location_id = warehouse.id
22
22
  transfer.destination_location_id = la_store.id
23
- transfer.finalized_at = DateTime.now
24
- transfer.closed_at = DateTime.now
23
+ transfer.finalized_at = DateTime.current
24
+ transfer.closed_at = DateTime.current
25
25
  end }
26
26
 
27
27
  describe "stock location filtering" do
@@ -31,8 +31,8 @@ module Spree
31
31
 
32
32
  before do
33
33
  ability.cannot :manage, Spree::StockLocation
34
- ability.can :transfer_from, Spree::StockLocation, id: [warehouse.id]
35
- ability.can :transfer_to, Spree::StockLocation, id: [ny_store.id, la_store.id]
34
+ ability.can :display, Spree::StockLocation, id: [warehouse.id]
35
+ ability.can :display, Spree::StockLocation, id: [ny_store.id, la_store.id]
36
36
 
37
37
  allow_any_instance_of(Spree::Admin::BaseController).to receive(:spree_current_user).and_return(user)
38
38
  allow_any_instance_of(Spree::Admin::BaseController).to receive(:current_ability).and_return(ability)
@@ -163,7 +163,7 @@ module Spree
163
163
 
164
164
  context 'stock transfer is not finalizable' do
165
165
  before do
166
- transfer_with_items.update_attributes(finalized_at: Time.now)
166
+ transfer_with_items.update_attributes(finalized_at: Time.current)
167
167
  end
168
168
 
169
169
  it 'redirects back to edit' do
@@ -302,12 +302,14 @@ module Spree
302
302
  end
303
303
  end
304
304
 
305
- context "#finish" do
306
- let(:stock_transfer) { Spree::StockTransfer.create(source_location: warehouse, destination_location: ny_store, created_by: create(:admin_user))}
305
+ context "#ship" do
306
+ let(:stock_transfer) { Spree::StockTransfer.create(source_location: warehouse, destination_location: ny_store, created_by: create(:admin_user)) }
307
307
  let(:transfer_variant) { create(:variant) }
308
308
  let(:warehouse_stock_item) { warehouse.stock_items.find_by(variant: transfer_variant) }
309
309
  let(:ny_stock_item) { ny_store.stock_items.find_by(variant: transfer_variant) }
310
310
 
311
+ subject { spree_put :ship, id: stock_transfer.number }
312
+
311
313
  before do
312
314
  warehouse_stock_item.set_count_on_hand(1)
313
315
  stock_transfer.transfer_items.create!(variant: transfer_variant, expected_quantity: 1)
@@ -316,14 +318,14 @@ module Spree
316
318
  context "with transferable items" do
317
319
 
318
320
  it "marks the transfer shipped" do
319
- spree_put :ship, :id => stock_transfer.number
321
+ subject
320
322
 
321
323
  expect(stock_transfer.reload.shipped_at).to_not be_nil
322
324
  expect(flash[:success]).to be_present
323
325
  end
324
326
 
325
327
  it "makes stock movements for the transferred items" do
326
- spree_put :ship, :id => stock_transfer.number
328
+ subject
327
329
 
328
330
  expect(Spree::StockMovement.count).to eq 1
329
331
  expect(warehouse_stock_item.reload.count_on_hand).to eq 0
@@ -334,13 +336,13 @@ module Spree
334
336
  before { warehouse_stock_item.set_count_on_hand(0) }
335
337
 
336
338
  it "does not mark the transfer shipped" do
337
- spree_put :ship, :id => stock_transfer.number
339
+ subject
338
340
 
339
341
  expect(stock_transfer.reload.shipped_at).to be_nil
340
342
  end
341
343
 
342
344
  it "errors and redirects to tracking_info page" do
343
- spree_put :ship, :id => stock_transfer.number
345
+ subject
344
346
 
345
347
  expect(flash[:error]).to match /not enough inventory/
346
348
  expect(response).to redirect_to(spree.tracking_info_admin_stock_transfer_path(stock_transfer))
@@ -3,9 +3,12 @@ require 'spec_helper'
3
3
  describe "General Settings", type: :feature, js: true do
4
4
  stub_authorization!
5
5
 
6
+ let!(:store) do
7
+ create(:store, name: 'Test Store', url: 'test.example.org',
8
+ mail_from_address: 'test@example.org')
9
+ end
10
+
6
11
  before(:each) do
7
- store = create(:store, name: 'Test Store', url: 'test.example.org',
8
- mail_from_address: 'test@example.org')
9
12
  visit spree.admin_path
10
13
  click_link "Settings"
11
14
  click_link "General Settings"
@@ -14,9 +17,9 @@ describe "General Settings", type: :feature, js: true do
14
17
  context "visiting general settings (admin)" do
15
18
  it "should have the right content" do
16
19
  expect(page).to have_content("General Settings")
17
- expect(find("#store_name").value).to eq("Test Store")
18
- expect(find("#store_url").value).to eq("test.example.org")
19
- expect(find("#store_mail_from_address").value).to eq("test@example.org")
20
+ expect(page).to have_field("store_name", with: "Test Store")
21
+ expect(page).to have_field("store_url", with: "test.example.org")
22
+ expect(page).to have_field("store_mail_from_address", with: "test@example.org")
20
23
  end
21
24
  end
22
25
 
@@ -27,8 +30,8 @@ describe "General Settings", type: :feature, js: true do
27
30
  click_button "Update"
28
31
 
29
32
  assert_successful_update_message(:general_settings)
30
- expect(find("#store_name").value).to eq("Spree Demo Site99")
31
- expect(find("#store_mail_from_address").value).to eq("spree@example.org")
33
+ expect(page).to have_field("store_name", with: "Spree Demo Site99")
34
+ expect(page).to have_field("store_mail_from_address", with: "spree@example.org")
32
35
  end
33
36
  end
34
37
 
@@ -52,7 +52,7 @@ describe "Payment Methods", :type => :feature do
52
52
  fill_in "payment_method_name", :with => "Payment 99"
53
53
  click_button "Update"
54
54
  expect(page).to have_content("successfully updated!")
55
- expect(find_field("payment_method_name").value).to eq("Payment 99")
55
+ expect(page).to have_field("payment_method_name", with: "Payment 99")
56
56
  end
57
57
 
58
58
  it "should display validation errors" do
@@ -46,7 +46,7 @@ describe "Shipping Methods", :type => :feature do
46
46
  end
47
47
  end
48
48
 
49
- # Regression test for #1331
49
+ # Regression test for https://github.com/spree/spree/issues/1331
50
50
  context "update" do
51
51
  it "can change the calculator", :js => true do
52
52
  within("#listing_shipping_methods") do
@@ -46,7 +46,7 @@ describe "States", :type => :feature do
46
46
  click_button "Create"
47
47
  expect(page).to have_content("successfully created!")
48
48
  expect(page).to have_content("Pest megye")
49
- expect(find("#s2id_country span").text).to eq("Hungary")
49
+ expect(find("#s2id_country")).to have_content("Hungary")
50
50
  end
51
51
 
52
52
  it "should show validation errors", :js => true do
@@ -10,16 +10,15 @@ describe "Tax Rates", :type => :feature do
10
10
  click_link "Settings"
11
11
  end
12
12
 
13
- # Regression test for #535
13
+ # Regression test for https://github.com/spree/spree/issues/535
14
14
  it "can see a tax rate in the list if the tax category has been deleted" do
15
- tax_rate.tax_category.update_column(:deleted_at, Time.now)
16
- expect { click_link "Tax Rates" }.not_to raise_error
17
- within(:xpath, all("table tbody td")[2].path) do
18
- expect(page).to have_content("N/A")
19
- end
15
+ tax_rate.tax_category.update_column(:deleted_at, Time.current)
16
+ click_link "Tax Rates"
17
+
18
+ expect(find("table tbody td:nth-child(3)")).to have_content('N/A')
20
19
  end
21
20
 
22
- # Regression test for #1422
21
+ # Regression test for https://github.com/spree/spree/issues/1422
23
22
  it "can create a new tax rate" do
24
23
  click_link "Tax Rates"
25
24
  click_link "New Tax Rate"
@@ -12,7 +12,7 @@ describe "Taxonomies", :type => :feature do
12
12
  it "should display existing taxonomies" do
13
13
  create(:taxonomy, :name => 'Brand')
14
14
  create(:taxonomy, :name => 'Categories')
15
- click_link "Taxonomies"
15
+ click_nav "Products", "Taxonomies"
16
16
  within_row(1) { expect(page).to have_content("Brand") }
17
17
  within_row(2) { expect(page).to have_content("Categories") }
18
18
  end
@@ -20,7 +20,7 @@ describe "Taxonomies", :type => :feature do
20
20
 
21
21
  context "create" do
22
22
  before(:each) do
23
- click_link "Taxonomies"
23
+ click_nav "Products", "Taxonomies"
24
24
  click_link "admin_new_taxonomy_link"
25
25
  end
26
26
 
@@ -41,7 +41,7 @@ describe "Taxonomies", :type => :feature do
41
41
  context "edit" do
42
42
  it "should allow an admin to update an existing taxonomy" do
43
43
  create(:taxonomy)
44
- click_link "Taxonomies"
44
+ click_nav "Products", "Taxonomies"
45
45
  within_row(1) { click_icon :edit }
46
46
  fill_in "taxonomy_name", :with => "sports 99"
47
47
  click_button "Update"
@@ -11,7 +11,7 @@ describe "Homepage", :type => :feature do
11
11
  end
12
12
 
13
13
  it "should have a link to overview" do
14
- within(:xpath, ".//figure[@data-hook='logo-wrapper']") { page.find(:xpath, "a[@href='/admin']") }
14
+ within(".admin-nav-header") { page.find(:xpath, "a[@href='/admin']") }
15
15
  end
16
16
 
17
17
  it "should have a link to orders" do
@@ -19,7 +19,7 @@ describe "Homepage", :type => :feature do
19
19
  end
20
20
 
21
21
  it "should have a link to products" do
22
- page.find_link("Products")['/admin/products']
22
+ page.assert_selector(:link, text: "Products", count: 2)
23
23
  end
24
24
 
25
25
  it "should have a link to reports" do
@@ -37,19 +37,19 @@ describe "Homepage", :type => :feature do
37
37
  end
38
38
 
39
39
  it "should have a link to products" do
40
- within('#sub-menu') { page.find_link("Products")['/admin/products'] }
40
+ within('.selected .admin-subnav') { page.find_link("Products")['/admin/products'] }
41
41
  end
42
42
 
43
43
  it "should have a link to option types" do
44
- within('#sub-menu') { page.find_link("Option Types")['/admin/option_types'] }
44
+ within('.selected .admin-subnav') { page.find_link("Option Types")['/admin/option_types'] }
45
45
  end
46
46
 
47
47
  it "should have a link to properties" do
48
- within('#sub-menu') { page.find_link("Properties")['/admin/properties'] }
48
+ within('.selected .admin-subnav') { page.find_link("Properties")['/admin/properties'] }
49
49
  end
50
50
 
51
51
  it "should have a link to prototypes" do
52
- within('#sub-menu') { page.find_link("Prototypes")['/admin/prototypes'] }
52
+ within('.selected .admin-subnav') { page.find_link("Prototypes")['/admin/prototypes'] }
53
53
  end
54
54
  end
55
55
  end
@@ -14,8 +14,8 @@ describe "Cancelling + Resuming", :type => :feature do
14
14
  let(:order) do
15
15
  order = create(:order)
16
16
  order.update_columns({
17
- :state => 'complete',
18
- :completed_at => Time.now
17
+ state: 'complete',
18
+ completed_at: Time.current
19
19
  })
20
20
  order
21
21
  end
@@ -24,9 +24,7 @@ describe "Cancelling + Resuming", :type => :feature do
24
24
  visit spree.edit_admin_order_path(order.number)
25
25
  click_button 'cancel'
26
26
  within(".additional-info") do
27
- within(".state") do
28
- expect(page).to have_content("canceled")
29
- end
27
+ expect(find('dt#order_status + dd')).to have_content("canceled")
30
28
  end
31
29
  end
32
30
 
@@ -39,9 +37,7 @@ describe "Cancelling + Resuming", :type => :feature do
39
37
  visit spree.edit_admin_order_path(order.number)
40
38
  click_button 'resume'
41
39
  within(".additional-info") do
42
- within(".state") do
43
- expect(page).to have_content("resumed")
44
- end
40
+ expect(find('dt#order_status + dd')).to have_content("resumed")
45
41
  end
46
42
  end
47
43
  end
@@ -6,7 +6,7 @@ describe "Customer Details", type: :feature, js: true do
6
6
  let(:country) { create(:country, name: "Kangaland") }
7
7
  let(:state) { create(:state, name: "Alabama", country: country) }
8
8
  let!(:shipping_method) { create(:shipping_method, display_on: "front_end") }
9
- let!(:order) { create(:order, state: 'complete', completed_at: "2011-02-01 12:36:15") }
9
+ let!(:order) { create(:order, ship_address: ship_address, bill_address: bill_address, state: 'complete', completed_at: "2011-02-01 12:36:15") }
10
10
  let!(:product) { create(:product_in_stock) }
11
11
 
12
12
  # We need a unique name that will appear for the customer dropdown
@@ -16,7 +16,7 @@ describe "Customer Details", type: :feature, js: true do
16
16
  let!(:user) { create(:user, email: 'foobar@example.com', ship_address: ship_address, bill_address: bill_address) }
17
17
 
18
18
  context "brand new order" do
19
- # Regression test for #3335 & #5317
19
+ # Regression test for https://github.com/spree/spree/issues/3335 and https://github.com/spree/spree/issues/5317
20
20
  it "associates a user when not using guest checkout" do
21
21
  visit spree.admin_path
22
22
  click_link "Orders"
@@ -69,8 +69,9 @@ describe "Customer Details", type: :feature, js: true do
69
69
  end
70
70
 
71
71
  click_button "Update"
72
+ expect(page).to have_content "Customer Details Updated"
72
73
  click_link "Customer Details"
73
- expect(find_field("order_bill_address_attributes_state_name").value).to eq("Piaui")
74
+ expect(page).to have_field("order_bill_address_attributes_state_name", with: "Piaui")
74
75
  end
75
76
  end
76
77
 
@@ -85,10 +86,10 @@ describe "Customer Details", type: :feature, js: true do
85
86
  click_button "Update"
86
87
  click_link "Customer Details"
87
88
 
88
- # Regression test for #2950 + #2433
89
+ # Regression test for https://github.com/spree/spree/issues/2950 and https://github.com/spree/spree/issues/2433
89
90
  # This act should transition the state of the order as far as it will go too
90
91
  within("#order_tab_summary") do
91
- expect(find(".state").text).to eq("COMPLETE")
92
+ expect(find("dt#order_status + dd")).to have_content("COMPLETE")
92
93
  end
93
94
  end
94
95
 
@@ -121,11 +122,11 @@ describe "Customer Details", type: :feature, js: true do
121
122
 
122
123
  it "sets default country when displaying form" do
123
124
  click_link "Customer Details"
124
- expect(find_field("order_bill_address_attributes_country_id").value.to_i).to eq brazil.id
125
+ expect(page).to have_field("order_bill_address_attributes_country_id", with: brazil.id)
125
126
  end
126
127
  end
127
128
 
128
- # Regression test for #942
129
+ # Regression test for https://github.com/spree/spree/issues/942
129
130
  context "errors when no shipping methods are available" do
130
131
  before do
131
132
  Spree::ShippingMethod.delete_all
@@ -144,7 +145,7 @@ describe "Customer Details", type: :feature, js: true do
144
145
 
145
146
  page.select('Alabama', from: 'order_ship_address_attributes_state_id')
146
147
  fill_in "order_ship_address_attributes_phone", with: "123-456-7890"
147
- expect { click_button "Update" }.not_to raise_error
148
+ click_button "Update"
148
149
  end
149
150
  end
150
151
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- # Tests for #3958's features
3
+ # Tests for https://github.com/spree/spree/issues/3958's features
4
4
  describe "Order Line Items", type: :feature, js: true do
5
5
  stub_authorization!
6
6
 
@@ -79,13 +79,13 @@ describe "Orders Listing", type: :feature, js: true do
79
79
  Spree::Config[:orders_per_page] = @old_per_page
80
80
  end
81
81
 
82
- # Regression test for #4004
82
+ # Regression test for https://github.com/spree/spree/issues/4004
83
83
  it "should be able to go from page to page for incomplete orders" do
84
84
  10.times { Spree::Order.create email: "incomplete@example.com" }
85
85
  click_on 'Filter'
86
86
  uncheck "q_completed_at_not_null"
87
87
  click_on 'Filter Results'
88
- within(".pagination") do
88
+ within(".pagination", match: :first) do
89
89
  click_link "2"
90
90
  end
91
91
  expect(page).to have_content("incomplete@example.com")
@@ -21,7 +21,7 @@ describe "Log entries", :type => :feature do
21
21
 
22
22
  it "shows a successful attempt" do
23
23
  visit spree.admin_order_payments_path(payment.order)
24
- find("#payment_#{payment.id} a").click
24
+ click_on payment.number
25
25
  click_link "Logs"
26
26
  within("#listing_log_entries") do
27
27
  expect(page).to have_content("Transaction successful")
@@ -45,11 +45,11 @@ describe "Log entries", :type => :feature do
45
45
 
46
46
  it "shows a failed attempt" do
47
47
  visit spree.admin_order_payments_path(payment.order)
48
- find("#payment_#{payment.id} a").click
48
+ click_on payment.number
49
49
  click_link "Logs"
50
50
  within("#listing_log_entries") do
51
51
  expect(page).to have_content("Transaction failed")
52
52
  end
53
53
  end
54
54
  end
55
- end
55
+ end
@@ -91,7 +91,7 @@ describe "New Order", :type => :feature do
91
91
  end
92
92
  end
93
93
 
94
- # Regression test for #3958
94
+ # Regression test for https://github.com/spree/spree/issues/3958
95
95
  context "without a delivery step", js: true do
96
96
  before do
97
97
  allow(Spree::Order).to receive_messages checkout_step_names: [:address, :payment, :confirm, :complete]
@@ -119,7 +119,7 @@ describe "New Order", :type => :feature do
119
119
  end
120
120
  end
121
121
 
122
- # Regression test for #3336
122
+ # Regression test for https://github.com/spree/spree/issues/3336
123
123
  context "start by customer address" do
124
124
  it "completes order fine", js: true do
125
125
  click_on "Customer Details"
@@ -149,7 +149,7 @@ describe "New Order", :type => :feature do
149
149
  end
150
150
  end
151
151
 
152
- # Regression test for #5327
152
+ # Regression test for https://github.com/spree/spree/issues/5327
153
153
  context "customer with default credit card", js: true do
154
154
  before do
155
155
  create(:credit_card, default: true, user: user)
@@ -172,18 +172,6 @@ describe "New Order", :type => :feature do
172
172
  end
173
173
  end
174
174
 
175
- context "customer with attempted XSS", js: true do
176
- let(:xss_string) { %(<script>throw("XSS")</script>) }
177
- before do
178
- user.update!(email: xss_string)
179
- end
180
- it "displays the user's email escaped without executing" do
181
- click_on "Customer Details"
182
- targetted_select2_search user.email, from: "#s2id_customer_search"
183
- expect(page).to have_field("Email", with: xss_string)
184
- end
185
- end
186
-
187
175
  def fill_in_address(kind = "bill")
188
176
  fill_in "First Name", with: "John 99"
189
177
  fill_in "Last Name", with: "Doe"
@@ -67,7 +67,7 @@ describe "Order Details", type: :feature, js: true do
67
67
  expect(page).not_to have_content("spree t-shirt")
68
68
  end
69
69
 
70
- # Regression test for #3862
70
+ # Regression test for https://github.com/spree/spree/issues/3862
71
71
  it "can cancel removing an item from a shipment" do
72
72
  expect(page).to have_content("spree t-shirt")
73
73
 
@@ -373,12 +373,12 @@ describe "Order Details", type: :feature, js: true do
373
373
  fill_in 'item_quantity', with: 1
374
374
  click_icon :ok
375
375
 
376
- wait_for_ajax
377
-
378
- within_row(1) { click_icon 'arrows-h' }
379
- targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
380
- fill_in 'item_quantity', with: 200
381
- click_icon :ok
376
+ within(all('.stock-contents', count: 2).first) do
377
+ within_row(1) { click_icon 'arrows-h' }
378
+ targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
379
+ fill_in 'item_quantity', with: 200
380
+ click_icon :ok
381
+ end
382
382
 
383
383
  wait_for_ajax
384
384
 
@@ -424,26 +424,23 @@ describe "Order Details", type: :feature, js: true do
424
424
  product.master.stock_items.last.update_column(:count_on_hand, 0)
425
425
  expect(@shipment2.reload.backordered?).to eq(false)
426
426
 
427
-
428
427
  within_row(1) { click_icon 'arrows-h' }
429
428
  targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
430
429
  fill_in 'item_quantity', with: 1
431
430
  click_icon :ok
432
431
 
433
- wait_for_ajax
434
-
435
- expect(@shipment2.reload.backordered?).to eq(true)
432
+ expect(page).to have_content("1 x backordered")
436
433
 
437
- within_row(1) { click_icon 'arrows-h' }
438
- targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
439
- fill_in 'item_quantity', with: 1
440
- click_icon :ok
441
-
442
- wait_for_ajax
434
+ within('.stock-contents', text: "1 x on hand") do
435
+ within_row(1) { click_icon 'arrows-h' }
436
+ targetted_select2 @shipment2.number, from: '#s2id_item_stock_location'
437
+ fill_in 'item_quantity', with: 1
438
+ click_icon :ok
439
+ end
443
440
 
444
- expect(order.shipments.count).to eq(1)
445
- expect(order.shipments.last.inventory_units_for(product.master).count).to eq(2)
446
- expect(@shipment2.reload.backordered?).to eq(true)
441
+ # Empty shipment should be removed
442
+ expect(page).to have_css('.stock-contents', count: 1)
443
+ expect(page).to have_content("2 x backordered")
447
444
  end
448
445
  end
449
446
  end