solidus_backend 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of solidus_backend might be problematic. Click here for more details.

Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -0
  3. data/Rakefile +15 -0
  4. data/script/rails +9 -0
  5. data/solidus_backend.gemspec +30 -0
  6. data/spec/controllers/spree/admin/base_controller_spec.rb +24 -0
  7. data/spec/controllers/spree/admin/cancellations_controller_spec.rb +77 -0
  8. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +234 -0
  9. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +41 -0
  10. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +18 -0
  11. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +80 -0
  12. data/spec/controllers/spree/admin/orders_controller_spec.rb +460 -0
  13. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +49 -0
  14. data/spec/controllers/spree/admin/payments_controller_spec.rb +175 -0
  15. data/spec/controllers/spree/admin/product_properties_controller_spec.rb +69 -0
  16. data/spec/controllers/spree/admin/products_controller_spec.rb +162 -0
  17. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +21 -0
  18. data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +18 -0
  19. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +21 -0
  20. data/spec/controllers/spree/admin/promotions_controller_spec.rb +122 -0
  21. data/spec/controllers/spree/admin/refunds_controller_spec.rb +32 -0
  22. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +124 -0
  23. data/spec/controllers/spree/admin/reports_controller_spec.rb +134 -0
  24. data/spec/controllers/spree/admin/resource_controller_spec.rb +166 -0
  25. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +240 -0
  26. data/spec/controllers/spree/admin/return_items_controller_spec.rb +27 -0
  27. data/spec/controllers/spree/admin/root_controller_spec.rb +41 -0
  28. data/spec/controllers/spree/admin/search_controller_spec.rb +104 -0
  29. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +14 -0
  30. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +50 -0
  31. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +41 -0
  32. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +351 -0
  33. data/spec/controllers/spree/admin/store_credits_controller_spec.rb +309 -0
  34. data/spec/controllers/spree/admin/users_controller_spec.rb +257 -0
  35. data/spec/controllers/spree/admin/variants_controller_spec.rb +32 -0
  36. data/spec/features/admin/configuration/analytics_tracker_spec.rb +50 -0
  37. data/spec/features/admin/configuration/countries_spec.rb +22 -0
  38. data/spec/features/admin/configuration/general_settings_spec.rb +45 -0
  39. data/spec/features/admin/configuration/payment_methods_spec.rb +124 -0
  40. data/spec/features/admin/configuration/shipping_methods_spec.rb +64 -0
  41. data/spec/features/admin/configuration/states_spec.rb +64 -0
  42. data/spec/features/admin/configuration/stock_locations_spec.rb +50 -0
  43. data/spec/features/admin/configuration/tax_categories_spec.rb +56 -0
  44. data/spec/features/admin/configuration/tax_rates_spec.rb +30 -0
  45. data/spec/features/admin/configuration/taxonomies_spec.rb +52 -0
  46. data/spec/features/admin/configuration/zones_spec.rb +39 -0
  47. data/spec/features/admin/homepage_spec.rb +78 -0
  48. data/spec/features/admin/locale_spec.rb +30 -0
  49. data/spec/features/admin/orders/adjustments_promotions_spec.rb +53 -0
  50. data/spec/features/admin/orders/adjustments_spec.rb +126 -0
  51. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +48 -0
  52. data/spec/features/admin/orders/cancelling_inventory_spec.rb +48 -0
  53. data/spec/features/admin/orders/customer_details_spec.rb +163 -0
  54. data/spec/features/admin/orders/line_items_spec.rb +50 -0
  55. data/spec/features/admin/orders/listing_spec.rb +130 -0
  56. data/spec/features/admin/orders/log_entries_spec.rb +55 -0
  57. data/spec/features/admin/orders/new_order_spec.rb +185 -0
  58. data/spec/features/admin/orders/order_details_spec.rb +533 -0
  59. data/spec/features/admin/orders/payments_spec.rb +234 -0
  60. data/spec/features/admin/orders/risk_analysis_spec.rb +47 -0
  61. data/spec/features/admin/orders/shipments_spec.rb +65 -0
  62. data/spec/features/admin/payments/store_credits_spec.rb +21 -0
  63. data/spec/features/admin/products/edit/images_spec.rb +87 -0
  64. data/spec/features/admin/products/edit/products_spec.rb +66 -0
  65. data/spec/features/admin/products/edit/taxons_spec.rb +43 -0
  66. data/spec/features/admin/products/edit/variants_spec.rb +61 -0
  67. data/spec/features/admin/products/option_types_spec.rb +114 -0
  68. data/spec/features/admin/products/products_spec.rb +395 -0
  69. data/spec/features/admin/products/properties_spec.rb +139 -0
  70. data/spec/features/admin/products/prototypes_spec.rb +110 -0
  71. data/spec/features/admin/products/stock_management_spec.rb +82 -0
  72. data/spec/features/admin/products/variant_spec.rb +51 -0
  73. data/spec/features/admin/promotion_adjustments_spec.rb +220 -0
  74. data/spec/features/admin/promotions/option_value_rule_spec.rb +65 -0
  75. data/spec/features/admin/promotions/tiered_calculator_spec.rb +69 -0
  76. data/spec/features/admin/reports_spec.rb +61 -0
  77. data/spec/features/admin/stock_transfer_spec.rb +104 -0
  78. data/spec/features/admin/store_credits_spec.rb +82 -0
  79. data/spec/features/admin/taxons_spec.rb +31 -0
  80. data/spec/features/admin/users_spec.rb +275 -0
  81. data/spec/helpers/admin/base_helper_spec.rb +18 -0
  82. data/spec/helpers/admin/navigation_helper_spec.rb +73 -0
  83. data/spec/helpers/admin/reimbursements_helper_spec.rb +34 -0
  84. data/spec/helpers/admin/stock_movements_helper_spec.rb +29 -0
  85. data/spec/helpers/admin/store_credit_events_helper_spec.rb +95 -0
  86. data/spec/helpers/promotion_rules_helper_spec.rb +12 -0
  87. data/spec/spec_helper.rb +116 -0
  88. data/spec/support/appear_before_matcher.rb +8 -0
  89. data/spec/support/ror_ringer.jpeg +0 -0
  90. data/spec/test_views/spree/admin/widgets/edit.html.erb +1 -0
  91. data/spec/test_views/spree/admin/widgets/new.html.erb +1 -0
  92. metadata +96 -6
@@ -0,0 +1,185 @@
1
+ require 'spec_helper'
2
+
3
+ describe "New Order", :type => :feature do
4
+ let!(:product) { create(:product_in_stock) }
5
+ let!(:state) { create(:state) }
6
+ let!(:store) { create(:store) }
7
+ let!(:user) { create(:user, ship_address: create(:address), bill_address: create(:address)) }
8
+ let!(:payment_method) { create(:check_payment_method) }
9
+ let!(:shipping_method) { create(:shipping_method, cost: 0.0) }
10
+
11
+ stub_authorization!
12
+
13
+ before do
14
+ visit spree.admin_path
15
+ click_on "Orders"
16
+ click_on "New Order"
17
+ end
18
+
19
+ it "does check if you have a billing address before letting you add shipments" do
20
+ click_on "Shipments"
21
+ expect(page).to have_content 'Please fill in customer info'
22
+ expect(current_path).to eql(spree.edit_admin_order_customer_path(Spree::Order.last))
23
+ end
24
+
25
+ it "completes new order succesfully without using the cart", js: true do
26
+ click_on 'Cart'
27
+ select2_search product.name, from: Spree.t(:name_or_sku)
28
+
29
+ fill_in_quantity("table.stock-levels", "quantity_0", 2)
30
+
31
+ click_icon :plus
32
+ click_on "Customer Details"
33
+
34
+ within "#select-customer" do
35
+ targetted_select2_search user.email, from: "#s2id_customer_search"
36
+ end
37
+
38
+ check "order_use_billing"
39
+ fill_in_address
40
+ click_on "Update"
41
+
42
+ click_on "Payments"
43
+ click_on "Update"
44
+
45
+ expect(current_path).to eql(spree.admin_order_payments_path(Spree::Order.last))
46
+
47
+ click_on "Confirm"
48
+ click_on "Complete"
49
+
50
+ expect(current_path).to eql(spree.edit_admin_order_path(Spree::Order.last))
51
+
52
+ click_on "Payments"
53
+ click_icon "capture"
54
+
55
+ click_on "Shipments"
56
+ click_on "ship"
57
+
58
+ within '.carton-state' do
59
+ expect(page).to have_content('SHIPPED')
60
+ end
61
+ end
62
+
63
+ context "adding new item to the order", js: true do
64
+ it "inventory items show up just fine and are also registered as shipments" do
65
+ click_on 'Cart'
66
+ select2_search product.name, from: Spree.t(:name_or_sku)
67
+
68
+ fill_in_quantity('table.stock-levels', 'quantity_0', 2)
69
+
70
+ click_icon :plus
71
+
72
+ within(".line-items") do
73
+ expect(page).to have_content(product.name)
74
+ end
75
+
76
+ click_on "Customer Details"
77
+
78
+ within "#select-customer" do
79
+ targetted_select2_search user.email, from: "#s2id_customer_search"
80
+ end
81
+
82
+ check "order_use_billing"
83
+ fill_in_address
84
+ click_on "Update"
85
+
86
+ click_on "Shipments"
87
+
88
+ within(".stock-contents") do
89
+ expect(page).to have_content(product.name)
90
+ end
91
+ end
92
+ end
93
+
94
+ # Regression test for #3958
95
+ context "without a delivery step", js: true do
96
+ before do
97
+ allow(Spree::Order).to receive_messages checkout_step_names: [:address, :payment, :confirm, :complete]
98
+ end
99
+
100
+ it "can still see line items" do
101
+ click_on 'Cart'
102
+ select2_search product.name, from: Spree.t(:name_or_sku)
103
+
104
+ fill_in_quantity('table.stock-levels', 'quantity_0', 1)
105
+
106
+ click_icon :plus
107
+
108
+ within(".line-items") do
109
+ within(".line-item-name") do
110
+ expect(page).to have_content(product.name)
111
+ end
112
+ within(".line-item-qty-show") do
113
+ expect(page).to have_content("1")
114
+ end
115
+ within(".line-item-price") do
116
+ expect(page).to have_content(product.price)
117
+ end
118
+ end
119
+ end
120
+ end
121
+
122
+ # Regression test for #3336
123
+ context "start by customer address" do
124
+ it "completes order fine", js: true do
125
+ click_on "Customer Details"
126
+
127
+ within "#select-customer" do
128
+ targetted_select2_search user.email, from: "#s2id_customer_search"
129
+ end
130
+
131
+ check "order_use_billing"
132
+ fill_in_address
133
+ click_on "Update"
134
+
135
+ click_on "Shipments"
136
+
137
+ select2_search product.name, from: Spree.t(:name_or_sku)
138
+
139
+ click_icon :plus
140
+
141
+ expect(page).to have_css('.stock-item')
142
+
143
+ click_on "Payments"
144
+ click_on "Continue"
145
+
146
+ within(".additional-info .state") do
147
+ expect(page).to have_content("CONFIRM")
148
+ end
149
+ end
150
+ end
151
+
152
+ # Regression test for #5327
153
+ context "customer with default credit card", js: true do
154
+ before do
155
+ create(:credit_card, default: true, user: user)
156
+ end
157
+ it "transitions to delivery not to complete" do
158
+ click_on 'Cart'
159
+ select2_search product.name, from: Spree.t(:name_or_sku)
160
+ within("table.stock-levels") do
161
+ find('.variant_quantity').set(1)
162
+ end
163
+
164
+ click_icon :plus
165
+
166
+ expect(page).to have_css('.line-item')
167
+
168
+ click_link "Customer Details"
169
+ targetted_select2 user.email, from: "#s2id_customer_search"
170
+ click_button "Update"
171
+ expect(Spree::Order.last.state).to eq 'delivery'
172
+ end
173
+ end
174
+
175
+ def fill_in_address(kind = "bill")
176
+ fill_in "First Name", with: "John 99"
177
+ fill_in "Last Name", with: "Doe"
178
+ fill_in "Street Address", with: "100 first lane"
179
+ fill_in "Street Address (cont'd)", with: "#101"
180
+ fill_in "City", with: "Bethesda"
181
+ fill_in "Zip", with: "20170"
182
+ targetted_select2_search state.name, from: "#s2id_order_#{kind}_address_attributes_state_id"
183
+ fill_in "Phone", with: "123-456-7890"
184
+ end
185
+ end