spree_backend 3.2.1 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/spree/admin/products/_form.html.erb +8 -8
  3. data/spree_backend.gemspec +2 -2
  4. metadata +9 -100
  5. data/spec/controllers/spree/admin/base_controller_spec.rb +0 -46
  6. data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -185
  7. data/spec/controllers/spree/admin/general_settings_controller_spec.rb +0 -41
  8. data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
  9. data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -197
  10. data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -296
  11. data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -64
  12. data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -97
  13. data/spec/controllers/spree/admin/products_controller_spec.rb +0 -99
  14. data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -21
  15. data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -21
  16. data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -44
  17. data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -32
  18. data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -74
  19. data/spec/controllers/spree/admin/reports_controller_spec.rb +0 -42
  20. data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -252
  21. data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -225
  22. data/spec/controllers/spree/admin/return_index_controller_spec.rb +0 -37
  23. data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -27
  24. data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -14
  25. data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -19
  26. data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -41
  27. data/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +0 -41
  28. data/spec/controllers/spree/admin/tax_categories_controller_spec.rb +0 -34
  29. data/spec/controllers/spree/admin/users_controller_spec.rb +0 -161
  30. data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -32
  31. data/spec/features/admin/configuration/analytics_tracker_spec.rb +0 -47
  32. data/spec/features/admin/configuration/countries_spec.rb +0 -24
  33. data/spec/features/admin/configuration/general_settings_spec.rb +0 -44
  34. data/spec/features/admin/configuration/payment_methods_spec.rb +0 -63
  35. data/spec/features/admin/configuration/roles_spec.rb +0 -47
  36. data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -62
  37. data/spec/features/admin/configuration/states_spec.rb +0 -68
  38. data/spec/features/admin/configuration/stock_locations_spec.rb +0 -48
  39. data/spec/features/admin/configuration/store_credit_categories_spec.rb +0 -50
  40. data/spec/features/admin/configuration/tax_categories_spec.rb +0 -56
  41. data/spec/features/admin/configuration/tax_rates_spec.rb +0 -18
  42. data/spec/features/admin/configuration/zones_spec.rb +0 -39
  43. data/spec/features/admin/homepage_spec.rb +0 -89
  44. data/spec/features/admin/locale_spec.rb +0 -31
  45. data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -53
  46. data/spec/features/admin/orders/adjustments_spec.rb +0 -130
  47. data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -47
  48. data/spec/features/admin/orders/customer_details_spec.rb +0 -154
  49. data/spec/features/admin/orders/line_items_spec.rb +0 -51
  50. data/spec/features/admin/orders/listing_spec.rb +0 -224
  51. data/spec/features/admin/orders/log_entries_spec.rb +0 -55
  52. data/spec/features/admin/orders/new_order_spec.rb +0 -186
  53. data/spec/features/admin/orders/order_details_spec.rb +0 -662
  54. data/spec/features/admin/orders/payments_spec.rb +0 -231
  55. data/spec/features/admin/orders/risk_analysis_spec.rb +0 -48
  56. data/spec/features/admin/orders/shipments_spec.rb +0 -64
  57. data/spec/features/admin/orders/state_changes_spec.rb +0 -21
  58. data/spec/features/admin/products/edit/images_spec.rb +0 -86
  59. data/spec/features/admin/products/edit/products_spec.rb +0 -64
  60. data/spec/features/admin/products/edit/taxons_spec.rb +0 -41
  61. data/spec/features/admin/products/edit/variants_spec.rb +0 -56
  62. data/spec/features/admin/products/option_types_spec.rb +0 -114
  63. data/spec/features/admin/products/products_spec.rb +0 -445
  64. data/spec/features/admin/products/properties_spec.rb +0 -147
  65. data/spec/features/admin/products/prototypes_spec.rb +0 -112
  66. data/spec/features/admin/products/stock_management_spec.rb +0 -124
  67. data/spec/features/admin/products/taxonomies_spec.rb +0 -52
  68. data/spec/features/admin/products/variant_spec.rb +0 -50
  69. data/spec/features/admin/promotions/adjustments_spec.rb +0 -258
  70. data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -70
  71. data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -70
  72. data/spec/features/admin/refund_reasons/refund_reasons_spec.rb +0 -57
  73. data/spec/features/admin/reimbursement_type/edit_reimbursement_type_spec.rb +0 -36
  74. data/spec/features/admin/reimbursement_type/new_reimbursement_type_spec.rb +0 -62
  75. data/spec/features/admin/reports_spec.rb +0 -61
  76. data/spec/features/admin/return_authorization_reasons/return_authorization_reasons_spec.rb +0 -63
  77. data/spec/features/admin/returns/customer_returns_spec.rb +0 -80
  78. data/spec/features/admin/returns/return_authorizations_spec.rb +0 -152
  79. data/spec/features/admin/stock_transfer_spec.rb +0 -75
  80. data/spec/features/admin/store_credits_spec.rb +0 -93
  81. data/spec/features/admin/taxons_spec.rb +0 -47
  82. data/spec/features/admin/users_spec.rb +0 -286
  83. data/spec/helpers/admin/base_helper_spec.rb +0 -30
  84. data/spec/helpers/admin/navigation_helper_spec.rb +0 -111
  85. data/spec/helpers/admin/promotion_rules_helper_spec.rb +0 -12
  86. data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -30
  87. data/spec/models/spree/resource_spec.rb +0 -48
  88. data/spec/routing/admin_path_spec.rb +0 -22
  89. data/spec/spec_helper.rb +0 -144
  90. data/spec/support/appear_before_matcher.rb +0 -8
  91. data/spec/support/ror_ringer.jpeg +0 -0
  92. data/spec/test_views/spree/admin/submodule/posts/edit.html.erb +0 -1
  93. data/spec/test_views/spree/admin/submodule/posts/new.html.erb +0 -1
  94. data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
  95. data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
@@ -1,231 +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
- Spree::ShippingMethod.delete_all
54
- capture_amount = order.outstanding_balance/2 * 100
55
- payment.capture!(capture_amount)
56
-
57
- visit spree.admin_order_payment_path(order, payment)
58
- expect(page).to have_content 'Capture events'
59
- within '#capture_events' do
60
- within_row(1) do
61
- expect(page).to have_content(capture_amount / 100)
62
- end
63
- end
64
- end
65
-
66
- it 'lists and create payments for an order' do
67
- within_row(1) do
68
- expect(column_text(3)).to eq('$150.00')
69
- expect(column_text(4)).to eq('Credit Card')
70
- expect(column_text(6)).to eq('checkout')
71
- end
72
-
73
- click_icon :void
74
- expect(find('#payment_status').text).to eq('balance due')
75
- expect(page).to have_content('Payment Updated')
76
-
77
- within_row(1) do
78
- expect(column_text(3)).to eq('$150.00')
79
- expect(column_text(4)).to eq('Credit Card')
80
- expect(column_text(6)).to eq('void')
81
- end
82
-
83
- click_on 'New Payment'
84
- expect(page).to have_content('New Payment')
85
- click_button 'Update'
86
- expect(page).to have_content('successfully created!')
87
-
88
- click_icon(:capture)
89
- wait_for_ajax
90
- expect(find('#payment_status').text).to eq('paid')
91
-
92
- expect(page).not_to have_selector('#new_payment_section')
93
- end
94
-
95
- # Regression test for #1269
96
- it 'cannot create a payment for an order with no payment methods', js: false do
97
- Spree::PaymentMethod.delete_all
98
- order.payments.delete_all
99
-
100
- click_on 'New Payment'
101
- expect(page).to have_content('You cannot create a payment for an order without any payment methods defined.')
102
- expect(page).to have_content('Please define some payment methods first.')
103
- end
104
-
105
- %w[checkout pending].each do |state|
106
- context "payment is #{state.inspect}" do
107
- let(:state) { state }
108
-
109
- it 'allows the amount to be edited by clicking on the edit button then saving' do
110
- within_row(1) do
111
- click_icon(:edit)
112
- fill_in('amount', with: '$1')
113
- click_icon(:save)
114
- expect(page).to have_selector('td.amount span', text: '$1.00')
115
- expect(payment.reload.amount).to eq(1.00)
116
- end
117
- end
118
-
119
- it 'allows the amount to be edited by clicking on the amount then saving' do
120
- within_row(1) do
121
- find('td.amount span').click
122
- fill_in('amount', with: '$1.01')
123
- click_icon(:save)
124
- expect(page).to have_selector('td.amount span', text: '$1.01')
125
- expect(payment.reload.amount).to eq(1.01)
126
- end
127
- end
128
-
129
- it 'allows the amount change to be cancelled by clicking on the cancel button' do
130
- within_row(1) do
131
- click_icon(:edit)
132
-
133
- # Can't use fill_in here, as under poltergeist that will unfocus (and
134
- # thus submit) the field under poltergeist
135
- find('td.amount input').click
136
- page.execute_script("$('td.amount input').val('$1')")
137
-
138
- click_icon(:cancel)
139
- expect(page).to have_selector('td.amount span', text: '$150.00')
140
- expect(payment.reload.amount).to eq(150.00)
141
- end
142
- end
143
-
144
- it 'displays an error when the amount is invalid' do
145
- within_row(1) do
146
- click_icon(:edit)
147
- fill_in('amount', with: 'invalid')
148
- click_icon(:save)
149
- expect(find('td.amount input').value).to eq('invalid')
150
- expect(payment.reload.amount).to eq(150.00)
151
- end
152
- expect(page).to have_selector('.alert-error', text: 'Invalid resource. Please fix errors and try again.')
153
- end
154
- end
155
- end
156
-
157
- context 'payment is completed', js: false do
158
- let(:state) { 'completed' }
159
-
160
- it 'does not allow the amount to be edited' do
161
- within_row(1) do
162
- expect(page).not_to have_selector('.fa-edit')
163
- expect(page).not_to have_selector('td.amount span')
164
- end
165
- end
166
- end
167
- end
168
-
169
- context "with no prior payments" do
170
- let(:order) { create(:order_with_line_items, line_items_count: 1) }
171
- let!(:payment_method) { create(:credit_card_payment_method) }
172
-
173
- # Regression tests for #4129
174
- context "with a credit card payment method" do
175
- before do
176
- visit spree.admin_order_payments_path(order)
177
- end
178
-
179
- it "is able to create a new credit card payment with valid information" do
180
- fill_in "Card Number", with: "4111 1111 1111 1111"
181
- fill_in "Name", with: "Test User"
182
- fill_in "Expiration", with: "09 / #{Time.current.year + 1}"
183
- fill_in "Card Code", with: "007"
184
- # Regression test for #4277
185
- sleep(1)
186
- expect(find('.ccType', visible: false).value).to eq('visa')
187
- click_button "Continue"
188
- expect(page).to have_content("Payment has been successfully created!")
189
- end
190
-
191
- it "is unable to create a new payment with invalid information" do
192
- click_button "Continue"
193
- expect(page).to have_content("Payment could not be created.")
194
- expect(page).to have_content("Number can't be blank")
195
- expect(page).to have_content("Name can't be blank")
196
- expect(page).to have_content("Verification Value can't be blank")
197
- expect(page).to have_content("Month is not a number")
198
- expect(page).to have_content("Year is not a number")
199
- end
200
- end
201
-
202
- context "user existing card" do
203
- let!(:cc) do
204
- create(:credit_card, user_id: order.user_id, payment_method: payment_method, gateway_customer_profile_id: "BGS-RFRE")
205
- end
206
-
207
- before { visit spree.admin_order_payments_path(order) }
208
-
209
- it "is able to reuse customer payment source", js: false do
210
- expect(find("#card_#{cc.id}")).to be_checked
211
- click_button "Continue"
212
- expect(page).to have_content("Payment has been successfully created!")
213
- end
214
- end
215
-
216
- context "with a check" do
217
- let!(:payment_method) { create(:check_payment_method) }
218
-
219
- before do
220
- visit spree.admin_order_payments_path(order.reload)
221
- end
222
-
223
- it "can successfully be created and captured" do
224
- click_on 'Continue'
225
- expect(page).to have_content("Payment has been successfully created!")
226
- click_icon(:capture)
227
- expect(page).to have_content("Payment Updated")
228
- end
229
- end
230
- end
231
- 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
@@ -1,64 +0,0 @@
1
- # encoding: UTF-8
2
- require 'spec_helper'
3
-
4
- describe 'Product Details', type: :feature, js: true do
5
- stub_authorization!
6
-
7
- context 'editing a product' do
8
- it 'should list the product details' do
9
- create(:product, name: 'Bún thịt nướng', sku: 'A100',
10
- description: 'lorem ipsum', available_on: '2013-08-14 01:02:03')
11
-
12
- visit spree.admin_products_path
13
- within_row(1) { click_icon :edit }
14
-
15
- click_link 'Details'
16
-
17
- expect(find('.content-header h1').text.strip).to eq('Products / Bún thịt nướng')
18
- expect(find('input#product_name').value).to eq('Bún thịt nướng')
19
- expect(find('input#product_slug').value).to eq('bun-th-t-n-ng')
20
- expect(find('textarea#product_description').text.strip).to eq('lorem ipsum')
21
- expect(find('input#product_price').value).to eq('19.99')
22
- expect(find('input#product_cost_price').value).to eq('17.00')
23
- expect(find('input#product_available_on').value).to eq("2013/08/14")
24
- expect(find('input#product_sku').value).to eq('A100')
25
- end
26
-
27
- it "should handle slug changes" do
28
- create(:product, name: 'Bún thịt nướng', sku: 'A100',
29
- description: 'lorem ipsum', available_on: '2011-01-01 01:01:01')
30
-
31
- visit spree.admin_products_path
32
- within('table.table tbody tr:nth-child(1)') do
33
- click_icon(:edit)
34
- end
35
-
36
- fill_in "product_slug", with: 'random-slug-value'
37
- click_button "Update"
38
- expect(page).to have_content("successfully updated!")
39
-
40
- fill_in "product_slug", with: 'a'
41
- click_button "Update"
42
- within('#product_slug_field') { expect(page).to have_content("is too short") }
43
-
44
- fill_in "product_slug", with: 'another-random-slug-value'
45
- click_button "Update"
46
- expect(page).to have_content("successfully updated!")
47
- end
48
- end
49
-
50
- # Regression test for #3385
51
- context "deleting a product" do
52
- it "is still able to find the master variant" do
53
- create(:product)
54
-
55
- visit spree.admin_products_path
56
- within_row(1) do
57
- accept_alert do
58
- click_icon :delete
59
- end
60
- end
61
- wait_for_ajax
62
- end
63
- end
64
- end
@@ -1,41 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Product Taxons", type: :feature, js: true do
4
- stub_authorization!
5
-
6
- after do
7
- Capybara.ignore_hidden_elements = true
8
- end
9
-
10
- before do
11
- Capybara.ignore_hidden_elements = false
12
- end
13
-
14
- context "managing taxons" do
15
- def selected_taxons
16
- find("#product_taxon_ids").value.split(',').map(&:to_i).uniq
17
- end
18
-
19
- it "should allow an admin to manage taxons" do
20
- taxon_1 = create(:taxon)
21
- taxon_2 = create(:taxon, name: 'Clothing')
22
- product = create(:product)
23
- product.taxons << taxon_1
24
-
25
- visit spree.admin_products_path
26
- within_row(1) { click_icon :edit }
27
-
28
- expect(find(".select2-search-choice").text).to eq(taxon_1.name)
29
- expect(selected_taxons).to match_array([taxon_1.id])
30
-
31
- select2_search "Clothing", from: "Taxons"
32
- click_button "Update"
33
- expect(selected_taxons).to match_array([taxon_1.id, taxon_2.id])
34
-
35
- # Regression test for #2139
36
- sleep(1)
37
- expect(first(".select2-search-choice", text: taxon_1.name)).to be_present
38
- expect(first(".select2-search-choice", text: taxon_2.name)).to be_present
39
- end
40
- end
41
- end
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Product Variants", type: :feature, js: true do
4
- stub_authorization!
5
-
6
- let!(:product) { create(:product) }
7
-
8
- before(:each) do
9
- visit spree.admin_products_path
10
- end
11
-
12
- context "editing variant option types" do
13
- it "should allow an admin to create option types for a variant" do
14
- within_row(1) { click_icon :edit }
15
-
16
- within('#sidebar') { click_link "Variants" }
17
- expect(page).to have_content("To add variants, you must first define")
18
- end
19
-
20
- it "allows admin to create a variant if there are option types" do
21
- click_link "Products"
22
- click_link "Option Types"
23
- click_link "new_option_type_link"
24
- fill_in "option_type_name", with: "shirt colors"
25
- fill_in "option_type_presentation", with: "colors"
26
- click_button "Create"
27
- expect(page).to have_content("successfully created!")
28
-
29
- page.find('#option_type_option_values_attributes_0_name').set('color')
30
- page.find('#option_type_option_values_attributes_0_presentation').set('black')
31
- click_button "Update"
32
- expect(page).to have_content("successfully updated!")
33
-
34
- visit spree.admin_products_path
35
- within_row(1) { click_icon :edit }
36
-
37
- select2_search "shirt", from: "Option Types"
38
- click_button "Update"
39
- expect(page).to have_content("successfully updated!")
40
-
41
- within('#sidebar') { click_link "Variants" }
42
- click_link "New Variant"
43
-
44
- targetted_select2 "black", from: "#s2id_variant_option_value_ids"
45
- fill_in "variant_sku", with: "A100"
46
- click_button "Create"
47
- expect(page).to have_content("successfully created!")
48
-
49
- within(".table") do
50
- expect(page).to have_content("19.99")
51
- expect(page).to have_content("black")
52
- expect(page).to have_content("A100")
53
- end
54
- end
55
- end
56
- end