solidus_backend 1.0.7 → 1.1.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 (201) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend.js +3 -0
  3. data/app/assets/javascripts/spree/backend/admin.js.erb +17 -24
  4. data/app/assets/javascripts/spree/backend/checkouts/edit.js +3 -5
  5. data/app/assets/javascripts/spree/backend/flash.coffee +17 -0
  6. data/app/assets/javascripts/spree/backend/handlebars_extensions.coffee +9 -0
  7. data/app/assets/javascripts/spree/backend/option_type_autocomplete.js.erb +6 -6
  8. data/app/assets/javascripts/spree/backend/option_value_picker.js +43 -0
  9. data/app/assets/javascripts/spree/backend/product_picker.js +10 -8
  10. data/app/assets/javascripts/spree/backend/promotions.js.coffee +101 -0
  11. data/app/assets/javascripts/spree/backend/routes.js +2 -1
  12. data/app/assets/javascripts/spree/backend/shipments.js.erb +1 -1
  13. data/app/assets/javascripts/spree/backend/stock_management/index_add_forms.coffee +1 -1
  14. data/app/assets/javascripts/spree/backend/stock_movement.js.coffee +2 -2
  15. data/app/assets/javascripts/spree/backend/stock_transfers/variant_form.coffee +1 -1
  16. data/app/assets/javascripts/spree/backend/taxon_autocomplete.js.erb +6 -6
  17. data/app/assets/javascripts/spree/backend/taxons.js.coffee +6 -7
  18. data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +17 -0
  19. data/app/assets/javascripts/spree/backend/templates/products/sortable.hbs +5 -0
  20. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +17 -0
  21. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +17 -0
  22. data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +10 -0
  23. data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values_select.hbs +1 -0
  24. data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +19 -0
  25. data/app/assets/javascripts/spree/backend/templates/stock_transfers/transfer_item.hbs.erb +52 -0
  26. data/app/assets/javascripts/spree/backend/templates/variants/autocomplete.hbs.erb +23 -0
  27. data/app/assets/javascripts/spree/backend/templates/variants/autocomplete_stock.hbs +51 -0
  28. data/app/assets/javascripts/spree/backend/templates/variants/line_items_autocomplete_stock.hbs +67 -0
  29. data/app/assets/javascripts/spree/backend/templates/variants/split.hbs +27 -0
  30. data/app/assets/javascripts/spree/backend/user_picker.js +8 -8
  31. data/app/assets/javascripts/spree/backend/variant_autocomplete.js.coffee.erb +6 -8
  32. data/app/assets/stylesheets/spree/backend/components/_messages.scss +6 -3
  33. data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +16 -0
  34. data/app/controllers/spree/admin/base_controller.rb +1 -1
  35. data/app/controllers/spree/admin/option_types_controller.rb +1 -3
  36. data/app/controllers/spree/admin/orders/customer_details_controller.rb +1 -1
  37. data/app/controllers/spree/admin/orders_controller.rb +6 -11
  38. data/app/controllers/spree/admin/product_properties_controller.rb +9 -0
  39. data/app/controllers/spree/admin/products_controller.rb +20 -5
  40. data/app/controllers/spree/admin/promotions_controller.rb +2 -1
  41. data/app/controllers/spree/admin/reimbursements_controller.rb +20 -0
  42. data/app/controllers/spree/admin/resource_controller.rb +1 -1
  43. data/app/controllers/spree/admin/return_authorizations_controller.rb +5 -0
  44. data/app/controllers/spree/admin/root_controller.rb +1 -1
  45. data/app/controllers/spree/admin/search_controller.rb +2 -4
  46. data/app/controllers/spree/admin/states_controller.rb +1 -1
  47. data/app/controllers/spree/admin/stock_items_controller.rb +1 -1
  48. data/app/controllers/spree/admin/stock_transfers_controller.rb +3 -14
  49. data/app/controllers/spree/admin/users_controller.rb +2 -3
  50. data/app/controllers/spree/admin/variant_property_rule_values_controller.rb +7 -0
  51. data/app/controllers/spree/admin/variants_controller.rb +1 -1
  52. data/app/controllers/spree/admin/zones_controller.rb +1 -1
  53. data/app/helpers/spree/admin/adjustments_helper.rb +4 -9
  54. data/app/helpers/spree/admin/base_helper.rb +7 -6
  55. data/app/helpers/spree/admin/navigation_helper.rb +8 -2
  56. data/app/helpers/spree/admin/orders_helper.rb +1 -1
  57. data/app/helpers/spree/admin/products_helper.rb +2 -4
  58. data/app/helpers/spree/admin/stock_movements_helper.rb +3 -3
  59. data/app/views/spree/admin/adjustments/_adjustment.html.erb +1 -1
  60. data/app/views/spree/admin/orders/_add_line_item.html.erb +0 -5
  61. data/app/views/spree/admin/orders/_add_product.html.erb +0 -3
  62. data/app/views/spree/admin/orders/_carton.html.erb +0 -1
  63. data/app/views/spree/admin/orders/_shipment.html.erb +0 -1
  64. data/app/views/spree/admin/orders/confirm/_shipment.html.erb +0 -1
  65. data/app/views/spree/admin/orders/customer_details/_form.html.erb +1 -1
  66. data/app/views/spree/admin/orders/customer_details/edit.html.erb +0 -1
  67. data/app/views/spree/admin/orders/index.html.erb +1 -2
  68. data/app/views/spree/admin/payment_methods/_form.html.erb +0 -4
  69. data/app/views/spree/admin/payment_methods/index.html.erb +0 -2
  70. data/app/views/spree/admin/payments/source_views/_gateway.html.erb +3 -0
  71. data/app/views/spree/admin/product_properties/index.html.erb +52 -2
  72. data/app/views/spree/admin/promotions/_actions.html.erb +14 -10
  73. data/app/views/spree/admin/promotions/_promotion_action.html.erb +5 -3
  74. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +5 -3
  75. data/app/views/spree/admin/promotions/_rules.html.erb +18 -14
  76. data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +5 -28
  77. data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +5 -27
  78. data/app/views/spree/admin/promotions/edit.html.erb +6 -4
  79. data/app/views/spree/admin/promotions/index.html.erb +1 -1
  80. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +13 -0
  81. data/app/views/spree/admin/refund_reasons/index.html.erb +2 -2
  82. data/app/views/spree/admin/reimbursements/edit.html.erb +1 -1
  83. data/app/views/spree/admin/return_authorizations/_form.html.erb +2 -2
  84. data/app/views/spree/admin/search/users.rabl +1 -1
  85. data/app/views/spree/admin/shared/_order_summary.html.erb +6 -0
  86. data/app/views/spree/admin/shared/_tabs.html.erb +2 -2
  87. data/app/views/spree/admin/shared/_translations.html.erb +16 -46
  88. data/app/views/spree/admin/shared/named_types/_index.html.erb +2 -2
  89. data/app/views/spree/admin/stock_items/_stock_management.html.erb +0 -2
  90. data/app/views/spree/admin/stock_movements/_form.html.erb +0 -2
  91. data/app/views/spree/admin/stock_transfers/edit.html.erb +0 -3
  92. data/app/views/spree/admin/stock_transfers/receive.html.erb +0 -2
  93. data/app/views/spree/admin/stock_transfers/show.html.erb +1 -1
  94. data/app/views/spree/admin/taxons/index.html.erb +0 -1
  95. data/app/views/spree/admin/users/_addresses_form.html.erb +4 -4
  96. data/app/views/spree/layouts/admin.html.erb +11 -9
  97. data/config/routes.rb +5 -0
  98. data/lib/spree/backend.rb +1 -2
  99. metadata +41 -139
  100. data/CHANGELOG.md +0 -1
  101. data/Gemfile +0 -6
  102. data/Rakefile +0 -15
  103. data/app/assets/javascripts/spree/backend/handlebar_extensions.js +0 -9
  104. data/app/assets/javascripts/spree/backend/promotions.js +0 -73
  105. data/app/assets/javascripts/spree/backend/stock_transfer.js.coffee +0 -196
  106. data/app/views/spree/admin/products/_autocomplete.js.erb +0 -14
  107. data/app/views/spree/admin/products/_sortable.html +0 -7
  108. data/app/views/spree/admin/stock_items/_stock_location_stock_item_template.html.erb +0 -21
  109. data/app/views/spree/admin/stock_transfers/_transfer_item_template.html.erb +0 -54
  110. data/app/views/spree/admin/variants/_autocomplete.js.erb +0 -25
  111. data/app/views/spree/admin/variants/_autocomplete_line_items_stock.js.erb +0 -69
  112. data/app/views/spree/admin/variants/_autocomplete_stock.js.erb +0 -53
  113. data/app/views/spree/admin/variants/_split.js.erb +0 -29
  114. data/script/rails +0 -9
  115. data/solidus_backend.gemspec +0 -30
  116. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -24
  117. data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -77
  118. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -234
  119. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
  120. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
  121. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -80
  122. data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -472
  123. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
  124. data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -175
  125. data/spec/controllers/spree/admin/products_controller_spec.rb +0 -45
  126. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
  127. data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -18
  128. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
  129. data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
  130. data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
  131. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -75
  132. data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -134
  133. data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -166
  134. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -226
  135. data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
  136. data/spec/controllers/spree/admin/root_controller_spec.rb +0 -41
  137. data/spec/controllers/spree/admin/search_controller_spec.rb +0 -104
  138. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
  139. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -50
  140. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
  141. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -331
  142. data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -309
  143. data/spec/controllers/spree/admin/users_controller_spec.rb +0 -236
  144. data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
  145. data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -54
  146. data/spec/features/admin/configuration/countries_spec.rb +0 -22
  147. data/spec/features/admin/configuration/general_settings_spec.rb +0 -45
  148. data/spec/features/admin/configuration/payment_methods_spec.rb +0 -125
  149. data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -64
  150. data/spec/features/admin/configuration/states_spec.rb +0 -64
  151. data/spec/features/admin/configuration/stock_locations_spec.rb +0 -50
  152. data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
  153. data/spec/features/admin/configuration/tax_rates_spec.rb +0 -30
  154. data/spec/features/admin/configuration/taxonomies_spec.rb +0 -52
  155. data/spec/features/admin/configuration/zones_spec.rb +0 -39
  156. data/spec/features/admin/homepage_spec.rb +0 -78
  157. data/spec/features/admin/locale_spec.rb +0 -30
  158. data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
  159. data/spec/features/admin/orders/adjustments_spec.rb +0 -126
  160. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -48
  161. data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -48
  162. data/spec/features/admin/orders/customer_details_spec.rb +0 -163
  163. data/spec/features/admin/orders/line_items_spec.rb +0 -50
  164. data/spec/features/admin/orders/listing_spec.rb +0 -130
  165. data/spec/features/admin/orders/log_entries_spec.rb +0 -55
  166. data/spec/features/admin/orders/new_order_spec.rb +0 -197
  167. data/spec/features/admin/orders/order_details_spec.rb +0 -533
  168. data/spec/features/admin/orders/payments_spec.rb +0 -228
  169. data/spec/features/admin/orders/risk_analysis_spec.rb +0 -47
  170. data/spec/features/admin/orders/shipments_spec.rb +0 -65
  171. data/spec/features/admin/payments/store_credits_spec.rb +0 -21
  172. data/spec/features/admin/products/edit/images_spec.rb +0 -87
  173. data/spec/features/admin/products/edit/products_spec.rb +0 -66
  174. data/spec/features/admin/products/edit/taxons_spec.rb +0 -56
  175. data/spec/features/admin/products/edit/variants_spec.rb +0 -61
  176. data/spec/features/admin/products/option_types_spec.rb +0 -114
  177. data/spec/features/admin/products/products_spec.rb +0 -392
  178. data/spec/features/admin/products/properties_spec.rb +0 -139
  179. data/spec/features/admin/products/prototypes_spec.rb +0 -110
  180. data/spec/features/admin/products/stock_management_spec.rb +0 -82
  181. data/spec/features/admin/products/variant_spec.rb +0 -51
  182. data/spec/features/admin/promotion_adjustments_spec.rb +0 -220
  183. data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -69
  184. data/spec/features/admin/promotions/user_rule_spec.rb +0 -25
  185. data/spec/features/admin/reports_spec.rb +0 -61
  186. data/spec/features/admin/stock_transfer_spec.rb +0 -86
  187. data/spec/features/admin/store_credits_spec.rb +0 -82
  188. data/spec/features/admin/taxons_spec.rb +0 -31
  189. data/spec/features/admin/users_spec.rb +0 -270
  190. data/spec/helpers/admin/base_helper_spec.rb +0 -24
  191. data/spec/helpers/admin/navigation_helper_spec.rb +0 -73
  192. data/spec/helpers/admin/reimbursements_helper_spec.rb +0 -34
  193. data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
  194. data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -95
  195. data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
  196. data/spec/spec_helper.rb +0 -108
  197. data/spec/support/appear_before_matcher.rb +0 -8
  198. data/spec/support/ror_ringer.jpeg +0 -0
  199. data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
  200. data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
  201. data/vendor/assets/javascripts/handlebars.js +0 -2746
@@ -1,139 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Properties", :type => :feature do
4
- stub_authorization!
5
-
6
- before(:each) do
7
- visit spree.admin_path
8
- click_link "Products"
9
- end
10
-
11
- context "Property index" do
12
- before do
13
- create(:property, :name => 'shirt size', :presentation => 'size')
14
- create(:property, :name => 'shirt fit', :presentation => 'fit')
15
- click_link "Properties"
16
- end
17
-
18
- context "listing product properties" do
19
- it "should list the existing product properties" do
20
- within_row(1) do
21
- expect(column_text(1)).to eq("shirt size")
22
- expect(column_text(2)).to eq("size")
23
- end
24
-
25
- within_row(2) do
26
- expect(column_text(1)).to eq("shirt fit")
27
- expect(column_text(2)).to eq("fit")
28
- end
29
- end
30
- end
31
-
32
- context "searching properties" do
33
- it 'should list properties matching search query', :js => true do
34
- fill_in "q_name_cont", :with => "size"
35
- click_icon :search
36
-
37
- expect(page).to have_content("shirt size")
38
- expect(page).not_to have_content("shirt fit")
39
- end
40
- end
41
- end
42
-
43
- context "creating a property" do
44
- it "should allow an admin to create a new product property", :js => true do
45
- click_link "Properties"
46
- click_link "new_property_link"
47
- within('#new_property') { expect(page).to have_content("NEW PROPERTY") }
48
-
49
- fill_in "property_name", :with => "color of band"
50
- fill_in "property_presentation", :with => "color"
51
- click_button "Create"
52
- expect(page).to have_content("successfully created!")
53
- end
54
- end
55
-
56
- context "editing a property" do
57
- before(:each) do
58
- create(:property)
59
- click_link "Properties"
60
- within_row(1) { click_icon :edit }
61
- end
62
-
63
- it "should allow an admin to edit an existing product property" do
64
- fill_in "property_name", :with => "model 99"
65
- click_button "Update"
66
- expect(page).to have_content("successfully updated!")
67
- expect(page).to have_content("model 99")
68
- end
69
-
70
- it "should show validation errors" do
71
- fill_in "property_name", :with => ""
72
- click_button "Update"
73
- expect(page).to have_content("Name can't be blank")
74
- end
75
- end
76
-
77
- context "linking a property to a product", :js => true do
78
- before do
79
- create(:product)
80
- visit spree.admin_products_path
81
- click_icon :edit
82
- click_link "Product Properties"
83
- end
84
-
85
- # Regression test for #2279
86
- it "successfully create and then remove product property" do
87
- fill_in_property
88
-
89
- check_property_row_count(2)
90
-
91
- delete_product_property
92
-
93
- check_property_row_count(1)
94
- end
95
-
96
- # Regression test for #4466
97
- it "successfully remove and create a product property at the same time" do
98
- fill_in_property
99
-
100
- expect(page).to have_css('tr.product_property', count: 2)
101
-
102
- within '#spree_new_product_property' do
103
- find('[id$=_property_name]').set("New Property")
104
- find('[id$=_value]').set("New Value")
105
- end
106
-
107
- delete_product_property
108
-
109
- # Give fadeOut time to complete
110
- expect(page).to have_css('tr.product_property', count: 1)
111
-
112
- click_button "Update"
113
-
114
- expect(page).not_to have_content("Product is not found")
115
-
116
- check_property_row_count(2)
117
- end
118
-
119
- def fill_in_property
120
- expect(page).to have_content('Editing Product')
121
- fill_in "product_product_properties_attributes_0_property_name", :with => "A Property"
122
- fill_in "product_product_properties_attributes_0_value", :with => "A Value"
123
- click_button "Update"
124
- click_link "Product Properties"
125
- end
126
-
127
- def delete_product_property
128
- accept_alert do
129
- click_icon :trash
130
- end
131
- expect(page).to have_content 'successfully removed'
132
- end
133
-
134
- def check_property_row_count(expected_row_count)
135
- click_link "Product Properties"
136
- expect(page).to have_css("tbody#product_properties tr", count: expected_row_count)
137
- end
138
- end
139
- end
@@ -1,110 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Prototypes", :type => :feature do
4
- stub_authorization!
5
-
6
- context "listing prototypes" do
7
- it "should be able to list existing prototypes" do
8
- create(:property, name: "model", presentation: "Model")
9
- create(:property, name: "brand", presentation: "Brand")
10
- create(:property, name: "shirt_fabric", presentation: "Fabric")
11
- create(:property, name: "shirt_sleeve_length", presentation: "Sleeve")
12
- create(:property, name: "mug_type", presentation: "Type")
13
- create(:property, name: "bag_type", presentation: "Type")
14
- create(:property, name: "manufacturer", presentation: "Manufacturer")
15
- create(:property, name: "bag_size", presentation: "Size")
16
- create(:property, name: "mug_size", presentation: "Size")
17
- create(:property, name: "gender", presentation: "Gender")
18
- create(:property, name: "shirt_fit", presentation: "Fit")
19
- create(:property, name: "bag_material", presentation: "Material")
20
- create(:property, name: "shirt_type", presentation: "Type")
21
- p = create(:prototype, :name => "Shirt")
22
- %w( brand gender manufacturer model shirt_fabric shirt_fit shirt_sleeve_length shirt_type ).each do |prop|
23
- p.properties << Spree::Property.find_by_name(prop)
24
- end
25
- p = create(:prototype, name: "Mug")
26
- %w( mug_size mug_type ).each do |prop|
27
- p.properties << Spree::Property.find_by_name(prop)
28
- end
29
- p = create(:prototype, name: "Bag")
30
- %w( bag_type bag_material ).each do |prop|
31
- p.properties << Spree::Property.find_by_name(prop)
32
- end
33
-
34
- visit spree.admin_path
35
- click_link "Products"
36
- click_link "Prototypes"
37
-
38
- within_row(1) { expect(column_text(1)).to eq "Shirt" }
39
- within_row(2) { expect(column_text(1)).to eq "Mug" }
40
- within_row(3) { expect(column_text(1)).to eq "Bag" }
41
- end
42
- end
43
-
44
- context "creating a prototype" do
45
- it "should allow an admin to create a new product prototype", :js => true do
46
- visit spree.admin_path
47
- click_link "Products"
48
- click_link "Prototypes"
49
- click_link "new_prototype_link"
50
- within('#new_prototype') do
51
- expect(page).to have_content("NEW PROTOTYPE")
52
- end
53
- fill_in "prototype_name", with: "male shirts"
54
- click_button "Create"
55
- expect(page).to have_content("successfully created!")
56
- click_link "Prototypes"
57
- within_row(1) { click_icon :edit }
58
- fill_in "prototype_name", with: "Shirt 99"
59
- click_button "Update"
60
- expect(page).to have_content("successfully updated!")
61
- expect(page).to have_content("Shirt 99")
62
- end
63
- end
64
-
65
- context "editing a prototype" do
66
- it "should allow to empty its properties" do
67
- model_property = create(:property, name: "model", presentation: "Model")
68
- brand_property = create(:property, name: "brand", presentation: "Brand")
69
-
70
- shirt_prototype = create(:prototype, name: "Shirt", properties: [])
71
- %w( brand model ).each do |prop|
72
- shirt_prototype.properties << Spree::Property.find_by_name(prop)
73
- end
74
-
75
- visit spree.admin_path
76
- click_link "Products"
77
- click_link "Prototypes"
78
-
79
- click_on "Edit"
80
- property_ids = find_field("prototype_property_ids").value.map(&:to_i)
81
- expect(property_ids).to match_array [model_property.id, brand_property.id]
82
-
83
- unselect "Brand", from: "prototype_property_ids"
84
- unselect "Model", from: "prototype_property_ids"
85
-
86
- click_button 'Update'
87
-
88
- click_on "Edit"
89
-
90
- expect(find_field("prototype_property_ids").value).to be_empty
91
- end
92
- end
93
-
94
- it 'should be deletable', js: true do
95
- shirt_prototype = create(:prototype, name: "Shirt", properties: [])
96
- shirt_prototype.taxons << create(:taxon)
97
-
98
- visit spree.admin_path
99
- click_link "Products"
100
- click_link "Prototypes"
101
-
102
- within("#spree_prototype_#{shirt_prototype.id}") do
103
- page.find('.delete-resource').click
104
- end
105
-
106
- page.evaluate_script('window.confirm = function() { return true; }')
107
-
108
- expect(page).to have_content("Prototype \"#{shirt_prototype.name}\" has been successfully removed!")
109
- end
110
- end
@@ -1,82 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Stock Management", :type => :feature do
4
- stub_authorization!
5
-
6
- before(:each) do
7
- visit spree.admin_path
8
- end
9
-
10
- context "given a product with a variant and a stock location" do
11
- let!(:stock_location) { create(:stock_location, name: 'Default') }
12
- let!(:product) { create(:product, name: 'apache baseball cap', price: 10) }
13
- let!(:variant) { create(:variant, product: product) }
14
- let(:stock_item) { variant.stock_items.find_by(stock_location: stock_location) }
15
-
16
- before do
17
- stock_location.stock_item(variant).update_column(:count_on_hand, 10)
18
-
19
- click_link "Products"
20
- within_row(1) { click_icon :edit }
21
- click_link "Stock Management"
22
- end
23
-
24
- # Regression test for #3304
25
- # It is OK to still render the stock page, ensure no errors in this case
26
- context "with no stock location" do
27
- before do
28
- @product = create(:product, name: 'apache baseball cap', price: 10)
29
- v = @product.variants.create!(sku: 'FOOBAR')
30
- Spree::StockLocation.destroy_all
31
- click_link "Products"
32
- within_row(1) do
33
- click_icon :edit
34
- end
35
- click_link "Stock Management"
36
- end
37
-
38
- it "renders" do
39
- expect(page).to have_content(Spree.t(:editing_product))
40
- expect(page.current_url).to match("admin/products/apache-baseball-cap/stock")
41
- end
42
- end
43
-
44
- it "can create a positive stock adjustment", js: true do
45
- adjust_count_on_hand('14')
46
- stock_item.reload
47
- expect(stock_item.count_on_hand).to eq 14
48
- expect(stock_item.stock_movements.count).to eq 1
49
- expect(stock_item.stock_movements.first.quantity).to eq 4
50
- end
51
-
52
- it "can create a negative stock adjustment", js: true do
53
- adjust_count_on_hand('4')
54
- stock_item.reload
55
- expect(stock_item.count_on_hand).to eq 4
56
- expect(stock_item.stock_movements.count).to eq 1
57
- expect(stock_item.stock_movements.first.quantity).to eq -6
58
- end
59
-
60
- def adjust_count_on_hand(count_on_hand)
61
- find(:css, ".fa-edit[data-id='#{stock_item.id}']").click
62
- find(:css, "[data-variant-id='#{variant.id}'] input[type='number']").set(count_on_hand)
63
- find(:css, ".fa-check[data-id='#{stock_item.id}']").click
64
- expect(page).to have_content('Updated successfully')
65
- end
66
-
67
- context "with multiple stock locations" do
68
- before do
69
- create(:stock_location, name: 'Other location', propagate_all_variants: false)
70
- end
71
-
72
- it "can add stock items to other stock locations", js: true do
73
- visit current_url
74
- fill_in "variant-count-on-hand-#{variant.id}", with: '3'
75
- targetted_select2_search "Other location", from: "#s2id_variant-stock-location-#{variant.id}"
76
- find(:css, ".fa-plus[data-variant-id='#{variant.id}']").click
77
- wait_for_ajax
78
- expect(page).to have_content('Created successfully')
79
- end
80
- end
81
- end
82
- end
@@ -1,51 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe "Variants", :type => :feature do
5
- stub_authorization!
6
-
7
- let(:product) { create(:product_with_option_types, :price => "1.99", :cost_price => "1.00", :weight => "2.5", :height => "3.0", :width => "1.0", :depth => "1.5") }
8
-
9
- context "creating a new variant" do
10
- it "should allow an admin to create a new variant" do
11
- product.options.each do |option|
12
- create(:option_value, :option_type => option.option_type)
13
- end
14
-
15
- visit spree.admin_path
16
- click_link "Products"
17
- within_row(1) { click_icon :edit }
18
- click_link "Variants"
19
- click_on "New Variant"
20
- expect(find('input#variant_price').value).to eq("1.99")
21
- expect(find('input#variant_cost_price').value).to eq("1.00")
22
- expect(find('input#variant_weight').value).to eq("2.50")
23
- expect(find('input#variant_height').value).to eq("3.00")
24
- expect(find('input#variant_width').value).to eq("1.00")
25
- expect(find('input#variant_depth').value).to eq("1.50")
26
- expect(page).to have_select('variant[tax_category_id]')
27
- end
28
- end
29
-
30
- context "listing variants" do
31
- context "currency displaying" do
32
- context "using Russian Rubles" do
33
- before do
34
- Spree::Config[:currency] = "RUB"
35
- end
36
-
37
- let!(:variant) do
38
- create(:variant, :product => product, :price => 19.99)
39
- end
40
-
41
- # Regression test for #2737
42
- context "uses руб as the currency symbol" do
43
- it "on the products listing page" do
44
- visit spree.admin_product_variants_path(product)
45
- within_row(1) { expect(page).to have_content("19.99 ₽") }
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,220 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Promotion Adjustments", :type => :feature do
4
- stub_authorization!
5
-
6
- context "coupon promotions", :js => true do
7
- before(:each) do
8
- visit spree.admin_path
9
- click_link "Promotions"
10
- click_link "New Promotion"
11
- end
12
-
13
- it "should allow an admin to create a flat rate discount coupon promo" do
14
- fill_in "Name", :with => "Promotion"
15
- fill_in "Base code", :with => "order"
16
- fill_in "Number of codes", :with => "1"
17
- click_button "Create"
18
- expect(page).to have_content("Editing Promotion")
19
-
20
- select2 "Item total", :from => "Add rule of type"
21
- within('#rule_fields') { click_button "Add" }
22
-
23
- find('[id$=_preferred_amount]').set(30)
24
- within('#rule_fields') { click_button "Update" }
25
-
26
- select2 "Create whole-order adjustment", :from => "Add action of type"
27
- within('#action_fields') { click_button "Add" }
28
- select2 "Flat Rate", :from => "Calculator"
29
- within('#actions_container') { click_button "Update" }
30
-
31
- within('.calculator-fields') { fill_in "Amount", :with => 5 }
32
- within('#actions_container') { click_button "Update" }
33
-
34
- promotion = Spree::Promotion.find_by_name("Promotion")
35
- expect(promotion.codes.first.value).to eq("order")
36
-
37
- first_rule = promotion.rules.first
38
- expect(first_rule.class).to eq(Spree::Promotion::Rules::ItemTotal)
39
- expect(first_rule.preferred_amount).to eq(30)
40
-
41
- first_action = promotion.actions.first
42
- expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
43
- first_action_calculator = first_action.calculator
44
- expect(first_action_calculator.class).to eq(Spree::Calculator::FlatRate)
45
- expect(first_action_calculator.preferred_amount).to eq(5)
46
- end
47
-
48
- it "should allow an admin to create a single user coupon promo with flat rate discount" do
49
- fill_in "Name", :with => "Promotion"
50
- fill_in "promotion[usage_limit]", :with => "1"
51
- fill_in "Base code", :with => "single_use"
52
- fill_in "Number of codes", :with => "1"
53
- click_button "Create"
54
- expect(page).to have_content("Editing Promotion")
55
-
56
- select2 "Create whole-order adjustment", :from => "Add action of type"
57
- within('#action_fields') { click_button "Add" }
58
- select2 "Flat Rate", :from => "Calculator"
59
- within('#actions_container') { click_button "Update" }
60
- within('#action_fields') { fill_in "Amount", :with => "5" }
61
- within('#actions_container') { click_button "Update" }
62
-
63
- promotion = Spree::Promotion.find_by_name("Promotion")
64
- expect(promotion.usage_limit).to eq(1)
65
- expect(promotion.codes.first.value).to eq("single_use")
66
-
67
- first_action = promotion.actions.first
68
- expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
69
- first_action_calculator = first_action.calculator
70
- expect(first_action_calculator.class).to eq(Spree::Calculator::FlatRate)
71
- expect(first_action_calculator.preferred_amount).to eq(5)
72
- end
73
-
74
- it "should allow an admin to create an automatic promo with flat percent discount" do
75
- fill_in "Name", :with => "Promotion"
76
- click_button "Create"
77
- expect(page).to have_content("Editing Promotion")
78
-
79
- select2 "Item total", :from => "Add rule of type"
80
- within('#rule_fields') { click_button "Add" }
81
-
82
- find('[id$=_preferred_amount]').set(30)
83
- within('#rule_fields') { click_button "Update" }
84
-
85
- select2 "Create whole-order adjustment", :from => "Add action of type"
86
- within('#action_fields') { click_button "Add" }
87
- select2 "Flat Percent", :from => "Calculator"
88
- within('#actions_container') { click_button "Update" }
89
- within('.calculator-fields') { fill_in "Flat Percent", :with => "10" }
90
- within('#actions_container') { click_button "Update" }
91
-
92
- promotion = Spree::Promotion.find_by_name("Promotion")
93
- expect(promotion.codes.first).to be_nil
94
-
95
- first_rule = promotion.rules.first
96
- expect(first_rule.class).to eq(Spree::Promotion::Rules::ItemTotal)
97
- expect(first_rule.preferred_amount).to eq(30)
98
-
99
- first_action = promotion.actions.first
100
- expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
101
- first_action_calculator = first_action.calculator
102
- expect(first_action_calculator.class).to eq(Spree::Calculator::FlatPercentItemTotal)
103
- expect(first_action_calculator.preferred_flat_percent).to eq(10)
104
- end
105
-
106
- it "should allow an admin to create an product promo with percent per item discount" do
107
- create(:product, :name => "RoR Mug")
108
-
109
- fill_in "Name", :with => "Promotion"
110
- click_button "Create"
111
- expect(page).to have_content("Editing Promotion")
112
-
113
- select2 "Product(s)", :from => "Add rule of type"
114
- within("#rule_fields") { click_button "Add" }
115
- select2_search "RoR Mug", :from => "Choose products"
116
- within('#rule_fields') { click_button "Update" }
117
-
118
- select2 "Create per-line-item adjustment", :from => "Add action of type"
119
- within('#action_fields') { click_button "Add" }
120
- select2 "Percent Per Item", :from => "Calculator"
121
- within('#actions_container') { click_button "Update" }
122
- within('.calculator-fields') { fill_in "Percent", :with => "10" }
123
- within('#actions_container') { click_button "Update" }
124
-
125
- promotion = Spree::Promotion.find_by_name("Promotion")
126
- expect(promotion.codes.first).to be_nil
127
-
128
- first_rule = promotion.rules.first
129
- expect(first_rule.class).to eq(Spree::Promotion::Rules::Product)
130
- expect(first_rule.products.map(&:name)).to include("RoR Mug")
131
-
132
- first_action = promotion.actions.first
133
- expect(first_action.class).to eq(Spree::Promotion::Actions::CreateItemAdjustments)
134
- first_action_calculator = first_action.calculator
135
- expect(first_action_calculator.class).to eq(Spree::Calculator::PercentOnLineItem)
136
- expect(first_action_calculator.preferred_percent).to eq(10)
137
- end
138
-
139
- xit "should allow an admin to create an automatic promotion with free shipping (no code)" do
140
- fill_in "Name", :with => "Promotion"
141
- click_button "Create"
142
- expect(page).to have_content("Editing Promotion")
143
-
144
- select2 "Item total", :from => "Add rule of type"
145
- within('#rule_fields') { click_button "Add" }
146
- find('[id$=_preferred_amount]').set(30)
147
- within('#rule_fields') { click_button "Update" }
148
-
149
- select2 "Create whole-order adjustment", :from => "Add action of type"
150
- within('#action_fields') { click_button "Add" }
151
- select2 "Free Shipping", :from => "Calculator"
152
- within('#actions_container') { click_button "Update" }
153
-
154
- promotion = Spree::Promotion.find_by_name("Promotion")
155
- expect(promotion.code.first.value).to be_blank
156
-
157
- first_rule = promotion.rules.first
158
- expect(first_rule.class).to eq(Spree::Promotion::Rules::ItemTotal)
159
-
160
- first_action = promotion.actions.first
161
- expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
162
- first_action_calculator = first_action.calculator
163
- expect(first_action_calculator.class).to eq(Spree::Calculator::FreeShipping)
164
- end
165
-
166
- it "should allow an admin to create an automatic promo requiring a landing page to be visited" do
167
- fill_in "Name", :with => "Promotion"
168
- fill_in "Path", :with => "content/cvv"
169
- click_button "Create"
170
- expect(page).to have_content("Editing Promotion")
171
-
172
- select2 "Create whole-order adjustment", :from => "Add action of type"
173
- within('#action_fields') { click_button "Add" }
174
- select2 "Flat Rate", :from => "Calculator"
175
- within('#actions_container') { click_button "Update" }
176
- within('.calculator-fields') { fill_in "Amount", :with => "4" }
177
- within('#actions_container') { click_button "Update" }
178
-
179
- promotion = Spree::Promotion.find_by_name("Promotion")
180
- expect(promotion.path).to eq("content/cvv")
181
- expect(promotion.codes.first).to be_nil
182
- expect(promotion.rules).to be_blank
183
-
184
- first_action = promotion.actions.first
185
- expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
186
- first_action_calculator = first_action.calculator
187
- expect(first_action_calculator.class).to eq(Spree::Calculator::FlatRate)
188
- expect(first_action_calculator.preferred_amount).to eq(4)
189
- end
190
-
191
- it "ceasing to be eligible for a promotion with item total rule then becoming eligible again" do
192
- fill_in "Name", :with => "Promotion"
193
- click_button "Create"
194
- expect(page).to have_content("Editing Promotion")
195
-
196
- select2 "Item total", :from => "Add rule of type"
197
- within('#rule_fields') { click_button "Add" }
198
- find('[id$=_preferred_amount]').set(50)
199
- within('#rule_fields') { click_button "Update" }
200
-
201
- select2 "Create whole-order adjustment", :from => "Add action of type"
202
- within('#action_fields') { click_button "Add" }
203
- select2 "Flat Rate", :from => "Calculator"
204
- within('#actions_container') { click_button "Update" }
205
- within('.calculator-fields') { fill_in "Amount", :with => "5" }
206
- within('#actions_container') { click_button "Update" }
207
-
208
- promotion = Spree::Promotion.find_by_name("Promotion")
209
-
210
- first_rule = promotion.rules.first
211
- expect(first_rule.class).to eq(Spree::Promotion::Rules::ItemTotal)
212
- expect(first_rule.preferred_amount).to eq(50)
213
-
214
- first_action = promotion.actions.first
215
- expect(first_action.class).to eq(Spree::Promotion::Actions::CreateAdjustment)
216
- expect(first_action.calculator.class).to eq(Spree::Calculator::FlatRate)
217
- expect(first_action.calculator.preferred_amount).to eq(5)
218
- end
219
- end
220
- end