solidus_backend 2.8.6 → 2.9.0.rc.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend/components/sortable_table.js +1 -0
- data/app/assets/javascripts/spree/backend/components/tabs.js +1 -0
- data/app/assets/javascripts/spree/backend/shipments.js +1 -0
- data/app/assets/javascripts/spree/backend/stock_management.js +9 -0
- data/app/assets/javascripts/spree/backend/templates/orders/line_item.hbs +1 -1
- data/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss +24 -16
- data/app/assets/stylesheets/spree/backend/components/_breadcrumb.scss +12 -0
- data/app/assets/stylesheets/spree/backend/components/_buttons.scss +18 -0
- data/app/assets/stylesheets/spree/backend/components/_image_placeholder.scss +2 -2
- data/app/assets/stylesheets/spree/backend/components/_list_group.scss +2 -2
- data/app/assets/stylesheets/spree/backend/components/_messages.scss +20 -12
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +46 -10
- data/app/assets/stylesheets/spree/backend/components/_progress.scss +3 -3
- data/app/assets/stylesheets/spree/backend/components/_sidebar.scss +1 -2
- data/app/assets/stylesheets/spree/backend/components/_tabs.scss +6 -5
- data/app/assets/stylesheets/spree/backend/globals/_deprecated_variables.scss +24 -0
- data/app/assets/stylesheets/spree/backend/globals/_deprecation.scss +10 -1
- data/app/assets/stylesheets/spree/backend/globals/_variables.scss +62 -39
- data/app/assets/stylesheets/spree/backend/globals/_variables_override.scss +1 -0
- data/app/assets/stylesheets/spree/backend/globals/mixins/_caret.scss +1 -1
- data/app/assets/stylesheets/spree/backend/globals/mixins/_line_through.scss +1 -1
- data/app/assets/stylesheets/spree/backend/sections/_log_entries.scss +8 -2
- data/app/assets/stylesheets/spree/backend/sections/_orders.scss +17 -6
- data/app/assets/stylesheets/spree/backend/sections/_products.scss +3 -1
- data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +5 -5
- data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +4 -4
- data/app/assets/stylesheets/spree/backend/sections/_taxonomies.scss +1 -1
- data/app/assets/stylesheets/spree/backend/shared/_fonts.scss +15 -0
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +27 -7
- data/app/assets/stylesheets/spree/backend/shared/_header.scss +3 -2
- data/app/assets/stylesheets/spree/backend/shared/_icons.scss +5 -1
- data/app/assets/stylesheets/spree/backend/shared/_layout.scss +5 -4
- data/app/assets/stylesheets/spree/backend/shared/_tables.scss +9 -4
- data/app/assets/stylesheets/spree/backend/shared/_typography.scss +10 -6
- data/app/assets/stylesheets/spree/backend/spree_admin.scss +3 -0
- data/app/controllers/spree/admin/customer_returns_controller.rb +8 -1
- data/app/controllers/spree/admin/log_entries_controller.rb +3 -0
- data/app/controllers/spree/admin/orders_controller.rb +0 -1
- data/app/controllers/spree/admin/users_controller.rb +4 -2
- data/app/helpers/spree/admin/base_helper.rb +9 -3
- data/app/helpers/spree/admin/promotions_helper.rb +15 -0
- data/app/views/spree/admin/images/index.html.erb +1 -1
- data/app/views/spree/admin/log_entries/index.html.erb +1 -19
- data/app/views/spree/admin/option_types/edit.html.erb +1 -1
- data/app/views/spree/admin/orders/_line_items_edit_form.html.erb +1 -1
- data/app/views/spree/admin/payments/_capture_events.html.erb +15 -18
- data/app/views/spree/admin/payments/_list.html.erb +1 -1
- data/app/views/spree/admin/payments/_log_entries.html.erb +29 -0
- data/app/views/spree/admin/payments/show.html.erb +13 -6
- data/app/views/spree/admin/payments/source_forms/{_storecredit.html.erb → _store_credit.html.erb} +0 -0
- data/app/views/spree/admin/payments/source_views/{_storecredit.html.erb → _store_credit.html.erb} +0 -0
- data/app/views/spree/admin/prices/_form.html.erb +1 -1
- data/app/views/spree/admin/products/_form.html.erb +16 -5
- data/app/views/spree/admin/products/edit.html.erb +1 -1
- data/app/views/spree/admin/promotions/_form.html.erb +2 -2
- data/app/views/spree/admin/promotions/index.html.erb +4 -4
- data/app/views/spree/admin/reimbursements/edit.html.erb +2 -2
- data/app/views/spree/admin/shared/_head.html.erb +0 -3
- data/app/views/spree/admin/shared/_modal.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +10 -10
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +1 -1
- data/app/views/spree/admin/store_credits/edit_validity.html.erb +1 -1
- data/app/views/spree/admin/store_credits/index.html.erb +1 -1
- data/app/views/spree/admin/store_credits/show.html.erb +1 -1
- data/app/views/spree/admin/stores/_form.html.erb +1 -0
- data/app/views/spree/admin/style_guide/topics/typography/_colors.html.erb +30 -20
- data/app/views/spree/admin/style_guide/topics/typography/_fonts.html.erb +1 -1
- data/app/views/spree/admin/taxonomies/edit.html.erb +1 -1
- data/app/views/spree/admin/taxons/_form.html.erb +1 -1
- data/app/views/spree/admin/taxons/edit.html.erb +2 -2
- data/app/views/spree/admin/users/edit.html.erb +2 -2
- data/app/views/spree/admin/users/index.html.erb +2 -2
- data/app/views/spree/admin/variants/_form.html.erb +1 -1
- data/app/views/spree/admin/zones/_state_members.html.erb +1 -1
- data/spec/controllers/spree/admin/locale_controller_spec.rb +45 -0
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +3 -3
- data/spec/controllers/spree/admin/orders_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +1 -1
- data/spec/features/admin/orders/adjustments_spec.rb +1 -1
- data/spec/features/admin/orders/customer_details_spec.rb +5 -7
- data/spec/features/admin/orders/customer_returns_spec.rb +28 -0
- data/spec/features/admin/orders/listing_spec.rb +1 -6
- data/spec/features/admin/orders/log_entries_spec.rb +2 -2
- data/spec/features/admin/orders/new_order_spec.rb +3 -3
- data/spec/features/admin/orders/order_details_spec.rb +8 -3
- data/spec/features/admin/orders/payments_spec.rb +80 -39
- data/spec/features/admin/products/edit/products_spec.rb +25 -0
- data/spec/features/admin/products/edit/taxons_spec.rb +2 -8
- data/spec/features/admin/products/pricing_spec.rb +24 -6
- data/spec/features/admin/products/products_spec.rb +4 -4
- data/spec/features/admin/products/variant_spec.rb +1 -1
- data/spec/features/admin/promotions/promotion_spec.rb +52 -0
- data/spec/features/admin/store_credits_spec.rb +3 -3
- data/spec/features/admin/users_spec.rb +22 -0
- data/spec/spec_helper.rb +1 -2
- data/spec/support/appear_before_matcher.rb +1 -1
- data/spec/teaspoon_env.rb +23 -8
- data/vendor/assets/fonts/inter/Inter-Regular.woff +0 -0
- data/vendor/assets/fonts/inter/Inter-Regular.woff2 +0 -0
- data/vendor/assets/fonts/inter/Inter-SemiBold.woff +0 -0
- data/vendor/assets/fonts/inter/Inter-SemiBold.woff2 +0 -0
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_pagination.scss +4 -0
- metadata +22 -10
- data/.eslintrc +0 -21
@@ -17,12 +17,12 @@ describe Spree::Admin::Orders::CustomerDetailsController, type: :controller do
|
|
17
17
|
let!(:checkout_zone) { create(:zone, name: "Checkout Zone", countries: [canada]) }
|
18
18
|
|
19
19
|
before do
|
20
|
-
|
20
|
+
stub_spree_preferences(checkout_zone: checkout_zone.name)
|
21
21
|
end
|
22
22
|
|
23
23
|
context "and default_country_iso of the Canada" do
|
24
24
|
before do
|
25
|
-
|
25
|
+
stub_spree_preferences(default_country_iso: Spree::Country.find_by!(iso: "CA").iso)
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'defaults the shipping address country to Canada' do
|
@@ -38,7 +38,7 @@ describe Spree::Admin::Orders::CustomerDetailsController, type: :controller do
|
|
38
38
|
|
39
39
|
context "and default_country_iso of the United States" do
|
40
40
|
before do
|
41
|
-
|
41
|
+
stub_spree_preferences(default_country_iso: Spree::Country.find_by!(iso: "US").iso)
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'defaults the shipping address country to nil' do
|
@@ -140,7 +140,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
context 'when order_bill_address_used is true' do
|
143
|
-
before {
|
143
|
+
before { stub_spree_preferences(order_bill_address_used: true) }
|
144
144
|
|
145
145
|
it "should redirect to the customer details page" do
|
146
146
|
get :edit, params: { id: order.number }
|
@@ -149,7 +149,7 @@ describe Spree::Admin::OrdersController, type: :controller do
|
|
149
149
|
end
|
150
150
|
|
151
151
|
context 'when order_bill_address_used is false' do
|
152
|
-
before {
|
152
|
+
before { stub_spree_preferences(order_bill_address_used: false) }
|
153
153
|
|
154
154
|
it "should redirect to the customer details page" do
|
155
155
|
get :edit, params: { id: order.number }
|
@@ -70,10 +70,10 @@ describe "Customer Details", type: :feature, js: true do
|
|
70
70
|
|
71
71
|
context "editing an order" do
|
72
72
|
before do
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
stub_spree_preferences(
|
74
|
+
default_country_iso: country.iso,
|
75
|
+
company: true
|
76
|
+
)
|
77
77
|
|
78
78
|
visit spree.admin_path
|
79
79
|
click_link "Orders"
|
@@ -153,9 +153,7 @@ describe "Customer Details", type: :feature, js: true do
|
|
153
153
|
|
154
154
|
before do
|
155
155
|
order.bill_address.country.destroy
|
156
|
-
|
157
|
-
config.default_country_iso = brazil.iso
|
158
|
-
end
|
156
|
+
stub_spree_preferences(default_country_iso: brazil.iso)
|
159
157
|
end
|
160
158
|
|
161
159
|
it "sets default country when displaying form" do
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe 'Customer returns', type: :feature do
|
6
|
+
stub_authorization!
|
7
|
+
|
8
|
+
context 'when the order has more than one line item' do
|
9
|
+
let(:order) { create :shipped_order, line_items_count: 2 }
|
10
|
+
|
11
|
+
context 'when creating a return with state "Received"' do
|
12
|
+
it 'marks the order as returned', :js do
|
13
|
+
visit spree.new_admin_order_customer_return_path(order)
|
14
|
+
|
15
|
+
find('#select-all').click
|
16
|
+
page.execute_script "$('select.add-item').val('receive')"
|
17
|
+
select 'NY Warehouse', from: 'Stock Location'
|
18
|
+
click_button 'Create'
|
19
|
+
|
20
|
+
expect(page).to have_content 'Customer Return has been successfully created'
|
21
|
+
|
22
|
+
within 'dd.order-state' do
|
23
|
+
expect(page).to have_content 'Returned'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -114,12 +114,7 @@ describe "Orders Listing", type: :feature, js: true do
|
|
114
114
|
|
115
115
|
context "when pagination is really short" do
|
116
116
|
before do
|
117
|
-
|
118
|
-
Spree::Config[:orders_per_page] = 1
|
119
|
-
end
|
120
|
-
|
121
|
-
after do
|
122
|
-
Spree::Config[:orders_per_page] = @old_per_page
|
117
|
+
stub_spree_preferences(orders_per_page: 1)
|
123
118
|
end
|
124
119
|
|
125
120
|
# Regression test for https://github.com/spree/spree/issues/4004
|
@@ -23,7 +23,7 @@ describe "Log entries", type: :feature do
|
|
23
23
|
it "shows a successful attempt" do
|
24
24
|
visit spree.admin_order_payments_path(payment.order)
|
25
25
|
click_on payment.number
|
26
|
-
|
26
|
+
|
27
27
|
within("#listing_log_entries") do
|
28
28
|
expect(page).to have_content("Transaction successful")
|
29
29
|
end
|
@@ -47,7 +47,7 @@ describe "Log entries", type: :feature do
|
|
47
47
|
it "shows a failed attempt" do
|
48
48
|
visit spree.admin_order_payments_path(payment.order)
|
49
49
|
click_on payment.number
|
50
|
-
|
50
|
+
|
51
51
|
within("#listing_log_entries") do
|
52
52
|
expect(page).to have_content("Transaction failed")
|
53
53
|
end
|
@@ -208,12 +208,12 @@ describe "New Order", type: :feature do
|
|
208
208
|
|
209
209
|
before do
|
210
210
|
Spree::Country.update_all(states_required: true)
|
211
|
-
|
211
|
+
stub_spree_preferences(checkout_zone: checkout_zone.name)
|
212
212
|
end
|
213
213
|
|
214
214
|
context 'and default_country_iso of the United States' do
|
215
215
|
before do
|
216
|
-
|
216
|
+
stub_spree_preferences(default_country_iso: Spree::Country.find_by!(iso: 'US').iso)
|
217
217
|
end
|
218
218
|
|
219
219
|
it 'the shipping address country select includes only options for Canada' do
|
@@ -267,7 +267,7 @@ describe "New Order", type: :feature do
|
|
267
267
|
|
268
268
|
context 'and default_country_iso of Canada' do
|
269
269
|
before do
|
270
|
-
|
270
|
+
stub_spree_preferences(default_country_iso: Spree::Country.find_by!(iso: 'CA').iso)
|
271
271
|
end
|
272
272
|
|
273
273
|
it 'defaults the shipping address country to Canada' do
|
@@ -191,9 +191,14 @@ describe "Order Details", type: :feature, js: true do
|
|
191
191
|
end
|
192
192
|
|
193
193
|
context 'splitting to location' do
|
194
|
-
|
195
|
-
|
196
|
-
|
194
|
+
it 'should warn you if you have not selected a location or shipment' do
|
195
|
+
visit spree.edit_admin_order_path(order)
|
196
|
+
|
197
|
+
within('tr', text: line_item.sku) { click_icon 'arrows-h' }
|
198
|
+
accept_alert 'Please select the split destination.' do
|
199
|
+
click_icon :ok
|
200
|
+
end
|
201
|
+
end
|
197
202
|
|
198
203
|
context 'there is enough stock at the other location' do
|
199
204
|
it 'should allow me to make a split' do
|
@@ -5,17 +5,24 @@ require 'spec_helper'
|
|
5
5
|
describe 'Payments', type: :feature do
|
6
6
|
stub_authorization!
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
let(:state) { 'checkout' }
|
9
|
+
|
10
|
+
def create_payment(opts = {})
|
11
|
+
create(
|
12
|
+
:payment,
|
13
|
+
{
|
14
|
+
order: order,
|
15
|
+
amount: order.outstanding_balance,
|
13
16
|
payment_method: create(:credit_card_payment_method),
|
14
|
-
state:
|
15
|
-
|
17
|
+
state: state
|
18
|
+
}.merge(opts)
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
context "with a pre-existing payment" do
|
23
|
+
let!(:payment) { create_payment }
|
16
24
|
|
17
25
|
let(:order) { create(:completed_order_with_totals, number: 'R100', line_items_price: 50) }
|
18
|
-
let(:state) { 'checkout' }
|
19
26
|
|
20
27
|
before do
|
21
28
|
visit "/admin/orders/#{order.number}/payments"
|
@@ -24,12 +31,7 @@ describe 'Payments', type: :feature do
|
|
24
31
|
# Regression tests for https://github.com/spree/spree/issues/1453
|
25
32
|
context 'with a check payment', js: true do
|
26
33
|
let(:order) { create(:completed_order_with_totals, number: 'R100') }
|
27
|
-
let!(:payment)
|
28
|
-
create(:payment,
|
29
|
-
order: order,
|
30
|
-
amount: order.outstanding_balance,
|
31
|
-
payment_method: create(:check_payment_method, available_to_admin: true)) # Check
|
32
|
-
end
|
34
|
+
let!(:payment) { create_payment(payment_method: create(:check_payment_method, available_to_admin: true)) }
|
33
35
|
|
34
36
|
it 'capturing a check payment from a new order' do
|
35
37
|
click_icon(:capture)
|
@@ -49,11 +51,9 @@ describe 'Payments', type: :feature do
|
|
49
51
|
|
50
52
|
visit spree.admin_order_payment_path(order, payment)
|
51
53
|
expect(page).to have_content 'Capture Events'
|
52
|
-
|
53
|
-
within_row(1) do
|
54
|
+
within '#capture_events' do
|
54
55
|
expect(page).to have_content(capture_amount / 100)
|
55
56
|
end
|
56
|
-
# end
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'displays the address for a credit card when present' do
|
@@ -62,6 +62,57 @@ describe 'Payments', type: :feature do
|
|
62
62
|
expect(page).to have_content 'my cc address'
|
63
63
|
end
|
64
64
|
|
65
|
+
context 'when there are multiple pending payments', :js do
|
66
|
+
context 'while marking all payments as void' do
|
67
|
+
let(:card_payment_method) { create(:credit_card_payment_method) }
|
68
|
+
|
69
|
+
let!(:payment) do
|
70
|
+
create_payment(
|
71
|
+
payment_method: card_payment_method,
|
72
|
+
state: :pending
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
let!(:second_payment) do
|
77
|
+
create_payment(
|
78
|
+
payment_method: card_payment_method,
|
79
|
+
state: :pending
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'updates the order payment state correctly at each iteration' do
|
84
|
+
visit current_path
|
85
|
+
expect(page).to have_css('#payment_status', text: 'Balance due')
|
86
|
+
|
87
|
+
within '#payments' do
|
88
|
+
expect(page).to have_selector('.pill-pending', count: 2)
|
89
|
+
within "#payment_#{payment.id}" do
|
90
|
+
find('.fa-void').click
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
expect(page).to have_css('#payment_status', text: 'Balance due')
|
95
|
+
|
96
|
+
within '#payments' do
|
97
|
+
expect(page).to have_selector('.pill-pending', count: 1)
|
98
|
+
within "#payment_#{payment.id}" do
|
99
|
+
expect(page).to have_selector('.pill-void', count: 1)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
within "#payment_#{second_payment.id}" do
|
104
|
+
find('.fa-void').click
|
105
|
+
end
|
106
|
+
|
107
|
+
within '#payments' do
|
108
|
+
expect(page).not_to have_selector('.pill-pending')
|
109
|
+
expect(page).to have_selector('.pill-void', count: 2)
|
110
|
+
end
|
111
|
+
expect(page).to have_css('#payment_status', text: 'Failed')
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
65
116
|
it 'lists, updates and creates payments for an order', js: true do
|
66
117
|
within_row(1) do
|
67
118
|
expect(column_text(3)).to eq('Credit Card')
|
@@ -70,7 +121,7 @@ describe 'Payments', type: :feature do
|
|
70
121
|
end
|
71
122
|
|
72
123
|
click_icon :void
|
73
|
-
expect(page).to have_css('#payment_status', text: '
|
124
|
+
expect(page).to have_css('#payment_status', text: 'Failed')
|
74
125
|
expect(page).to have_content('Payment Updated')
|
75
126
|
|
76
127
|
within_row(1) do
|
@@ -105,7 +156,7 @@ describe 'Payments', type: :feature do
|
|
105
156
|
within_row(1) do
|
106
157
|
click_icon(:edit)
|
107
158
|
fill_in('amount', with: '$1')
|
108
|
-
click_icon(:
|
159
|
+
click_icon(:ok)
|
109
160
|
expect(page).to have_selector('td.amount span', text: '$1.00')
|
110
161
|
expect(payment.reload.amount).to eq(1.00)
|
111
162
|
end
|
@@ -114,12 +165,7 @@ describe 'Payments', type: :feature do
|
|
114
165
|
it 'allows the amount change to be cancelled by clicking on the cancel button' do
|
115
166
|
within_row(1) do
|
116
167
|
click_icon(:edit)
|
117
|
-
|
118
|
-
# Can't use fill_in here, as under poltergeist that will unfocus (and
|
119
|
-
# thus submit) the field under poltergeist
|
120
|
-
find('td.amount input').click
|
121
|
-
page.execute_script("$('td.amount input').val('$1')")
|
122
|
-
|
168
|
+
fill_in 'amount', with: '$1'
|
123
169
|
click_icon(:cancel)
|
124
170
|
expect(page).to have_selector('td.amount span', text: '$150.00')
|
125
171
|
expect(payment.reload.amount).to eq(150.00)
|
@@ -130,7 +176,7 @@ describe 'Payments', type: :feature do
|
|
130
176
|
within_row(1) do
|
131
177
|
click_icon(:edit)
|
132
178
|
fill_in('amount', with: 'invalid')
|
133
|
-
click_icon(:
|
179
|
+
click_icon(:ok)
|
134
180
|
end
|
135
181
|
expect(page).to have_selector('.flash.error', text: 'Invalid resource. Please fix errors and try again.')
|
136
182
|
expect(payment.reload.amount).to eq(150.00)
|
@@ -159,9 +205,9 @@ describe 'Payments', type: :feature do
|
|
159
205
|
end
|
160
206
|
|
161
207
|
it "is able to create a new credit card payment with valid information", js: true do
|
162
|
-
|
208
|
+
fill_in_with_force "Card Number", with: "4111 1111 1111 1111"
|
163
209
|
fill_in "Name", with: "Test User"
|
164
|
-
|
210
|
+
fill_in_with_force "Expiration", with: "09 / #{Time.current.year + 1}"
|
165
211
|
fill_in "Card Code", with: "007"
|
166
212
|
# Regression test for https://github.com/spree/spree/issues/4277
|
167
213
|
expect(page).to have_css('.ccType[value="visa"]', visible: false)
|
@@ -182,7 +228,7 @@ describe 'Payments', type: :feature do
|
|
182
228
|
|
183
229
|
context "user existing card" do
|
184
230
|
let!(:cc) do
|
185
|
-
create(:credit_card, payment_method: payment_method, gateway_customer_profile_id: "BGS-RFRE")
|
231
|
+
create(:credit_card, payment_method: payment_method, gateway_customer_profile_id: "BGS-RFRE", user: order.user)
|
186
232
|
end
|
187
233
|
|
188
234
|
before do
|
@@ -216,12 +262,7 @@ describe 'Payments', type: :feature do
|
|
216
262
|
context 'with a soft-deleted payment method' do
|
217
263
|
let(:order) { create(:completed_order_with_totals, line_items_count: 1) }
|
218
264
|
let!(:payment_method) { create(:check_payment_method) }
|
219
|
-
let!(:payment)
|
220
|
-
create(:payment,
|
221
|
-
order: order,
|
222
|
-
amount: order.outstanding_balance,
|
223
|
-
payment_method: payment_method)
|
224
|
-
end
|
265
|
+
let!(:payment) { create_payment(payment_method: payment_method) }
|
225
266
|
|
226
267
|
before do
|
227
268
|
payment_method.discard
|
@@ -249,9 +290,9 @@ describe 'Payments', type: :feature do
|
|
249
290
|
|
250
291
|
it "is able to create a new payment", js: true do
|
251
292
|
choose payment_method.name
|
252
|
-
|
293
|
+
fill_in_with_force "Card Number", with: "4111 1111 1111 1111"
|
253
294
|
fill_in "Name", with: "Test User"
|
254
|
-
|
295
|
+
fill_in_with_force "Expiration", with: "09 / #{Time.current.year + 1}"
|
255
296
|
fill_in "Card Code", with: "007"
|
256
297
|
click_button "Continue"
|
257
298
|
expect(page).to have_content("Payment has been successfully created!")
|
@@ -278,9 +319,9 @@ describe 'Payments', type: :feature do
|
|
278
319
|
|
279
320
|
it "displays an error" do
|
280
321
|
choose payment_method.name
|
281
|
-
|
322
|
+
fill_in_with_force "Card Number", with: "4111 1111 1111 1111"
|
282
323
|
fill_in "Name", with: "Test User"
|
283
|
-
|
324
|
+
fill_in_with_force "Expiration", with: "09 / #{Time.current.year + 1}"
|
284
325
|
fill_in "Card Code", with: "007"
|
285
326
|
click_button "Continue"
|
286
327
|
expect(page).to have_content I18n.t('spree.insufficient_stock_for_order')
|
@@ -50,6 +50,31 @@ describe 'Product Details', type: :feature do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
context "when default price is deleted" do
|
54
|
+
it "does not show the master price", js: true do
|
55
|
+
product = create(:product, name: 'Bún thịt nướng', sku: 'A100',
|
56
|
+
description: 'lorem ipsum', available_on: '2013-08-14 01:02:03')
|
57
|
+
|
58
|
+
visit spree.admin_path
|
59
|
+
click_nav "Products"
|
60
|
+
within_row(1) { click_icon :edit }
|
61
|
+
|
62
|
+
click_link 'Prices'
|
63
|
+
|
64
|
+
within "#spree_price_#{product.master.default_price.id}" do
|
65
|
+
accept_alert do
|
66
|
+
click_icon :trash
|
67
|
+
end
|
68
|
+
end
|
69
|
+
expect(page).to have_content("Price has been successfully removed")
|
70
|
+
|
71
|
+
click_link 'Product Details'
|
72
|
+
|
73
|
+
expect(page).not_to have_field('product_price')
|
74
|
+
expect(page).to have_content('This Product has no price in the default currency (USD).')
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
53
78
|
# Regression test for https://github.com/spree/spree/issues/3385
|
54
79
|
context "deleting a product", js: true do
|
55
80
|
it "is still able to find the master variant" do
|
@@ -26,19 +26,13 @@ describe "Product Display Order", type: :feature do
|
|
26
26
|
visit spree.edit_admin_product_path(product)
|
27
27
|
|
28
28
|
assert_selected_taxons([taxon_1])
|
29
|
+
|
29
30
|
select2_search "Clothing", from: "Taxon"
|
30
31
|
assert_selected_taxons([taxon_1, taxon_2])
|
31
32
|
|
32
|
-
# Without this line we have a flaky spec probably due to select2 not
|
33
|
-
# closing its fixed overlay correctly. Clicking anywhere in the page
|
34
|
-
# before submit apparently solves the issue.
|
35
|
-
find('.edit_product', visible: true).click
|
36
|
-
|
37
33
|
click_button "Update"
|
38
34
|
|
39
|
-
|
40
|
-
expect(page).to have_content(%(Product "#{product.name}" has been successfully updated!))
|
41
|
-
end
|
35
|
+
expect(find(".flash")).to have_text "Product \"#{product.name}\" has been successfully updated!"
|
42
36
|
assert_selected_taxons([taxon_1, taxon_2])
|
43
37
|
end
|
44
38
|
|