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,48 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Cancelling + Resuming", :type => :feature do
4
-
5
- stub_authorization!
6
-
7
- let(:user) { build_stubbed(:user, id: 123, spree_api_key: 'fake') }
8
-
9
- before do
10
- allow(user).to receive(:has_spree_role?).and_return(true)
11
- allow_any_instance_of(Spree::Admin::BaseController).to receive(:try_spree_current_user).and_return(user)
12
- end
13
-
14
- let(:order) do
15
- order = create(:order)
16
- order.update_columns({
17
- :state => 'complete',
18
- :completed_at => Time.now
19
- })
20
- order
21
- end
22
-
23
- it "can cancel an order" do
24
- visit spree.edit_admin_order_path(order.number)
25
- click_button 'cancel'
26
- within(".additional-info") do
27
- within(".state") do
28
- expect(page).to have_content("canceled")
29
- end
30
- end
31
- end
32
-
33
- context "with a cancelled order" do
34
- before do
35
- order.update_column(:state, 'canceled')
36
- end
37
-
38
- it "can resume an order" do
39
- visit spree.edit_admin_order_path(order.number)
40
- click_button 'resume'
41
- within(".additional-info") do
42
- within(".state") do
43
- expect(page).to have_content("resumed")
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,48 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Cancelling inventory" do
4
- stub_authorization!
5
-
6
- let!(:order) do
7
- create(
8
- :order_ready_to_ship,
9
- number: "R100",
10
- state: "complete",
11
- line_items_count: 1,
12
- )
13
- end
14
-
15
- def visit_order
16
- visit spree.admin_path
17
- click_link "Orders"
18
- within_row(1) do
19
- click_link "R100"
20
- end
21
- end
22
-
23
- context "when some inventory is cancelable" do
24
- it "can cancel the inventory" do
25
- visit_order
26
-
27
- click_link 'Cancel Inventory'
28
-
29
- within_row(1) do
30
- check 'inventory_unit_ids[]'
31
- end
32
-
33
- click_button "Cancel Inventory"
34
- expect(page).to have_content("Inventory canceled")
35
- expect(page).to have_content("1 x canceled")
36
- end
37
- end
38
-
39
- context "when all inventory is not cancelable" do
40
- before { order.inventory_units.each(&:cancel!) }
41
-
42
- it "does not display the link to cancel inventory" do
43
- visit_order
44
-
45
- expect(page).to have_no_content('Cancel Inventory')
46
- end
47
- end
48
- end
@@ -1,163 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Customer Details", type: :feature, js: true do
4
- stub_authorization!
5
-
6
- let(:country) { create(:country, name: "Kangaland") }
7
- let(:state) { create(:state, name: "Alabama", country: country) }
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") }
10
- let!(:product) { create(:product_in_stock) }
11
-
12
- # We need a unique name that will appear for the customer dropdown
13
- let!(:ship_address) { create(:address, country: country, state: state, first_name: "Rumpelstiltskin") }
14
- let!(:bill_address) { create(:address, country: country, state: state, first_name: "Rumpelstiltskin") }
15
-
16
- let!(:user) { create(:user, email: 'foobar@example.com', ship_address: ship_address, bill_address: bill_address) }
17
-
18
- context "brand new order" do
19
- # Regression test for #3335 & #5317
20
- it "associates a user when not using guest checkout" do
21
- visit spree.admin_path
22
- click_link "Orders"
23
- click_link "New Order"
24
- click_on 'Cart'
25
- select2_search product.name, from: Spree.t(:name_or_sku)
26
- within("table.stock-levels") do
27
- find('.variant_quantity').set(1)
28
- end
29
- click_icon :plus
30
- expect(page).to have_css('.line-item')
31
- click_link "Customer Details"
32
- targetted_select2 "foobar@example.com", from: "#s2id_customer_search"
33
- # 5317 - Address prefills using user's default.
34
- expect(page).to have_field('First Name', with: user.bill_address.firstname)
35
- expect(page).to have_field('Last Name', with: user.bill_address.lastname)
36
- expect(page).to have_field('Street Address', with: user.bill_address.address1)
37
- expect(page).to have_field("Street Address (cont'd)", with: user.bill_address.address2)
38
- expect(page).to have_field('City', with: user.bill_address.city)
39
- expect(page).to have_field('Zip', with: user.bill_address.zipcode)
40
- expect(page).to have_field('Country', with: user.bill_address.country_id)
41
- expect(page).to have_field('State', with: user.bill_address.state_id)
42
- expect(page).to have_field('Phone', with: user.bill_address.phone)
43
- click_button "Update"
44
- expect(Spree::Order.last.user).not_to be_nil
45
- end
46
- end
47
-
48
- context "editing an order" do
49
- before do
50
- configure_spree_preferences do |config|
51
- config.default_country_id = country.id
52
- config.company = true
53
- end
54
-
55
- visit spree.admin_path
56
- click_link "Orders"
57
- within('table#listing_orders') { click_icon(:edit) }
58
- end
59
-
60
- context "selected country has no state" do
61
- before { create(:country, iso: "BRA", name: "Brazil") }
62
-
63
- it "changes state field to text input" do
64
- click_link "Customer Details"
65
-
66
- within("#billing") do
67
- targetted_select2 "Brazil", from: "#s2id_order_bill_address_attributes_country_id"
68
- fill_in "order_bill_address_attributes_state_name", with: "Piaui"
69
- end
70
-
71
- click_button "Update"
72
- click_link "Customer Details"
73
- expect(find_field("order_bill_address_attributes_state_name").value).to eq("Piaui")
74
- end
75
- end
76
-
77
- it "should be able to update customer details for an existing order" do
78
- order.ship_address = create(:address)
79
- order.save!
80
-
81
- click_link "Customer Details"
82
- within("#shipping") { fill_in_address "ship" }
83
- within("#billing") { fill_in_address "bill" }
84
-
85
- click_button "Update"
86
- click_link "Customer Details"
87
-
88
- # Regression test for #2950 + #2433
89
- # This act should transition the state of the order as far as it will go too
90
- within("#order_tab_summary") do
91
- expect(find(".state").text).to eq("COMPLETE")
92
- end
93
- end
94
-
95
- it "should show validation errors" do
96
- order.update_attributes!(ship_address_id: nil)
97
- click_link "Customer Details"
98
- click_button "Update"
99
- expect(page).to have_content("Shipping address first name can't be blank")
100
- end
101
-
102
- it "updates order email for an existing order with a user" do
103
- order.update_columns(ship_address_id: ship_address.id, bill_address_id: bill_address.id, state: "confirm", completed_at: nil)
104
- previous_user = order.user
105
- click_link "Customer Details"
106
- fill_in "order_email", with: "newemail@example.com"
107
- expect { click_button "Update" }.to change { order.reload.email }.to "newemail@example.com"
108
- expect(order.user_id).to eq previous_user.id
109
- expect(order.user.email).to eq previous_user.email
110
- end
111
-
112
- context "country associated was removed" do
113
- let(:brazil) { create(:country, iso: "BRA", name: "Brazil") }
114
-
115
- before do
116
- order.bill_address.country.destroy
117
- configure_spree_preferences do |config|
118
- config.default_country_id = brazil.id
119
- end
120
- end
121
-
122
- it "sets default country when displaying form" do
123
- click_link "Customer Details"
124
- expect(find_field("order_bill_address_attributes_country_id").value.to_i).to eq brazil.id
125
- end
126
- end
127
-
128
- # Regression test for #942
129
- context "errors when no shipping methods are available" do
130
- before do
131
- Spree::ShippingMethod.delete_all
132
- end
133
-
134
- specify do
135
- click_link "Customer Details"
136
- # Need to fill in valid information so it passes validations
137
- fill_in "order_ship_address_attributes_firstname", with: "John 99"
138
- fill_in "order_ship_address_attributes_lastname", with: "Doe"
139
- fill_in "order_ship_address_attributes_lastname", with: "Company"
140
- fill_in "order_ship_address_attributes_address1", with: "100 first lane"
141
- fill_in "order_ship_address_attributes_address2", with: "#101"
142
- fill_in "order_ship_address_attributes_city", with: "Bethesda"
143
- fill_in "order_ship_address_attributes_zipcode", with: "20170"
144
-
145
- page.select('Alabama', from: 'order_ship_address_attributes_state_id')
146
- fill_in "order_ship_address_attributes_phone", with: "123-456-7890"
147
- expect { click_button "Update" }.not_to raise_error
148
- end
149
- end
150
- end
151
-
152
- def fill_in_address(kind = "bill")
153
- fill_in "First Name", with: "John 99"
154
- fill_in "Last Name", with: "Doe"
155
- fill_in "Company", with: "Company"
156
- fill_in "Street Address", with: "100 first lane"
157
- fill_in "Street Address (cont'd)", with: "#101"
158
- fill_in "City", with: "Bethesda"
159
- fill_in "Zip", with: "20170"
160
- targetted_select2 "Alabama", from: "#s2id_order_#{kind}_address_attributes_state_id"
161
- fill_in "Phone", with: "123-456-7890"
162
- end
163
- end
@@ -1,50 +0,0 @@
1
- require 'spec_helper'
2
-
3
- # Tests for #3958's features
4
- describe "Order Line Items", type: :feature, js: true do
5
- stub_authorization!
6
-
7
- before do
8
- # Removing the delivery step causes the order page to render a different
9
- # partial, called _line_items, which shows line items rather than shipments
10
- allow(Spree::Order).to receive_messages :checkout_step_names => [:address, :payment, :confirm, :complete]
11
- end
12
-
13
- let!(:order) do
14
- order = create(:order_with_line_items, :line_items_count => 1)
15
- order.shipments.destroy_all
16
- order
17
- end
18
-
19
- it "can edit a line item's quantity" do
20
- visit spree.edit_admin_order_path(order)
21
- within(".line-items") do
22
- find(".edit-line-item").click
23
- fill_in "quantity", :with => 10
24
- find(".save-line-item").click
25
- end
26
- within '.line-item-qty-show' do
27
- expect(page).to have_content("10")
28
- end
29
- within '.line-item-total' do
30
- expect(page).to have_content("$100.00")
31
- end
32
- end
33
-
34
- it "can delete a line item" do
35
- visit spree.edit_admin_order_path(order)
36
-
37
- product_name = find(".line-items tr:nth-child(1) .line-item-name").text
38
-
39
- within(".line-items") do
40
- within_row(1) do
41
- accept_alert do
42
- find(".delete-line-item").click
43
- end
44
- end
45
- end
46
-
47
- expect(find('#order_total')).to have_content("$0.00")
48
- expect(page).not_to have_content(product_name)
49
- end
50
- end
@@ -1,130 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Orders Listing", type: :feature, js: true do
4
- stub_authorization!
5
-
6
- let!(:promotion) { create(:promotion_with_item_adjustment, code: "vnskseiw") }
7
- let(:promotion_code) { promotion.codes.first }
8
-
9
- before(:each) do
10
- allow_any_instance_of(Spree::OrderInventory).to receive(:add_to_shipment)
11
- @order1 = create(:order_with_line_items, created_at: 1.day.from_now, completed_at: 1.day.from_now, number: "R100")
12
- @order2 = create(:order, created_at: 1.day.ago, completed_at: 1.day.ago, number: "R200")
13
- visit spree.admin_orders_path
14
- end
15
-
16
- context "listing orders" do
17
- it "should list existing orders" do
18
- within_row(1) do
19
- expect(column_text(2)).to eq "R100"
20
- expect(column_text(3)).to eq "CART"
21
- end
22
-
23
- within_row(2) do
24
- expect(column_text(2)).to eq "R200"
25
- end
26
- end
27
-
28
- it "should be able to sort the orders listing" do
29
- # default is completed_at desc
30
- within_row(1) { expect(page).to have_content("R100") }
31
- within_row(2) { expect(page).to have_content("R200") }
32
-
33
- click_link "Completed At"
34
-
35
- # Completed at desc
36
- within_row(1) { expect(page).to have_content("R200") }
37
- within_row(2) { expect(page).to have_content("R100") }
38
-
39
- within('table#listing_orders thead') { click_link "Number" }
40
-
41
- # number asc
42
- within_row(1) { expect(page).to have_content("R100") }
43
- within_row(2) { expect(page).to have_content("R200") }
44
- end
45
- end
46
-
47
- context "searching orders" do
48
- it "should be able to search orders" do
49
- click_on 'Filter'
50
- fill_in "q_number_cont", with: "R200"
51
- click_on 'Filter Results'
52
- within_row(1) do
53
- expect(page).to have_content("R200")
54
- end
55
-
56
- # Ensure that the other order doesn't show up
57
- within("table#listing_orders") { expect(page).not_to have_content("R100") }
58
- end
59
-
60
- it "should be able to filter on variant_id" do
61
- click_on 'Filter'
62
- select2_search @order1.products.first.sku, from: Spree.t(:variant)
63
- click_on 'Filter Results'
64
-
65
- within_row(1) do
66
- expect(page).to have_content(@order1.number)
67
- end
68
-
69
- expect(page).not_to have_content(@order2.number)
70
- end
71
-
72
- context "when pagination is really short" do
73
- before do
74
- @old_per_page = Spree::Config[:orders_per_page]
75
- Spree::Config[:orders_per_page] = 1
76
- end
77
-
78
- after do
79
- Spree::Config[:orders_per_page] = @old_per_page
80
- end
81
-
82
- # Regression test for #4004
83
- it "should be able to go from page to page for incomplete orders" do
84
- 10.times { Spree::Order.create email: "incomplete@example.com" }
85
- click_on 'Filter'
86
- uncheck "q_completed_at_not_null"
87
- click_on 'Filter Results'
88
- within(".pagination") do
89
- click_link "2"
90
- end
91
- expect(page).to have_content("incomplete@example.com")
92
- click_on 'Filter'
93
- expect(find("#q_completed_at_not_null")).not_to be_checked
94
- end
95
- end
96
-
97
- it "should be able to search orders using only completed at input" do
98
- click_on 'Filter'
99
- fill_in "q_created_at_gt", with: Date.current
100
-
101
- # Just so the datepicker gets out of poltergeists way.
102
- page.execute_script("$('#q_created_at_gt').datepicker('widget').hide();")
103
-
104
- click_on 'Filter Results'
105
- within_row(1) { expect(page).to have_content("R100") }
106
-
107
- # Ensure that the other order doesn't show up
108
- within("table#listing_orders") { expect(page).not_to have_content("R200") }
109
- end
110
-
111
- context "filter on promotions" do
112
- before(:each) do
113
- @order1.order_promotions.build(
114
- promotion: promotion,
115
- promotion_code: promotion_code,
116
- )
117
- @order1.save
118
- visit spree.admin_orders_path
119
- end
120
-
121
- it "only shows the orders with the selected promotion" do
122
- click_on 'Filter'
123
- fill_in "q_promotions_codes_value_cont", with: promotion.codes.first.value
124
- click_on 'Filter Results'
125
- within_row(1) { expect(page).to have_content("R100") }
126
- within("table#listing_orders") { expect(page).not_to have_content("R200") }
127
- end
128
- end
129
- end
130
- end
@@ -1,55 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Log entries", :type => :feature do
4
- stub_authorization!
5
-
6
- let!(:payment) { create(:payment) }
7
-
8
- context "with a successful log entry" do
9
- before do
10
- response = ActiveMerchant::Billing::Response.new(
11
- true,
12
- "Transaction successful",
13
- :transid => "ABCD1234"
14
- )
15
-
16
- payment.log_entries.create(
17
- :source => payment.source,
18
- :details => response.to_yaml
19
- )
20
- end
21
-
22
- it "shows a successful attempt" do
23
- visit spree.admin_order_payments_path(payment.order)
24
- find("#payment_#{payment.id} a").click
25
- click_link "Logs"
26
- within("#listing_log_entries") do
27
- expect(page).to have_content("Transaction successful")
28
- end
29
- end
30
- end
31
-
32
- context "with a failed log entry" do
33
- before do
34
- response = ActiveMerchant::Billing::Response.new(
35
- false,
36
- "Transaction failed",
37
- :transid => "ABCD1234"
38
- )
39
-
40
- payment.log_entries.create(
41
- :source => payment.source,
42
- :details => response.to_yaml
43
- )
44
- end
45
-
46
- it "shows a failed attempt" do
47
- visit spree.admin_order_payments_path(payment.order)
48
- find("#payment_#{payment.id} a").click
49
- click_link "Logs"
50
- within("#listing_log_entries") do
51
- expect(page).to have_content("Transaction failed")
52
- end
53
- end
54
- end
55
- end