solidus_backend 2.9.5 → 2.10.2
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.js +1 -0
- data/app/assets/javascripts/spree/backend/components/admin_nav.js +24 -0
- data/app/assets/javascripts/spree/backend/components/tabs.js +1 -1
- data/app/assets/javascripts/spree/backend/models/order.js +9 -0
- data/app/assets/javascripts/spree/backend/orders/cart.js +6 -0
- data/app/assets/javascripts/spree/backend/shipments.js +0 -62
- data/app/assets/javascripts/spree/backend/templates/index.js +0 -1
- data/app/assets/javascripts/spree/backend/views/cart/empty_cart_button.js +29 -0
- data/app/assets/javascripts/spree/backend/views/cart/line_item_table.js +5 -0
- data/app/assets/javascripts/spree/backend/views/index.js +1 -0
- data/app/assets/javascripts/spree/backend/views/order/address.js +7 -5
- data/app/assets/stylesheets/spree/backend/_bootstrap_custom.scss +2 -0
- data/app/assets/stylesheets/spree/backend/components/_breadcrumb.scss +3 -3
- data/app/assets/stylesheets/spree/backend/components/_messages.scss +4 -0
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +182 -49
- data/app/assets/stylesheets/spree/backend/globals/{_mixins.css → _mixins.scss} +0 -0
- data/app/assets/stylesheets/spree/backend/globals/_variables.scss +2 -0
- data/app/assets/stylesheets/spree/backend/shared/_header.scss +5 -1
- data/app/assets/stylesheets/spree/backend/shared/_layout.scss +0 -9
- data/app/controllers/spree/admin/adjustments_controller.rb +1 -1
- data/app/controllers/spree/admin/base_controller.rb +1 -1
- data/app/controllers/spree/admin/orders_controller.rb +2 -2
- data/app/controllers/spree/admin/payment_methods_controller.rb +4 -4
- data/app/controllers/spree/admin/payments_controller.rb +2 -2
- data/app/controllers/spree/admin/product_properties_controller.rb +1 -1
- data/app/controllers/spree/admin/products_controller.rb +2 -2
- data/app/controllers/spree/admin/resource_controller.rb +13 -4
- data/app/controllers/spree/admin/style_guide_controller.rb +1 -1
- data/app/controllers/spree/admin/taxons/attachment_controller.rb +20 -0
- data/app/controllers/spree/admin/users_controller.rb +6 -2
- data/app/helpers/spree/admin/navigation_helper.rb +3 -2
- data/app/helpers/spree/promotion_rules_helper.rb +1 -1
- data/app/views/spree/admin/customer_returns/new.html.erb +1 -1
- 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 -0
- data/app/views/spree/admin/orders/edit.html.erb +3 -4
- data/app/views/spree/admin/payment_methods/new.html.erb +1 -1
- data/app/views/spree/admin/prices/_master_variant_table.html.erb +41 -41
- data/app/views/spree/admin/promotion_code_batches/new.html.erb +1 -1
- data/app/views/spree/admin/promotion_codes/new.html.erb +1 -1
- data/app/views/spree/admin/promotions/_actions.html.erb +1 -0
- data/app/views/spree/admin/promotions/index.html.erb +1 -1
- data/app/views/spree/admin/return_authorizations/new.html.erb +1 -1
- data/app/views/spree/admin/shared/_calculator_fields.html.erb +5 -0
- data/app/views/spree/admin/shared/_navigation.html.erb +3 -0
- data/app/views/spree/admin/shared/_new_resource_links.html.erb +1 -1
- data/app/views/spree/admin/shared/_order_submenu.html.erb +2 -2
- data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/index.html.erb +1 -1
- data/app/views/spree/admin/store_credit_reasons/index.html.erb +1 -1
- data/app/views/spree/admin/store_credits/index.html.erb +1 -1
- data/app/views/spree/admin/tax_rates/_form.html.erb +1 -1
- data/app/views/spree/admin/taxonomies/new.html.erb +1 -1
- data/app/views/spree/admin/taxons/_form.html.erb +1 -5
- data/app/views/spree/admin/taxons/attachment_forms/_paperclip.html.erb +16 -0
- data/app/views/spree/admin/users/_form.html.erb +12 -10
- data/app/views/spree/admin/users/_tabs.html.erb +1 -1
- data/app/views/spree/admin/users/edit.html.erb +1 -2
- data/app/views/spree/layouts/admin.html.erb +1 -2
- data/config/routes.rb +4 -6
- data/lib/spree/backend.rb +1 -0
- data/lib/spree/backend/config.rb +9 -0
- data/lib/spree/backend/engine.rb +5 -3
- data/{app/models → lib}/spree/backend_configuration.rb +5 -2
- data/solidus_backend.gemspec +2 -1
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +2 -2
- data/spec/controllers/spree/admin/resource_controller_spec.rb +12 -1
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +1 -1
- data/spec/controllers/spree/admin/users_controller_spec.rb +23 -0
- data/spec/features/admin/configuration/payment_methods_spec.rb +11 -2
- data/spec/features/admin/configuration/shipping_methods_spec.rb +13 -1
- data/spec/features/admin/configuration/taxonomies_spec.rb +7 -0
- data/spec/features/admin/orders/customer_details_spec.rb +1 -2
- data/spec/features/admin/orders/customer_returns_spec.rb +20 -7
- data/spec/features/admin/orders/new_order_spec.rb +53 -5
- data/spec/features/admin/orders/new_refund_spec.rb +1 -1
- data/spec/features/admin/orders/order_details_spec.rb +14 -4
- data/spec/features/admin/orders/return_authorizations_spec.rb +38 -9
- data/spec/features/admin/products/edit/images_spec.rb +1 -1
- data/spec/features/admin/products/edit/taxons_spec.rb +8 -2
- data/spec/features/admin/products/products_spec.rb +12 -0
- data/spec/features/admin/promotion_adjustments_spec.rb +9 -0
- data/spec/features/admin/promotions/promotion_code_batches_spec.rb +37 -0
- data/spec/features/admin/promotions/promotion_code_spec.rb +31 -0
- data/spec/features/admin/taxons_spec.rb +12 -0
- data/spec/features/admin/users_spec.rb +18 -8
- data/spec/{support → fixtures/files}/ror_ringer.jpeg +0 -0
- data/spec/{models → lib}/spree/backend_configuration/menu_item_spec.rb +0 -0
- data/spec/{models → lib}/spree/backend_configuration_spec.rb +0 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/feature/base_feature_helper.rb +6 -1
- data/spec/teaspoon_env.rb +8 -23
- data/vendor/assets/stylesheets/solidus_admin/bootstrap/_variables.scss +1 -1
- metadata +33 -14
- data/app/assets/javascripts/spree/backend/templates/variants/autocomplete_stock.hbs +0 -56
- data/app/views/spree/admin/orders/_add_product.html.erb +0 -12
@@ -38,6 +38,13 @@ describe "Taxonomies", type: :feature do
|
|
38
38
|
click_button "Create"
|
39
39
|
expect(page).to have_content("can't be blank")
|
40
40
|
end
|
41
|
+
|
42
|
+
it "disables the button at submit", :js do
|
43
|
+
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
|
44
|
+
fill_in "taxonomy_name", with: "sports"
|
45
|
+
click_button "Create"
|
46
|
+
expect(page).to have_button("Create", disabled: true)
|
47
|
+
end
|
41
48
|
end
|
42
49
|
|
43
50
|
context "edit" do
|
@@ -117,7 +117,7 @@ describe "Customer Details", type: :feature, js: true do
|
|
117
117
|
end
|
118
118
|
|
119
119
|
it "should show validation errors" do
|
120
|
-
order.
|
120
|
+
order.update!(ship_address_id: nil)
|
121
121
|
click_link "Customer"
|
122
122
|
click_button "Update"
|
123
123
|
expect(page).to have_content("Shipping address first name can't be blank")
|
@@ -157,7 +157,6 @@ describe "Customer Details", type: :feature, js: true do
|
|
157
157
|
end
|
158
158
|
|
159
159
|
it "sets default country when displaying form" do
|
160
|
-
click_link "Cart"
|
161
160
|
click_link "Customer"
|
162
161
|
expect(page).to have_field("order_bill_address_attributes_country_id", with: brazil.id, visible: false)
|
163
162
|
end
|
@@ -8,21 +8,34 @@ describe 'Customer returns', type: :feature do
|
|
8
8
|
context 'when the order has more than one line item' do
|
9
9
|
let(:order) { create :shipped_order, line_items_count: 2 }
|
10
10
|
|
11
|
+
def create_customer_return
|
12
|
+
find('#select-all').click
|
13
|
+
page.execute_script "$('select.add-item').val('receive')"
|
14
|
+
select 'NY Warehouse', from: 'Stock Location'
|
15
|
+
click_button 'Create'
|
16
|
+
end
|
17
|
+
|
18
|
+
before do
|
19
|
+
visit spree.new_admin_order_customer_return_path(order)
|
20
|
+
end
|
21
|
+
|
11
22
|
context 'when creating a return with state "Received"' do
|
12
23
|
it 'marks the order as returned', :js do
|
13
|
-
|
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'
|
24
|
+
create_customer_return
|
19
25
|
|
20
26
|
expect(page).to have_content 'Customer Return has been successfully created'
|
21
|
-
|
22
27
|
within 'dd.order-state' do
|
23
28
|
expect(page).to have_content 'Returned'
|
24
29
|
end
|
25
30
|
end
|
26
31
|
end
|
32
|
+
|
33
|
+
it 'disables the button at submit', :js do
|
34
|
+
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
|
35
|
+
|
36
|
+
create_customer_return
|
37
|
+
|
38
|
+
expect(page).to have_button("Create", disabled: true)
|
39
|
+
end
|
27
40
|
end
|
28
41
|
end
|
@@ -154,14 +154,14 @@ describe "New Order", type: :feature do
|
|
154
154
|
click_on "Update"
|
155
155
|
|
156
156
|
# Automatically redirected to Shipments page
|
157
|
-
|
158
|
-
|
159
|
-
|
157
|
+
within '.no-objects-found' do
|
158
|
+
click_on "Cart"
|
159
|
+
end
|
160
160
|
|
161
|
-
|
161
|
+
add_line_item product.name
|
162
162
|
|
163
163
|
click_on "Payments"
|
164
|
-
click_on "
|
164
|
+
click_on "Update"
|
165
165
|
|
166
166
|
within(".additional-info") do
|
167
167
|
expect(page).to have_content("Confirm")
|
@@ -169,6 +169,54 @@ describe "New Order", type: :feature do
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
+
context "when changing customer", :js do
|
173
|
+
let!(:other_user) { create :user, bill_address: bill_address }
|
174
|
+
|
175
|
+
context "when one customer address have only textual state" do
|
176
|
+
let(:country) { create :country, iso: "IT" }
|
177
|
+
let(:bill_address) { create :address, country: country, state: nil, state_name: "Veneto" }
|
178
|
+
|
179
|
+
it "changes the bill address state accordingly" do
|
180
|
+
click_on "Customer"
|
181
|
+
|
182
|
+
within "#select-customer" do
|
183
|
+
targetted_select2_search user.email, from: "#s2id_customer_search"
|
184
|
+
end
|
185
|
+
|
186
|
+
expect(find("select#order_bill_address_attributes_state_id").value).to eq user.bill_address.state_id.to_s
|
187
|
+
|
188
|
+
within "#select-customer" do
|
189
|
+
targetted_select2_search other_user.email, from: "#s2id_customer_search"
|
190
|
+
end
|
191
|
+
|
192
|
+
expect(find("select#order_bill_address_attributes_state_id", visible: false).value).to eq ""
|
193
|
+
expect(find("#order_bill_address_attributes_state_name").value).to eq other_user.bill_address.state_name
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
context "when customers have same country but different state" do
|
198
|
+
let(:different_state) { Spree::State.where.not(id: user.bill_address.state_id).first }
|
199
|
+
|
200
|
+
let(:bill_address) { create :address, country: user.bill_address.country, state: different_state }
|
201
|
+
|
202
|
+
it "changes the bill address state accordingly" do
|
203
|
+
click_on "Customer"
|
204
|
+
|
205
|
+
within "#select-customer" do
|
206
|
+
targetted_select2_search user.email, from: "#s2id_customer_search"
|
207
|
+
end
|
208
|
+
|
209
|
+
expect(find('#order_bill_address_attributes_state_id').value).to eq user.bill_address.state_id.to_s
|
210
|
+
|
211
|
+
within "#select-customer" do
|
212
|
+
targetted_select2_search other_user.email, from: "#s2id_customer_search"
|
213
|
+
end
|
214
|
+
|
215
|
+
expect(find('#order_bill_address_attributes_state_id').value).to eq other_user.bill_address.state_id.to_s
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
172
220
|
# Regression test for https://github.com/spree/spree/issues/5327
|
173
221
|
context "customer with default credit card", js: true do
|
174
222
|
let!(:credit_card) { create(:credit_card, user: user) }
|
@@ -29,7 +29,7 @@ RSpec.describe 'New Refund creation', :js do
|
|
29
29
|
fill_in 'refund_amount', with: amount
|
30
30
|
select reason.name, from: 'Reason'
|
31
31
|
click_button 'Refund'
|
32
|
-
expect(
|
32
|
+
expect(page).to have_button('Refund', disabled: true)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -76,6 +76,19 @@ describe "Order Details", type: :feature, js: true do
|
|
76
76
|
expect(page).to have_field('quantity')
|
77
77
|
end
|
78
78
|
|
79
|
+
it "can remove all items with empty cart" do
|
80
|
+
expect(page).to have_content("spree t-shirt")
|
81
|
+
|
82
|
+
accept_confirm "Are you sure you want to delete this record?" do
|
83
|
+
click_on 'Empty Cart'
|
84
|
+
end
|
85
|
+
|
86
|
+
expect(page).not_to have_content("spree t-shirt")
|
87
|
+
|
88
|
+
# Should have a new item row
|
89
|
+
expect(page).to have_field('quantity')
|
90
|
+
end
|
91
|
+
|
79
92
|
# Regression test for https://github.com/spree/spree/issues/3862
|
80
93
|
it "can cancel removing an item from a shipment" do
|
81
94
|
expect(page).to have_content("spree t-shirt")
|
@@ -278,8 +291,7 @@ describe "Order Details", type: :feature, js: true do
|
|
278
291
|
|
279
292
|
context 'A shipment has shipped' do
|
280
293
|
it 'should not show or let me back to the cart page, nor show the shipment edit buttons' do
|
281
|
-
order = create(:
|
282
|
-
order.shipments.create!(stock_location_id: stock_location.id, state: 'shipped')
|
294
|
+
order = create(:shipped_order, state: 'payment', stock_location: stock_location)
|
283
295
|
|
284
296
|
visit spree.cart_admin_order_path(order)
|
285
297
|
|
@@ -525,8 +537,6 @@ describe "Order Details", type: :feature, js: true do
|
|
525
537
|
expect(page).not_to have_css('.delete-item')
|
526
538
|
expect(page).not_to have_css('.split-item')
|
527
539
|
expect(page).not_to have_css('.edit-tracking')
|
528
|
-
|
529
|
-
expect(page).not_to have_css('#add-line-item')
|
530
540
|
end
|
531
541
|
end
|
532
542
|
|
@@ -8,20 +8,49 @@ describe "ReturnAuthorizations", type: :feature do
|
|
8
8
|
stub_authorization!
|
9
9
|
|
10
10
|
let!(:order) { create(:shipped_order) }
|
11
|
-
let!(:return_authorization) { create(:return_authorization, order: order) }
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
describe "create" do
|
13
|
+
def create_return_authorization
|
14
|
+
find("#select-all").click
|
15
|
+
select "NY Warehouse", from: "Stock Location"
|
16
|
+
click_button "Create"
|
17
|
+
end
|
18
|
+
|
19
|
+
before do
|
20
|
+
visit spree.new_admin_order_return_authorization_path(order)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "creates a return authorization" do
|
24
|
+
create_return_authorization
|
25
|
+
|
26
|
+
expect(page).to have_content "Return Authorization has been successfully created!"
|
27
|
+
end
|
28
|
+
|
29
|
+
it "disables the button at submit", :js do
|
30
|
+
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
|
31
|
+
|
32
|
+
create_return_authorization
|
33
|
+
|
34
|
+
expect(page).to have_button("Create", disabled: true)
|
35
|
+
end
|
15
36
|
end
|
16
37
|
|
17
|
-
describe "
|
18
|
-
|
19
|
-
|
38
|
+
describe "when a return authorization exists" do
|
39
|
+
let!(:return_authorization) { create(:return_authorization, order: order) }
|
40
|
+
|
41
|
+
it "can visit the return authorizations list page" do
|
42
|
+
visit spree.admin_order_return_authorizations_path(order)
|
20
43
|
end
|
21
44
|
|
22
|
-
|
23
|
-
visit
|
24
|
-
|
45
|
+
describe "edit" do
|
46
|
+
it "can visit the return authorizations edit page" do
|
47
|
+
visit spree.edit_admin_order_return_authorization_path(order, return_authorization)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "return authorizations edit page has a data hook for extensions to add content above, below or within the RA form" do
|
51
|
+
visit spree.edit_admin_order_return_authorization_path(order, return_authorization)
|
52
|
+
expect(page).to have_selector("[data-hook=return-authorization-form-wrapper]")
|
53
|
+
end
|
25
54
|
end
|
26
55
|
end
|
27
56
|
end
|
@@ -5,7 +5,7 @@ require 'spec_helper'
|
|
5
5
|
describe "Product Images", type: :feature do
|
6
6
|
stub_authorization!
|
7
7
|
|
8
|
-
let(:file_path) {
|
8
|
+
let(:file_path) { file_fixture("ror_ringer.jpeg") }
|
9
9
|
let(:product) { create(:product) }
|
10
10
|
|
11
11
|
before do
|
@@ -26,13 +26,19 @@ 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
|
-
|
30
29
|
select2_search "Clothing", from: "Taxon"
|
31
30
|
assert_selected_taxons([taxon_1, taxon_2])
|
32
31
|
|
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, obscured: false).click
|
36
|
+
|
33
37
|
click_button "Update"
|
34
38
|
|
35
|
-
|
39
|
+
within('.flash') do
|
40
|
+
expect(page).to have_content(%(Product "#{product.name}" has been successfully updated!))
|
41
|
+
end
|
36
42
|
assert_selected_taxons([taxon_1, taxon_2])
|
37
43
|
end
|
38
44
|
|
@@ -172,6 +172,18 @@ describe "Products", type: :feature do
|
|
172
172
|
expect(page).to have_content("successfully updated!")
|
173
173
|
end
|
174
174
|
|
175
|
+
it "disables the button at submit", :js do
|
176
|
+
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
|
177
|
+
fill_in "product_name", with: "Baseball Cap"
|
178
|
+
fill_in "product_sku", with: "B100"
|
179
|
+
fill_in "product_price", with: "100"
|
180
|
+
fill_in "product_available_on", with: "2012/01/24"
|
181
|
+
select @shipping_category.name, from: "product_shipping_category_id"
|
182
|
+
click_button "Create"
|
183
|
+
|
184
|
+
expect(page).to have_button("Create", disabled: true)
|
185
|
+
end
|
186
|
+
|
175
187
|
it "should show validation errors", js: false do
|
176
188
|
fill_in "product_name", with: "Baseball Cap"
|
177
189
|
fill_in "product_sku", with: "B100"
|
@@ -167,6 +167,15 @@ describe "Promotion Adjustments", type: :feature, js: true do
|
|
167
167
|
expect(promotion.actions.first).to be_a(Spree::Promotion::Actions::FreeShipping)
|
168
168
|
end
|
169
169
|
|
170
|
+
it "disables the button at submit", :js do
|
171
|
+
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
|
172
|
+
fill_in "Name", with: "SAVE SAVE SAVE"
|
173
|
+
choose "Apply to all orders"
|
174
|
+
click_button "Create"
|
175
|
+
|
176
|
+
expect(page).to have_button("Create", disabled: true)
|
177
|
+
end
|
178
|
+
|
170
179
|
it "should allow an admin to create an automatic promotion" do
|
171
180
|
fill_in "Name", with: "SAVE SAVE SAVE"
|
172
181
|
choose "Apply to all orders"
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
feature "Promotion Code Batches", partial_double_verification: false do
|
6
|
+
stub_authorization!
|
7
|
+
|
8
|
+
describe "create" do
|
9
|
+
let(:promotion) { create :promotion }
|
10
|
+
|
11
|
+
before do
|
12
|
+
user = double.as_null_object
|
13
|
+
allow_any_instance_of(ActionView::Base).to receive(:spree_current_user) { user }
|
14
|
+
visit spree.new_admin_promotion_promotion_code_batch_path(promotion)
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_code_batch
|
18
|
+
fill_in "Base code", with: "base"
|
19
|
+
fill_in "Number of codes", with: 3
|
20
|
+
click_button "Create"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "creates a new promotion code batch and disables the submit button", :js do
|
24
|
+
create_code_batch
|
25
|
+
|
26
|
+
expect(page).to have_content "Promotion Code Batch has been successfully created!"
|
27
|
+
|
28
|
+
visit spree.new_admin_promotion_promotion_code_batch_path(promotion)
|
29
|
+
|
30
|
+
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
|
31
|
+
|
32
|
+
create_code_batch
|
33
|
+
|
34
|
+
expect(page).to have_button("Create", disabled: true)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
feature "Promotion Codes" do
|
6
|
+
stub_authorization!
|
7
|
+
|
8
|
+
describe "create" do
|
9
|
+
let(:promotion) { create :promotion }
|
10
|
+
|
11
|
+
before do
|
12
|
+
visit spree.new_admin_promotion_promotion_code_path(promotion)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "creates a new promotion code" do
|
16
|
+
fill_in "Value", with: "XYZ"
|
17
|
+
click_button "Create"
|
18
|
+
|
19
|
+
expect(page).to have_content "Promotion Code has been successfully created!"
|
20
|
+
end
|
21
|
+
|
22
|
+
it "disables the button at submit", :js do
|
23
|
+
page.execute_script "$('form').submit(function(e) { e.preventDefault()})"
|
24
|
+
|
25
|
+
fill_in "Value", with: "XYZ"
|
26
|
+
click_button "Create"
|
27
|
+
|
28
|
+
expect(page).to have_button("Create", disabled: true)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -75,4 +75,16 @@ describe "Taxonomies and taxons", type: :feature do
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
78
|
+
|
79
|
+
scenario "Removes attachments from taxon" do
|
80
|
+
taxon = create(:taxon)
|
81
|
+
taxon.update(icon: File.new(file_fixture('ror_ringer.jpeg')))
|
82
|
+
|
83
|
+
visit spree.edit_admin_taxonomy_taxon_path(taxon.taxonomy, taxon.id)
|
84
|
+
within('#taxon_icon_field') do
|
85
|
+
click_on 'Remove'
|
86
|
+
end
|
87
|
+
|
88
|
+
expect(page).to have_content("Icon has been successfully removed!")
|
89
|
+
end
|
78
90
|
end
|
@@ -158,14 +158,6 @@ describe 'Users', type: :feature do
|
|
158
158
|
expect(page).to have_field('user_email', with: 'a@example.com99')
|
159
159
|
end
|
160
160
|
|
161
|
-
it 'can edit the user password' do
|
162
|
-
fill_in 'user_password', with: 'welcome'
|
163
|
-
fill_in 'user_password_confirmation', with: 'welcome'
|
164
|
-
click_button 'Update'
|
165
|
-
|
166
|
-
expect(page).to have_text 'Account updated'
|
167
|
-
end
|
168
|
-
|
169
161
|
it 'can edit user roles' do
|
170
162
|
click_link 'Account'
|
171
163
|
|
@@ -213,6 +205,24 @@ describe 'Users', type: :feature do
|
|
213
205
|
expect(user_a.reload.bill_address.address1).to eq "1313 Mockingbird Ln"
|
214
206
|
end
|
215
207
|
|
208
|
+
it 'can edit the user password' do
|
209
|
+
fill_in 'user_password', with: 'welcome'
|
210
|
+
fill_in 'user_password_confirmation', with: 'welcome'
|
211
|
+
click_button 'Update'
|
212
|
+
|
213
|
+
expect(page).to have_text 'Account updated'
|
214
|
+
end
|
215
|
+
|
216
|
+
context 'without password permissions' do
|
217
|
+
custom_authorization! do |_user|
|
218
|
+
cannot [:update_password], Spree.user_class
|
219
|
+
end
|
220
|
+
|
221
|
+
it 'cannot edit the user password' do
|
222
|
+
expect(page).to_not have_text 'Password'
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
216
226
|
context 'invalid entry' do
|
217
227
|
around do |example|
|
218
228
|
::AlwaysInvalidUser = Class.new(Spree.user_class) do
|