spree_backend 3.1.5 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/spree/admin/orders_controller.rb +1 -3
  3. data/app/controllers/spree/admin/products_controller.rb +1 -1
  4. data/app/views/spree/admin/products/_form.html.erb +8 -8
  5. data/app/views/spree/admin/products/index.html.erb +1 -1
  6. data/app/views/spree/admin/shared/_product_tabs.html.erb +4 -4
  7. data/app/views/spree/admin/taxons/edit.html.erb +1 -1
  8. data/spree_backend.gemspec +1 -1
  9. metadata +7 -98
  10. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -46
  11. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -185
  12. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
  13. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
  14. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -197
  15. data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -254
  16. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -49
  17. data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -97
  18. data/spec/controllers/spree/admin/products_controller_spec.rb +0 -99
  19. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
  20. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
  21. data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -44
  22. data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
  23. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -74
  24. data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -42
  25. data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -252
  26. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -225
  27. data/spec/controllers/spree/admin/return_index_controller_spec.rb +0 -37
  28. data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
  29. data/spec/controllers/spree/admin/root_controller_spec.rb +0 -35
  30. data/spec/controllers/spree/admin/search_controller_spec.rb +0 -56
  31. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
  32. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -19
  33. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
  34. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -41
  35. data/spec/controllers/spree/admin/tax_categories_controller_spec.rb +0 -34
  36. data/spec/controllers/spree/admin/users_controller_spec.rb +0 -161
  37. data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
  38. data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -47
  39. data/spec/features/admin/configuration/countries_spec.rb +0 -24
  40. data/spec/features/admin/configuration/general_settings_spec.rb +0 -44
  41. data/spec/features/admin/configuration/payment_methods_spec.rb +0 -63
  42. data/spec/features/admin/configuration/roles_spec.rb +0 -47
  43. data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -62
  44. data/spec/features/admin/configuration/states_spec.rb +0 -68
  45. data/spec/features/admin/configuration/stock_locations_spec.rb +0 -48
  46. data/spec/features/admin/configuration/store_credit_categories_spec.rb +0 -50
  47. data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
  48. data/spec/features/admin/configuration/tax_rates_spec.rb +0 -18
  49. data/spec/features/admin/configuration/zones_spec.rb +0 -39
  50. data/spec/features/admin/homepage_spec.rb +0 -89
  51. data/spec/features/admin/locale_spec.rb +0 -31
  52. data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
  53. data/spec/features/admin/orders/adjustments_spec.rb +0 -129
  54. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -47
  55. data/spec/features/admin/orders/customer_details_spec.rb +0 -154
  56. data/spec/features/admin/orders/line_items_spec.rb +0 -51
  57. data/spec/features/admin/orders/listing_spec.rb +0 -222
  58. data/spec/features/admin/orders/log_entries_spec.rb +0 -55
  59. data/spec/features/admin/orders/new_order_spec.rb +0 -160
  60. data/spec/features/admin/orders/order_details_spec.rb +0 -662
  61. data/spec/features/admin/orders/payments_spec.rb +0 -230
  62. data/spec/features/admin/orders/risk_analysis_spec.rb +0 -48
  63. data/spec/features/admin/orders/shipments_spec.rb +0 -64
  64. data/spec/features/admin/orders/state_changes_spec.rb +0 -21
  65. data/spec/features/admin/products/edit/images_spec.rb +0 -86
  66. data/spec/features/admin/products/edit/products_spec.rb +0 -64
  67. data/spec/features/admin/products/edit/taxons_spec.rb +0 -41
  68. data/spec/features/admin/products/edit/variants_spec.rb +0 -56
  69. data/spec/features/admin/products/option_types_spec.rb +0 -114
  70. data/spec/features/admin/products/products_spec.rb +0 -445
  71. data/spec/features/admin/products/properties_spec.rb +0 -147
  72. data/spec/features/admin/products/prototypes_spec.rb +0 -112
  73. data/spec/features/admin/products/stock_management_spec.rb +0 -124
  74. data/spec/features/admin/products/taxonomies_spec.rb +0 -52
  75. data/spec/features/admin/products/variant_spec.rb +0 -50
  76. data/spec/features/admin/promotions/adjustments_spec.rb +0 -259
  77. data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -70
  78. data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -70
  79. data/spec/features/admin/refund_reasons/refund_reasons_spec.rb +0 -57
  80. data/spec/features/admin/reports_spec.rb +0 -61
  81. data/spec/features/admin/return_authorization_reasons/return_authorization_reasons_spec.rb +0 -63
  82. data/spec/features/admin/returns/customer_returns_spec.rb +0 -80
  83. data/spec/features/admin/returns/return_authorizations_spec.rb +0 -152
  84. data/spec/features/admin/stock_transfer_spec.rb +0 -75
  85. data/spec/features/admin/store_credits_spec.rb +0 -93
  86. data/spec/features/admin/taxons_spec.rb +0 -47
  87. data/spec/features/admin/users_spec.rb +0 -286
  88. data/spec/helpers/admin/base_helper_spec.rb +0 -30
  89. data/spec/helpers/admin/navigation_helper_spec.rb +0 -106
  90. data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -30
  91. data/spec/helpers/promotion_rules_helper_spec.rb +0 -12
  92. data/spec/models/spree/resource_spec.rb +0 -48
  93. data/spec/routing/admin_path_spec.rb +0 -22
  94. data/spec/spec_helper.rb +0 -134
  95. data/spec/support/appear_before_matcher.rb +0 -8
  96. data/spec/support/ror_ringer.jpeg +0 -0
  97. data/spec/test_views/spree/admin/submodule/posts/edit.html.erb +0 -1
  98. data/spec/test_views/spree/admin/submodule/posts/new.html.erb +0 -1
  99. data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
  100. data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
@@ -1,230 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Payments', type: :feature, js: true do
4
- stub_authorization!
5
-
6
- context "with a pre-existing payment" do
7
-
8
- let!(:payment) do
9
- create(:payment,
10
- order: order,
11
- amount: order.outstanding_balance,
12
- payment_method: create(:credit_card_payment_method),
13
- state: state
14
- )
15
- end
16
-
17
- let(:order) { create(:completed_order_with_totals, number: 'R100', line_items_count: 5) }
18
- let(:state) { 'checkout' }
19
-
20
- before do
21
- visit spree.edit_admin_order_path(order)
22
- click_link 'Payments'
23
- end
24
-
25
- def refresh_page
26
- visit current_path
27
- end
28
-
29
- # Regression tests for #1453
30
- context 'with a check payment' do
31
- let(:order) { create(:completed_order_with_totals, number: 'R100') }
32
- let!(:payment) do
33
- create(:payment,
34
- order: order,
35
- amount: order.outstanding_balance,
36
- payment_method: create(:check_payment_method) # Check
37
- )
38
- end
39
-
40
- it 'capturing a check payment from a new order' do
41
- click_icon(:capture)
42
- expect(page).not_to have_content('Cannot perform requested operation')
43
- expect(page).to have_content('Payment Updated')
44
- end
45
-
46
- it 'voids a check payment from a new order' do
47
- click_icon(:void)
48
- expect(page).to have_content('Payment Updated')
49
- end
50
- end
51
-
52
- it 'should list all captures for a payment' do
53
- capture_amount = order.outstanding_balance/2 * 100
54
- payment.capture!(capture_amount)
55
-
56
- visit spree.admin_order_payment_path(order, payment)
57
- expect(page).to have_content 'Capture events'
58
- within '#capture_events' do
59
- within_row(1) do
60
- expect(page).to have_content(capture_amount / 100)
61
- end
62
- end
63
- end
64
-
65
- it 'lists and create payments for an order' do
66
- within_row(1) do
67
- expect(column_text(3)).to eq('$150.00')
68
- expect(column_text(4)).to eq('Credit Card')
69
- expect(column_text(6)).to eq('checkout')
70
- end
71
-
72
- click_icon :void
73
- expect(find('#payment_status').text).to eq('balance due')
74
- expect(page).to have_content('Payment Updated')
75
-
76
- within_row(1) do
77
- expect(column_text(3)).to eq('$150.00')
78
- expect(column_text(4)).to eq('Credit Card')
79
- expect(column_text(6)).to eq('void')
80
- end
81
-
82
- click_on 'New Payment'
83
- expect(page).to have_content('New Payment')
84
- click_button 'Update'
85
- expect(page).to have_content('successfully created!')
86
-
87
- click_icon(:capture)
88
- wait_for_ajax
89
- expect(find('#payment_status').text).to eq('paid')
90
-
91
- expect(page).not_to have_selector('#new_payment_section')
92
- end
93
-
94
- # Regression test for #1269
95
- it 'cannot create a payment for an order with no payment methods', js: false do
96
- Spree::PaymentMethod.delete_all
97
- order.payments.delete_all
98
-
99
- click_on 'New Payment'
100
- expect(page).to have_content('You cannot create a payment for an order without any payment methods defined.')
101
- expect(page).to have_content('Please define some payment methods first.')
102
- end
103
-
104
- %w[checkout pending].each do |state|
105
- context "payment is #{state.inspect}" do
106
- let(:state) { state }
107
-
108
- it 'allows the amount to be edited by clicking on the edit button then saving' do
109
- within_row(1) do
110
- click_icon(:edit)
111
- fill_in('amount', with: '$1')
112
- click_icon(:save)
113
- expect(page).to have_selector('td.amount span', text: '$1.00')
114
- expect(payment.reload.amount).to eq(1.00)
115
- end
116
- end
117
-
118
- it 'allows the amount to be edited by clicking on the amount then saving' do
119
- within_row(1) do
120
- find('td.amount span').click
121
- fill_in('amount', with: '$1.01')
122
- click_icon(:save)
123
- expect(page).to have_selector('td.amount span', text: '$1.01')
124
- expect(payment.reload.amount).to eq(1.01)
125
- end
126
- end
127
-
128
- it 'allows the amount change to be cancelled by clicking on the cancel button' do
129
- within_row(1) do
130
- click_icon(:edit)
131
-
132
- # Can't use fill_in here, as under poltergeist that will unfocus (and
133
- # thus submit) the field under poltergeist
134
- find('td.amount input').click
135
- page.execute_script("$('td.amount input').val('$1')")
136
-
137
- click_icon(:cancel)
138
- expect(page).to have_selector('td.amount span', text: '$150.00')
139
- expect(payment.reload.amount).to eq(150.00)
140
- end
141
- end
142
-
143
- it 'displays an error when the amount is invalid' do
144
- within_row(1) do
145
- click_icon(:edit)
146
- fill_in('amount', with: 'invalid')
147
- click_icon(:save)
148
- expect(find('td.amount input').value).to eq('invalid')
149
- expect(payment.reload.amount).to eq(150.00)
150
- end
151
- expect(page).to have_selector('.alert-error', text: 'Invalid resource. Please fix errors and try again.')
152
- end
153
- end
154
- end
155
-
156
- context 'payment is completed', js: false do
157
- let(:state) { 'completed' }
158
-
159
- it 'does not allow the amount to be edited' do
160
- within_row(1) do
161
- expect(page).not_to have_selector('.fa-edit')
162
- expect(page).not_to have_selector('td.amount span')
163
- end
164
- end
165
- end
166
- end
167
-
168
- context "with no prior payments" do
169
- let(:order) { create(:order_with_line_items, line_items_count: 1) }
170
- let!(:payment_method) { create(:credit_card_payment_method) }
171
-
172
- # Regression tests for #4129
173
- context "with a credit card payment method" do
174
- before do
175
- visit spree.admin_order_payments_path(order)
176
- end
177
-
178
- it "is able to create a new credit card payment with valid information" do
179
- fill_in "Card Number", with: "4111 1111 1111 1111"
180
- fill_in "Name", with: "Test User"
181
- fill_in "Expiration", with: "09 / #{Time.current.year + 1}"
182
- fill_in "Card Code", with: "007"
183
- # Regression test for #4277
184
- sleep(1)
185
- expect(find('.ccType', visible: false).value).to eq('visa')
186
- click_button "Continue"
187
- expect(page).to have_content("Payment has been successfully created!")
188
- end
189
-
190
- it "is unable to create a new payment with invalid information" do
191
- click_button "Continue"
192
- expect(page).to have_content("Payment could not be created.")
193
- expect(page).to have_content("Number can't be blank")
194
- expect(page).to have_content("Name can't be blank")
195
- expect(page).to have_content("Verification Value can't be blank")
196
- expect(page).to have_content("Month is not a number")
197
- expect(page).to have_content("Year is not a number")
198
- end
199
- end
200
-
201
- context "user existing card" do
202
- let!(:cc) do
203
- create(:credit_card, user_id: order.user_id, payment_method: payment_method, gateway_customer_profile_id: "BGS-RFRE")
204
- end
205
-
206
- before { visit spree.admin_order_payments_path(order) }
207
-
208
- it "is able to reuse customer payment source", js: false do
209
- expect(find("#card_#{cc.id}")).to be_checked
210
- click_button "Continue"
211
- expect(page).to have_content("Payment has been successfully created!")
212
- end
213
- end
214
-
215
- context "with a check" do
216
- let!(:payment_method) { create(:check_payment_method) }
217
-
218
- before do
219
- visit spree.admin_order_payments_path(order.reload)
220
- end
221
-
222
- it "can successfully be created and captured" do
223
- click_on 'Continue'
224
- expect(page).to have_content("Payment has been successfully created!")
225
- click_icon(:capture)
226
- expect(page).to have_content("Payment Updated")
227
- end
228
- end
229
- end
230
- end
@@ -1,48 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Order Risk Analysis', type: :feature do
4
- stub_authorization!
5
-
6
- let!(:order) do
7
- create(:completed_order_with_pending_payment)
8
- end
9
-
10
- def visit_order
11
- visit spree.admin_path
12
- click_link 'Orders'
13
- within_row(1) do
14
- click_link order.number
15
- end
16
- end
17
-
18
- context "the order is considered risky" do
19
- before do
20
- allow_any_instance_of(Spree::Admin::BaseController).to receive_messages :try_spree_current_user => create(:user)
21
-
22
- order.payments.first.update_column(:avs_response, 'X')
23
- order.considered_risky!
24
- visit_order
25
- end
26
-
27
- it "displays 'Risk Analysis' box" do
28
- expect(page).to have_content 'Risk Analysis'
29
- end
30
-
31
- it "can be approved" do
32
- click_button('Approve')
33
- expect(page).to have_content 'Approver'
34
- expect(page).to have_content 'Approved at'
35
- expect(page).to have_content 'Status: complete'
36
- end
37
- end
38
-
39
- context "the order is not considered risky" do
40
- before do
41
- visit_order
42
- end
43
-
44
- it "does not display 'Risk Analysis' box" do
45
- expect(page).to_not have_content 'Risk Analysis'
46
- end
47
- end
48
- end
@@ -1,64 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Shipments", type: :feature do
4
- stub_authorization!
5
-
6
- let!(:order) { create(:order_ready_to_ship, number: "R100", state: "complete", line_items_count: 5) }
7
-
8
- # Regression test for #4025
9
- context "a shipment without a shipping method" do
10
- before do
11
- order.shipments.each do |s|
12
- # Deleting the shipping rates causes there to be no shipping methods
13
- s.shipping_rates.delete_all
14
- end
15
- end
16
-
17
- it "can still be displayed" do
18
- expect { visit spree.edit_admin_order_path(order) }.not_to raise_error
19
- end
20
- end
21
-
22
- context "shipping an order", js: true do
23
- before(:each) do
24
- visit spree.admin_orders_path
25
- within_row(1) do
26
- click_link "R100"
27
- end
28
- end
29
-
30
- it "can ship a completed order" do
31
- click_on "Ship"
32
- wait_for_ajax
33
-
34
- expect(page).to have_content("shipped package")
35
- expect(order.reload.shipment_state).to eq("shipped")
36
- end
37
- end
38
-
39
- context "moving variants between shipments", js: true do
40
- let!(:la) { create(:stock_location, name: "LA") }
41
- before(:each) do
42
- visit spree.admin_orders_path
43
- within_row(1) do
44
- click_link "R100"
45
- end
46
- end
47
-
48
- it "can move a variant to a new and to an existing shipment" do
49
- expect(order.shipments.count).to eq(1)
50
-
51
- within_row(1) { click_icon :split }
52
- targetted_select2 'LA', from: '#s2id_item_stock_location'
53
- click_icon :save
54
- wait_for_ajax
55
- expect(page.find("#shipment_#{order.shipments.first.id}")).to be_present
56
-
57
- within_row(2) { click_icon :split }
58
- targetted_select2 "LA(#{order.reload.shipments.last.number})", from: '#s2id_item_stock_location'
59
- click_icon :save
60
- wait_for_ajax
61
- expect(page.find("#shipment_#{order.reload.shipments.last.id}")).to be_present
62
- end
63
- end
64
- end
@@ -1,21 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Order - State Changes", type: :feature do
4
- stub_authorization!
5
-
6
- let!(:order) { create(:order_with_line_items) }
7
-
8
- context "for completed order" do
9
- before do
10
- order.next!
11
- visit spree.admin_order_state_changes_path(order)
12
- end
13
- it 'are viewable' do
14
- within_row(1) do
15
- within('td:nth-child(1)') { expect(page).to have_content('Order') }
16
- within('td:nth-child(2)') { expect(page).to have_content('Cart') }
17
- within('td:nth-child(3)') { expect(page).to have_content('Address') }
18
- end
19
- end
20
- end
21
- end
@@ -1,86 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Product Images", type: :feature, js: true do
4
- stub_authorization!
5
-
6
- let(:file_path) { Rails.root + "../../spec/support/ror_ringer.jpeg" }
7
-
8
- before do
9
- # Ensure attachment style keys are symbolized before running all tests
10
- # Otherwise this would result in this error:
11
- # undefined method `processors' for \"48x48>\
12
- Spree::Image.attachment_definitions[:attachment][:styles].symbolize_keys!
13
- end
14
-
15
- context "uploading, editing, and deleting an image" do
16
- it "should allow an admin to upload and edit an image for a product" do
17
- Spree::Image.attachment_definitions[:attachment].delete :storage
18
-
19
- create(:product)
20
-
21
- visit spree.admin_products_path
22
- click_icon(:edit)
23
- click_link "Images"
24
- click_link "new_image_link"
25
- attach_file('image_attachment', file_path)
26
- click_button "Create"
27
- expect(page).to have_content("successfully created!")
28
-
29
- click_icon(:edit)
30
- fill_in "image_alt", with: "ruby on rails t-shirt"
31
- click_button "Update"
32
- expect(page).to have_content("successfully updated!")
33
- expect(page).to have_content("ruby on rails t-shirt")
34
-
35
- accept_alert do
36
- click_icon :delete
37
- end
38
- expect(page).not_to have_content("ruby on rails t-shirt")
39
- end
40
- end
41
-
42
- # Regression test for #2228
43
- it "should see variant images", js: false do
44
- variant = create(:variant)
45
- variant.images.create!(attachment: File.open(file_path))
46
- visit spree.admin_product_images_path(variant.product)
47
-
48
- expect(page).not_to have_content("No Images Found.")
49
- within("table.table") do
50
- expect(page).to have_content(variant.options_text)
51
-
52
- #ensure no duplicate images are displayed
53
- expect(page).to have_css("tbody tr", count: 1)
54
-
55
- #ensure variant header is displayed
56
- within("thead") do
57
- expect(page.body).to have_content("Variant")
58
- end
59
-
60
- #ensure variant header is displayed
61
- within("tbody") do
62
- expect(page).to have_content("Size: S")
63
- end
64
- end
65
- end
66
-
67
- it "should not see variant column when product has no variants", js: false do
68
- product = create(:product)
69
- product.images.create!(attachment: File.open(file_path))
70
- visit spree.admin_product_images_path(product)
71
-
72
- expect(page).not_to have_content("No Images Found.")
73
- within("table.table") do
74
- #ensure no duplicate images are displayed
75
- expect(page).to have_css("tbody tr", count: 1)
76
-
77
- #ensure variant header is not displayed
78
- within("thead") do
79
- expect(page).not_to have_content("Variant")
80
- end
81
-
82
- #ensure correct cell count
83
- expect(page).to have_css("thead th", count: 3)
84
- end
85
- end
86
- end