solidus_backend 2.10.2 → 2.11.0
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 +4 -1
- data/app/assets/javascripts/spree/backend/adjustments.js +1 -1
- data/app/assets/javascripts/spree/backend/admin.js +18 -29
- data/app/assets/javascripts/spree/backend/collections/states.js +1 -1
- data/app/assets/javascripts/spree/backend/components/selectable_table.js +5 -0
- data/app/assets/javascripts/spree/backend/components/selectable_table/return_items.js +5 -0
- data/app/assets/javascripts/spree/backend/components/selectable_table/summary.js +7 -0
- data/app/assets/javascripts/spree/backend/components/sortable_table.js +31 -25
- data/app/assets/javascripts/spree/backend/models/order.js +3 -3
- data/app/assets/javascripts/spree/backend/models/payment.js +1 -1
- data/app/assets/javascripts/spree/backend/models/shipment.js +1 -1
- data/app/assets/javascripts/spree/backend/models/stock_item.js +1 -1
- data/app/assets/javascripts/spree/backend/option_type_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/option_value_picker.js +2 -2
- data/app/assets/javascripts/spree/backend/product_picker.js +2 -2
- data/app/assets/javascripts/spree/backend/routes.js +40 -21
- data/app/assets/javascripts/spree/backend/shipments.js +5 -5
- data/app/assets/javascripts/spree/backend/shipping_methods/stock_locations_picker.js +18 -0
- data/app/assets/javascripts/spree/backend/stock_management.js +4 -2
- data/app/assets/javascripts/spree/backend/taxon_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/taxons.js +3 -3
- data/app/assets/javascripts/spree/backend/templates/index.js +2 -0
- data/app/assets/javascripts/spree/backend/templates/orders/customer_details/autocomplete.hbs +2 -2
- data/app/assets/javascripts/spree/backend/templates/stock_items/stock_location_stock_item.hbs +5 -1
- data/app/assets/javascripts/spree/backend/templates/tables/return_item_sum_amount.hbs +7 -0
- data/app/assets/javascripts/spree/backend/templates/tables/selectable_label.hbs +6 -0
- data/app/assets/javascripts/spree/backend/user_picker.js +3 -4
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js +2 -2
- data/app/assets/javascripts/spree/backend/views/cart/empty_cart_button.js +2 -2
- data/app/assets/javascripts/spree/backend/views/index.js +4 -0
- data/app/assets/javascripts/spree/backend/views/order/address.js +1 -1
- data/app/assets/javascripts/spree/backend/views/order/customer_select.js +2 -3
- data/app/assets/javascripts/spree/backend/views/order/details_adjustments.js +4 -1
- data/app/assets/javascripts/spree/backend/views/stock/edit_stock_item_row.js +4 -0
- data/app/assets/javascripts/spree/backend/views/tables/return_items.js +9 -0
- data/app/assets/javascripts/spree/backend/views/tables/selectable_table.js +70 -0
- data/app/assets/javascripts/spree/backend/views/tables/selectable_table/sum_return_item_amount.js +32 -0
- data/app/assets/javascripts/spree/backend/views/tables/selectable_table/summary.js +45 -0
- data/app/assets/stylesheets/spree/backend/components/_navigation.scss +4 -5
- data/app/assets/stylesheets/spree/backend/sections/_orders.scss +5 -1
- data/app/assets/stylesheets/spree/backend/sections/_style_guide.scss +4 -0
- data/app/assets/stylesheets/spree/backend/shared/_forms.scss +1 -0
- data/app/controllers/spree/admin/base_controller.rb +6 -0
- data/app/controllers/spree/admin/cancellations_controller.rb +2 -0
- data/app/controllers/spree/admin/customer_returns_controller.rb +4 -4
- data/app/controllers/spree/admin/images_controller.rb +2 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -0
- data/app/controllers/spree/admin/orders_controller.rb +7 -2
- data/app/controllers/spree/admin/payments_controller.rb +3 -1
- data/app/controllers/spree/admin/product_properties_controller.rb +1 -1
- data/app/controllers/spree/admin/products_controller.rb +18 -24
- data/app/controllers/spree/admin/promotion_codes_controller.rb +9 -4
- data/app/controllers/spree/admin/refunds_controller.rb +19 -0
- data/app/controllers/spree/admin/resource_controller.rb +27 -7
- data/app/controllers/spree/admin/return_authorizations_controller.rb +1 -1
- data/app/controllers/spree/admin/root_controller.rb +1 -1
- data/app/controllers/spree/admin/search_controller.rb +1 -2
- data/app/controllers/spree/admin/stock_items_controller.rb +6 -5
- data/app/controllers/spree/admin/stock_locations_controller.rb +4 -0
- data/app/controllers/spree/admin/stock_movements_controller.rb +7 -0
- data/app/controllers/spree/admin/taxons_controller.rb +12 -1
- data/app/controllers/spree/admin/users/api_key_controller.rb +29 -0
- data/app/controllers/spree/admin/users_controller.rb +37 -20
- data/app/controllers/spree/admin/variants_controller.rb +4 -2
- data/app/controllers/spree/admin/zones_controller.rb +1 -1
- data/app/helpers/spree/admin/base_helper.rb +4 -0
- data/app/helpers/spree/admin/customer_returns_helper.rb +1 -1
- data/app/helpers/spree/admin/navigation_helper.rb +1 -1
- data/app/helpers/spree/admin/orders_helper.rb +8 -4
- data/app/helpers/spree/admin/stock_movements_helper.rb +8 -4
- data/app/views/spree/admin/customer_returns/_return_item_selection.html.erb +2 -3
- data/app/views/spree/admin/images/index.html.erb +25 -21
- data/app/views/spree/admin/option_types/_option_value_fields.html.erb +8 -1
- data/app/views/spree/admin/option_types/edit.html.erb +3 -1
- data/app/views/spree/admin/orders/customer_details/_form.html.erb +13 -13
- data/app/views/spree/admin/orders/index.html.erb +23 -13
- data/app/views/spree/admin/payment_methods/_form.html.erb +7 -2
- data/app/views/spree/admin/payments/index.html.erb +3 -1
- data/app/views/spree/admin/prices/_master_variant_table.html.erb +3 -3
- data/app/views/spree/admin/prices/_table.html.erb +3 -3
- data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +7 -2
- data/app/views/spree/admin/product_properties/index.html.erb +14 -2
- data/app/views/spree/admin/products/_form.html.erb +13 -2
- data/app/views/spree/admin/products/index.html.erb +1 -1
- data/app/views/spree/admin/promotion_codes/index.html.erb +1 -1
- data/app/views/spree/admin/promotions/_actions.html.erb +1 -1
- data/app/views/spree/admin/promotions/_activations_new.html.erb +1 -1
- data/app/views/spree/admin/promotions/_rules.html.erb +1 -1
- data/app/views/spree/admin/promotions/edit.html.erb +2 -2
- data/app/views/spree/admin/promotions/index.html.erb +12 -5
- data/app/views/spree/admin/return_authorizations/_form.html.erb +3 -10
- data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
- data/app/views/spree/admin/search/users.json.jbuilder +15 -1
- data/app/views/spree/admin/shared/_address.html.erb +6 -6
- data/app/views/spree/admin/shared/_address_form.html.erb +15 -8
- data/app/views/spree/admin/shared/_order_submenu.html.erb +4 -4
- data/app/views/spree/admin/shared/_payments_tabs.html.erb +1 -1
- data/app/views/spree/admin/shared/_settings_checkout_tabs.html.erb +5 -5
- data/app/views/spree/admin/shared/_settings_sub_menu.html.erb +6 -6
- data/app/views/spree/admin/shared/_shipping_tabs.html.erb +3 -3
- data/app/views/spree/admin/shared/_taxes_tabs.html.erb +2 -2
- data/app/views/spree/admin/shared/preference_fields/_encrypted_string.html.erb +12 -0
- data/app/views/spree/admin/shipping_methods/_form.html.erb +18 -0
- data/app/views/spree/admin/stock_items/_stock_management.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/edit.html.erb +1 -1
- data/app/views/spree/admin/stock_locations/index.html.erb +3 -1
- data/app/views/spree/admin/stock_movements/index.html.erb +30 -1
- data/app/views/spree/admin/stores/_form.html.erb +6 -0
- data/app/views/spree/admin/style_guide/topics/tables/_building_tables.html.erb +27 -3
- data/app/views/spree/admin/tax_categories/_form.html.erb +1 -0
- data/app/views/spree/admin/users/_form.html.erb +2 -2
- data/app/views/spree/admin/users/_tabs.html.erb +1 -1
- data/app/views/spree/admin/users/edit.html.erb +4 -4
- data/app/views/spree/admin/users/items.html.erb +5 -3
- data/app/views/spree/admin/users/orders.html.erb +5 -3
- data/app/views/spree/admin/variants/_table_filter.html.erb +1 -1
- data/app/views/spree/admin/variants/index.html.erb +2 -2
- data/config/initializers/form_builder.rb +2 -2
- data/lib/spree/backend/engine.rb +0 -2
- data/lib/spree/backend_configuration.rb +14 -1
- data/solidus_backend.gemspec +4 -4
- metadata +23 -122
- data/app/assets/javascripts/spree/backend/returns/return_item_selection.js +0 -35
- data/script/rails +0 -10
- data/spec/controllers/spree/admin/base_controller_spec.rb +0 -26
- data/spec/controllers/spree/admin/cancellations_controller_spec.rb +0 -83
- data/spec/controllers/spree/admin/customer_returns_controller_spec.rb +0 -235
- data/spec/controllers/spree/admin/locale_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/missing_products_controller_spec.rb +0 -18
- data/spec/controllers/spree/admin/orders/customer_details_controller_spec.rb +0 -128
- data/spec/controllers/spree/admin/orders_controller_spec.rb +0 -408
- data/spec/controllers/spree/admin/payment_methods_controller_spec.rb +0 -95
- data/spec/controllers/spree/admin/payments_controller_spec.rb +0 -194
- data/spec/controllers/spree/admin/prices_controller_spec.rb +0 -45
- data/spec/controllers/spree/admin/product_properties_controller_spec.rb +0 -71
- data/spec/controllers/spree/admin/products_controller_spec.rb +0 -270
- data/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +0 -23
- data/spec/controllers/spree/admin/promotion_codes_controller_spec.rb +0 -32
- data/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +0 -36
- data/spec/controllers/spree/admin/promotions_controller_spec.rb +0 -122
- data/spec/controllers/spree/admin/refunds_controller_spec.rb +0 -35
- data/spec/controllers/spree/admin/reimbursements_controller_spec.rb +0 -137
- data/spec/controllers/spree/admin/resource_controller_spec.rb +0 -201
- data/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +0 -291
- data/spec/controllers/spree/admin/return_items_controller_spec.rb +0 -29
- data/spec/controllers/spree/admin/root_controller_spec.rb +0 -43
- data/spec/controllers/spree/admin/search_controller_spec.rb +0 -106
- data/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +0 -16
- data/spec/controllers/spree/admin/stock_items_controller_spec.rb +0 -52
- data/spec/controllers/spree/admin/stock_locations_controller_spec.rb +0 -44
- data/spec/controllers/spree/admin/store_credits_controller_spec.rb +0 -311
- data/spec/controllers/spree/admin/users_controller_spec.rb +0 -287
- data/spec/controllers/spree/admin/variants_controller_spec.rb +0 -71
- data/spec/features/admin/configuration/payment_methods_spec.rb +0 -176
- data/spec/features/admin/configuration/shipping_methods_spec.rb +0 -126
- data/spec/features/admin/configuration/stock_locations_spec.rb +0 -54
- data/spec/features/admin/configuration/store_spec.rb +0 -62
- data/spec/features/admin/configuration/tax_categories_spec.rb +0 -58
- data/spec/features/admin/configuration/tax_rates_spec.rb +0 -31
- data/spec/features/admin/configuration/taxonomies_spec.rb +0 -61
- data/spec/features/admin/configuration/zones_spec.rb +0 -41
- data/spec/features/admin/homepage_spec.rb +0 -86
- data/spec/features/admin/javascript_format_money_spec.rb +0 -22
- data/spec/features/admin/locale_spec.rb +0 -34
- data/spec/features/admin/orders/adjustments_promotions_spec.rb +0 -55
- data/spec/features/admin/orders/adjustments_spec.rb +0 -130
- data/spec/features/admin/orders/cancelling_and_resuming_spec.rb +0 -45
- data/spec/features/admin/orders/cancelling_inventory_spec.rb +0 -50
- data/spec/features/admin/orders/customer_details_spec.rb +0 -203
- data/spec/features/admin/orders/customer_returns_spec.rb +0 -41
- data/spec/features/admin/orders/line_items_spec.rb +0 -52
- data/spec/features/admin/orders/listing_spec.rb +0 -186
- data/spec/features/admin/orders/log_entries_spec.rb +0 -56
- data/spec/features/admin/orders/new_order_spec.rb +0 -379
- data/spec/features/admin/orders/new_refund_spec.rb +0 -35
- data/spec/features/admin/orders/order_details_spec.rb +0 -591
- data/spec/features/admin/orders/payments_spec.rb +0 -330
- data/spec/features/admin/orders/return_authorizations_spec.rb +0 -56
- data/spec/features/admin/orders/return_payment_state_spec.rb +0 -65
- data/spec/features/admin/orders/risk_analysis_spec.rb +0 -49
- data/spec/features/admin/orders/shipments_spec.rb +0 -145
- data/spec/features/admin/payments/store_credits_spec.rb +0 -23
- data/spec/features/admin/products/edit/images_spec.rb +0 -76
- data/spec/features/admin/products/edit/products_spec.rb +0 -92
- data/spec/features/admin/products/edit/taxons_spec.rb +0 -57
- data/spec/features/admin/products/edit/variants_spec.rb +0 -63
- data/spec/features/admin/products/option_types_spec.rb +0 -116
- data/spec/features/admin/products/pricing_spec.rb +0 -127
- data/spec/features/admin/products/products_spec.rb +0 -348
- data/spec/features/admin/products/properties_spec.rb +0 -141
- data/spec/features/admin/products/stock_management_spec.rb +0 -101
- data/spec/features/admin/products/variant_spec.rb +0 -89
- data/spec/features/admin/promotion_adjustments_spec.rb +0 -286
- data/spec/features/admin/promotions/option_value_rule_spec.rb +0 -90
- data/spec/features/admin/promotions/product_rule_spec.rb +0 -35
- data/spec/features/admin/promotions/promotion_categories_spec.rb +0 -83
- data/spec/features/admin/promotions/promotion_code_batches_spec.rb +0 -37
- data/spec/features/admin/promotions/promotion_code_spec.rb +0 -31
- data/spec/features/admin/promotions/promotion_spec.rb +0 -52
- data/spec/features/admin/promotions/tiered_calculator_spec.rb +0 -76
- data/spec/features/admin/promotions/user_rule_spec.rb +0 -42
- data/spec/features/admin/reimbursements_spec.rb +0 -18
- data/spec/features/admin/store_credits_spec.rb +0 -132
- data/spec/features/admin/stores_spec.rb +0 -37
- data/spec/features/admin/style_guide_spec.rb +0 -14
- data/spec/features/admin/taxons_spec.rb +0 -90
- data/spec/features/admin/users_spec.rb +0 -412
- data/spec/fixtures/files/ror_ringer.jpeg +0 -0
- data/spec/helpers/admin/base_helper_spec.rb +0 -49
- data/spec/helpers/admin/navigation_helper_spec.rb +0 -139
- data/spec/helpers/admin/stock_movements_helper_spec.rb +0 -29
- data/spec/helpers/admin/store_credit_events_helper_spec.rb +0 -97
- data/spec/helpers/promotion_rules_helper_spec.rb +0 -14
- data/spec/javascripts/fixtures/_boot.html.erb +0 -8
- data/spec/javascripts/fixtures/number_with_currency/with_currency_select.html.erb +0 -3
- data/spec/javascripts/fixtures/number_with_currency/without_select.html.erb +0 -3
- data/spec/javascripts/format_money_spec.js +0 -48
- data/spec/javascripts/spec_helper.js +0 -13
- data/spec/javascripts/support/show_errors.js +0 -8
- data/spec/javascripts/support/with_translations.js +0 -11
- data/spec/javascripts/translation_spec.js +0 -58
- data/spec/javascripts/views/number_with_currency_spec.js +0 -72
- data/spec/lib/spree/backend_configuration/menu_item_spec.rb +0 -17
- data/spec/lib/spree/backend_configuration_spec.rb +0 -22
- data/spec/spec_helper.rb +0 -123
- data/spec/support/appear_before_matcher.rb +0 -10
- data/spec/support/feature/base_feature_helper.rb +0 -17
- data/spec/support/feature/order_feature_helper.rb +0 -27
- data/spec/teaspoon_env.rb +0 -51
- data/spec/test_views/spree/admin/widgets/edit.html.erb +0 -1
- data/spec/test_views/spree/admin/widgets/new.html.erb +0 -1
- data/spec/views/spree/admin/shared/navigation_footer_spec.rb +0 -67
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'Promotions', type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
let!(:reimbursement) { create(:reimbursement) }
|
8
|
-
|
9
|
-
it "should display the reimbursements table" do
|
10
|
-
visit spree.admin_order_reimbursement_path(reimbursement.order, reimbursement)
|
11
|
-
expect(page).to have_css('table thead tr th', text: 'Product')
|
12
|
-
expect(page).to have_css('table thead tr th', text: 'Preferred Reimbursement Type')
|
13
|
-
expect(page).to have_css('table thead tr th', text: 'Reimbursement Type Override')
|
14
|
-
expect(page).to have_css('table thead tr th', text: 'Exchange For')
|
15
|
-
expect(page).to have_css('table thead tr th', text: 'Amount Before Sales Tax')
|
16
|
-
expect(page).to have_css('table thead tr th', text: 'Total')
|
17
|
-
end
|
18
|
-
end
|
@@ -1,132 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Store credits admin" do
|
6
|
-
stub_authorization!
|
7
|
-
let!(:admin_user) { create(:admin_user) }
|
8
|
-
let!(:store_credit) { create(:store_credit) }
|
9
|
-
let(:user) { store_credit.user }
|
10
|
-
|
11
|
-
before do
|
12
|
-
allow(Spree.user_class).to receive(:find_by).
|
13
|
-
with(hash_including(:id)).
|
14
|
-
and_return(store_credit.user)
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "visiting the store credits page" do
|
18
|
-
before do
|
19
|
-
visit spree.admin_path
|
20
|
-
click_link "Users"
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should be on the store credits page" do
|
24
|
-
click_link store_credit.user.email
|
25
|
-
click_link "Store Credit"
|
26
|
-
expect(page.current_path).to eq spree.admin_user_store_credits_path(store_credit.user)
|
27
|
-
|
28
|
-
store_credit_table = page.find(".sc-table")
|
29
|
-
expect(store_credit_table).to have_css('tr', count: 1)
|
30
|
-
expect(store_credit_table).to have_content(Spree::Money.new(store_credit.amount).to_s)
|
31
|
-
expect(store_credit_table).to have_content(Spree::Money.new(store_credit.amount_used).to_s)
|
32
|
-
expect(store_credit_table).to have_content(store_credit.category_name)
|
33
|
-
expect(store_credit_table).to have_content(store_credit.created_by_email)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "creating store credit" do
|
38
|
-
before do
|
39
|
-
visit spree.admin_path
|
40
|
-
click_link "Users"
|
41
|
-
click_link store_credit.user.email
|
42
|
-
click_link "Store Credit"
|
43
|
-
allow_any_instance_of(Spree::Admin::StoreCreditsController).to receive_messages(try_spree_current_user: admin_user)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should create store credit and associate it with the user" do
|
47
|
-
click_link "Add store credit"
|
48
|
-
page.fill_in "store_credit_amount", with: "102.00"
|
49
|
-
select "Exchange", from: "store_credit_category_id"
|
50
|
-
click_button "Create"
|
51
|
-
|
52
|
-
expect(page.current_path).to eq spree.admin_user_store_credits_path(store_credit.user)
|
53
|
-
store_credit_table = page.find(".sc-table")
|
54
|
-
expect(store_credit_table).to have_css('tr', count: 2)
|
55
|
-
expect(Spree::StoreCredit.count).to eq 2
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
describe "displaying a store credit details page" do
|
60
|
-
before do
|
61
|
-
visit spree.admin_path
|
62
|
-
click_link "Users"
|
63
|
-
click_link store_credit.user.email
|
64
|
-
click_link "Store Credit"
|
65
|
-
page.find(".sc-table td.actions a.fa-edit").click
|
66
|
-
end
|
67
|
-
|
68
|
-
it "shows the store credit's information" do
|
69
|
-
within ".content" do
|
70
|
-
expect(page).to have_content "Credited #{store_credit.display_amount}"
|
71
|
-
expect(page).to have_content "Created By #{store_credit.created_by.email}"
|
72
|
-
expect(page).to have_content "Type #{store_credit.category_name}"
|
73
|
-
expect(page).to have_content 'Store credit history'
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
it "lets edit store credit's memo", js: true do
|
78
|
-
allow_any_instance_of(Spree::Admin::StoreCreditsController)
|
79
|
-
.to receive(:try_spree_current_user)
|
80
|
-
.and_return(admin_user)
|
81
|
-
|
82
|
-
# When there are no errors
|
83
|
-
within '.store-credit-memo-row' do
|
84
|
-
click_button 'Edit'
|
85
|
-
fill_in 'store_credit_memo', with: 'Lottery Won'
|
86
|
-
click_button 'Save'
|
87
|
-
expect(page).to have_content "Memo Lottery Won", normalize_ws: true
|
88
|
-
end
|
89
|
-
expect(page).to have_content "Store Credit has been successfully updated!"
|
90
|
-
|
91
|
-
# When there are errors
|
92
|
-
allow_any_instance_of(Spree::StoreCredit).to receive(:save) { false }
|
93
|
-
allow_any_instance_of(Spree::StoreCredit)
|
94
|
-
.to receive_message_chain(:errors, :full_messages)
|
95
|
-
.and_return(["Memo is not valid"])
|
96
|
-
|
97
|
-
within '.store-credit-memo-row' do
|
98
|
-
find(:css, ".edit-memo").click
|
99
|
-
fill_in 'store_credit_memo', with: 'Lottery Won Twice'
|
100
|
-
find(:css, ".save-memo").click
|
101
|
-
expect(page).to have_content "Memo Lottery Won", normalize_ws: true
|
102
|
-
expect(page).not_to have_content "Lottery Won Twice"
|
103
|
-
end
|
104
|
-
expect(page).to have_content "Unable to update store credit [\"Memo is not valid\"]"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
describe "updating store credit" do
|
109
|
-
let(:updated_amount) { "99.0" }
|
110
|
-
let!(:store_credit_reason) { create(:store_credit_reason) }
|
111
|
-
|
112
|
-
before do
|
113
|
-
visit spree.admin_path
|
114
|
-
click_link "Users"
|
115
|
-
click_link store_credit.user.email
|
116
|
-
click_link "Store Credit"
|
117
|
-
allow_any_instance_of(Spree::Admin::StoreCreditsController).to receive_messages(try_spree_current_user: admin_user)
|
118
|
-
end
|
119
|
-
|
120
|
-
it "updates the store credit's amount" do
|
121
|
-
page.find(".sc-table td.actions a.fa-edit").click
|
122
|
-
expect(page).to have_content 'Store credit history'
|
123
|
-
click_link "Change amount"
|
124
|
-
expect(page).to have_content 'Editing store credit amount'
|
125
|
-
page.fill_in 'store_credit_amount', with: updated_amount
|
126
|
-
page.select store_credit_reason.name, from: 'store_credit_reason_id'
|
127
|
-
click_button "Update"
|
128
|
-
expect(page.find('#sc-detail-table')).to have_content "$99.00"
|
129
|
-
expect(store_credit.reload.amount.to_f).to eq updated_amount.to_f
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'Stores', type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
context 'when adding a store' do
|
9
|
-
before { visit spree.new_admin_store_path }
|
10
|
-
|
11
|
-
it 'admin should be able to set the default_currency' do
|
12
|
-
expect(find('#store_default_currency').value).to eq ''
|
13
|
-
|
14
|
-
fill_in 'store_name', with: 'Solidus Store'
|
15
|
-
fill_in 'store_code', with: 'solidus'
|
16
|
-
fill_in 'store_url', with: 'example.solidus.io'
|
17
|
-
fill_in 'store_mail_from_address', with: 'from@solidus.io'
|
18
|
-
select 'EUR', from: 'store_default_currency'
|
19
|
-
click_button 'Create'
|
20
|
-
|
21
|
-
@store = Spree::Store.last
|
22
|
-
|
23
|
-
expect(@store.default_currency).to eq 'EUR'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'when editing a store' do
|
28
|
-
let(:store) { create :store, default_currency: 'AUD' }
|
29
|
-
before { visit spree.edit_admin_store_path(store) }
|
30
|
-
|
31
|
-
it 'admin should be able to change the default_currency' do
|
32
|
-
select 'EUR', from: 'store_default_currency'
|
33
|
-
click_button 'Update'
|
34
|
-
expect(store.reload.default_currency).to eq 'EUR'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Style guide", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
it "should render successfully" do
|
9
|
-
visit "/admin/style_guide"
|
10
|
-
|
11
|
-
# Somewhere in a style guide you'd expect to talk about colors
|
12
|
-
expect(page).to have_text "Colors"
|
13
|
-
end
|
14
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe "Taxonomies and taxons", type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
|
8
|
-
it "admin should be able to edit taxon" do
|
9
|
-
visit spree.new_admin_taxonomy_path
|
10
|
-
|
11
|
-
fill_in "Name", with: "Hello"
|
12
|
-
click_button "Create"
|
13
|
-
|
14
|
-
@taxonomy = Spree::Taxonomy.last
|
15
|
-
|
16
|
-
visit spree.edit_admin_taxonomy_taxon_path(@taxonomy, @taxonomy.root.id)
|
17
|
-
|
18
|
-
fill_in "taxon_name", with: "Shirt"
|
19
|
-
fill_in "taxon_description", with: "Discover our new rails shirts"
|
20
|
-
|
21
|
-
fill_in "permalink_part", with: "shirt-rails"
|
22
|
-
click_button "Update"
|
23
|
-
expect(page).to have_content("Taxon \"Shirt\" has been successfully updated!")
|
24
|
-
end
|
25
|
-
|
26
|
-
it "can view and add to taxon tree", js: true do
|
27
|
-
taxonomy = create :taxonomy
|
28
|
-
|
29
|
-
visit spree.edit_admin_taxonomy_path(taxonomy)
|
30
|
-
expect(page).to have_content('Brand')
|
31
|
-
|
32
|
-
click_on('Add taxon')
|
33
|
-
expect(page).to have_content('New node')
|
34
|
-
|
35
|
-
# Little tricky to select the right taxon. Since the text is technically
|
36
|
-
# inside the top-level li.
|
37
|
-
within '#taxonomy_tree li li', text: 'New node' do
|
38
|
-
click_icon :edit
|
39
|
-
end
|
40
|
-
|
41
|
-
expect(page).to have_current_path %r{/admin/taxonomies/\d+/taxons/\d+/edit}
|
42
|
-
end
|
43
|
-
|
44
|
-
context "inside sidebar menu" do
|
45
|
-
def only_one_selected_tab_inside?(sub_tab_selector, tab_name, tab_path)
|
46
|
-
within(sub_tab_selector) do
|
47
|
-
expect(page).to have_selector('.selected', count: 1)
|
48
|
-
|
49
|
-
within('.selected') { expect(page).to have_link(tab_name, href: tab_path) }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
context "on display taxonomies page", js: true do
|
54
|
-
it "should be selected only one tab 'Taxonomies' in product sub tabs" do
|
55
|
-
visit spree.admin_taxonomies_path
|
56
|
-
only_one_selected_tab_inside?('[data-hook=admin_product_sub_tabs]', 'Taxonomies', spree.admin_taxonomies_path)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context "on edit taxonomy page", js: true do
|
61
|
-
it "should be selected only one tab 'Taxonomies' in product sub tabs" do
|
62
|
-
taxonomy = create :taxonomy
|
63
|
-
|
64
|
-
visit spree.edit_admin_taxonomy_path(taxonomy)
|
65
|
-
only_one_selected_tab_inside?('[data-hook=admin_product_sub_tabs]', 'Taxonomies', spree.admin_taxonomies_path)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context "on edit taxonomy's taxon page", js: true do
|
70
|
-
it "should be selected only one tab 'Taxonomies' in product sub tabs" do
|
71
|
-
taxonomy = create :taxonomy
|
72
|
-
|
73
|
-
visit spree.edit_admin_taxonomy_taxon_path(taxonomy, taxonomy.root.id)
|
74
|
-
only_one_selected_tab_inside?('[data-hook=admin_product_sub_tabs]', 'Taxonomies', spree.admin_taxonomies_path)
|
75
|
-
end
|
76
|
-
end
|
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
|
90
|
-
end
|
@@ -1,412 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe 'Users', type: :feature do
|
6
|
-
stub_authorization!
|
7
|
-
let!(:country) { create(:country) }
|
8
|
-
let!(:user_a) { create(:user_with_addresses, email: 'a@example.com') }
|
9
|
-
let!(:user_b) { create(:user_with_addresses, email: 'b@example.com') }
|
10
|
-
let!(:admin_role) { create(:role, name: 'admin') }
|
11
|
-
let!(:user_role) { create(:role, name: 'user') }
|
12
|
-
|
13
|
-
let(:order) { create(:completed_order_with_totals, user: user_a, number: "R123") }
|
14
|
-
|
15
|
-
let(:order_2) do
|
16
|
-
create(:completed_order_with_totals, user: user_a, number: "R456").tap do |o|
|
17
|
-
li = o.line_items.last
|
18
|
-
li.update_column(:price, li.price + 10)
|
19
|
-
o.recalculate
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:orders) { [order, order_2] }
|
24
|
-
|
25
|
-
shared_examples_for 'a user page' do
|
26
|
-
it 'has lifetime stats' do
|
27
|
-
orders
|
28
|
-
visit current_url # need to refresh after creating the orders for specs that did not require orders
|
29
|
-
within("#user-lifetime-stats") do
|
30
|
-
[:total_sales, :num_orders, :average_order_value, :member_since].each do |stat_name|
|
31
|
-
expect(page).to have_content I18n.t(stat_name, scope: 'spree')
|
32
|
-
end
|
33
|
-
expect(page).to have_content(order.total + order_2.total)
|
34
|
-
expect(page).to have_content orders.count
|
35
|
-
expect(page).to have_content(orders.sum(&:total) / orders.count)
|
36
|
-
expect(page).to have_content I18n.l(user_a.created_at.to_date)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'can go back to the users list' do
|
41
|
-
expect(page).to have_link Spree::LegacyUser.model_name.human(count: Spree::I18N_GENERIC_PLURAL), href: spree.admin_users_path
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'can navigate to the account page' do
|
45
|
-
expect(page).to have_link I18n.t("spree.admin.user.account"), href: spree.edit_admin_user_path(user_a)
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'can navigate to the order history' do
|
49
|
-
expect(page).to have_link I18n.t("spree.admin.user.order_history"), href: spree.orders_admin_user_path(user_a)
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'can navigate to the items purchased' do
|
53
|
-
expect(page).to have_link I18n.t("spree.admin.user.items"), href: spree.items_admin_user_path(user_a)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
shared_examples_for 'a sortable attribute' do
|
58
|
-
before { click_link sort_link }
|
59
|
-
|
60
|
-
it "can sort asc" do
|
61
|
-
within_table(table_id) do
|
62
|
-
expect(page).to have_selector '.sort_link.asc'
|
63
|
-
expect(page).to have_text text_match_1
|
64
|
-
expect(page).to have_text text_match_2
|
65
|
-
expect(text_match_1).to appear_before text_match_2
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
it "can sort desc" do
|
70
|
-
within_table(table_id) do
|
71
|
-
# Ransack adds a ▲ to the sort link. With exact match Capybara is not able to find that link
|
72
|
-
click_link sort_link, exact: false
|
73
|
-
end
|
74
|
-
|
75
|
-
within_table(table_id) do
|
76
|
-
expect(page).to have_selector '.sort_link.desc'
|
77
|
-
expect(page).to have_text text_match_1
|
78
|
-
expect(page).to have_text text_match_2
|
79
|
-
expect(text_match_2).to appear_before text_match_1
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
before do
|
85
|
-
visit spree.admin_path
|
86
|
-
click_link 'Users'
|
87
|
-
end
|
88
|
-
|
89
|
-
context 'users index' do
|
90
|
-
context "email" do
|
91
|
-
it_behaves_like "a sortable attribute" do
|
92
|
-
let(:text_match_1) { user_a.email }
|
93
|
-
let(:text_match_2) { user_b.email }
|
94
|
-
let(:table_id) { "listing_users" }
|
95
|
-
let(:sort_link) { "users_email_title" }
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
it 'displays the correct results for a user search by email' do
|
100
|
-
fill_in 'q_email_cont', with: user_a.email
|
101
|
-
click_button 'Search'
|
102
|
-
within_table('listing_users') do
|
103
|
-
expect(page).to have_text user_a.email
|
104
|
-
expect(page).not_to have_text user_b.email
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context "member since" do
|
109
|
-
before do
|
110
|
-
user_a.update_column(:created_at, 2.weeks.ago)
|
111
|
-
end
|
112
|
-
|
113
|
-
it_behaves_like "a sortable attribute" do
|
114
|
-
let(:text_match_1) { user_a.email }
|
115
|
-
let(:text_match_2) { user_b.email }
|
116
|
-
let(:table_id) { "listing_users" }
|
117
|
-
let(:sort_link) { I18n.t('spree.member_since') }
|
118
|
-
end
|
119
|
-
|
120
|
-
it 'displays the correct results for a user search by creation date' do
|
121
|
-
fill_in 'q_created_at_lt', with: 1.week.ago
|
122
|
-
click_button 'Search'
|
123
|
-
within_table('listing_users') do
|
124
|
-
expect(page).to have_text user_a.email
|
125
|
-
expect(page).not_to have_text user_b.email
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
context 'with users having roles' do
|
131
|
-
before do
|
132
|
-
user_a.spree_roles << admin_role
|
133
|
-
user_b.spree_roles << user_role
|
134
|
-
end
|
135
|
-
|
136
|
-
it 'displays the correct results for a user search by role' do
|
137
|
-
select 'admin', from: Spree.user_class.human_attribute_name(:spree_roles)
|
138
|
-
click_button 'Search'
|
139
|
-
within_table('listing_users') do
|
140
|
-
expect(page).to have_text user_a.email
|
141
|
-
expect(page).not_to have_text user_b.email
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
context 'editing users' do
|
148
|
-
before { click_link user_a.email }
|
149
|
-
|
150
|
-
it_behaves_like 'a user page'
|
151
|
-
|
152
|
-
it 'can edit the user email' do
|
153
|
-
fill_in 'user_email', with: 'a@example.com99'
|
154
|
-
click_button 'Update'
|
155
|
-
|
156
|
-
expect(user_a.reload.email).to eq 'a@example.com99'
|
157
|
-
expect(page).to have_text 'Account updated'
|
158
|
-
expect(page).to have_field('user_email', with: 'a@example.com99')
|
159
|
-
end
|
160
|
-
|
161
|
-
it 'can edit user roles' do
|
162
|
-
click_link 'Account'
|
163
|
-
|
164
|
-
check 'user_spree_role_admin'
|
165
|
-
click_button 'Update'
|
166
|
-
expect(page).to have_text 'Account updated'
|
167
|
-
expect(find_field('user_spree_role_admin')).to be_checked
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'can delete user roles' do
|
171
|
-
user_a.spree_roles << Spree::Role.create(name: "dummy")
|
172
|
-
click_link 'Account'
|
173
|
-
|
174
|
-
user_a.spree_roles.each do |role|
|
175
|
-
uncheck "user_spree_role_#{role.name}"
|
176
|
-
end
|
177
|
-
|
178
|
-
click_button 'Update'
|
179
|
-
expect(page).to have_text 'Account updated'
|
180
|
-
expect(find_field('user_spree_role_dummy')).not_to be_checked
|
181
|
-
expect(user_a.reload.spree_roles).to be_empty
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'can edit user shipping address' do
|
185
|
-
click_link "Addresses"
|
186
|
-
|
187
|
-
within("#admin_user_edit_addresses") do
|
188
|
-
fill_in "user_ship_address_attributes_address1", with: "1313 Mockingbird Ln"
|
189
|
-
click_button 'Update'
|
190
|
-
expect(page).to have_field('user_ship_address_attributes_address1', with: "1313 Mockingbird Ln")
|
191
|
-
end
|
192
|
-
|
193
|
-
expect(user_a.reload.ship_address.address1).to eq "1313 Mockingbird Ln"
|
194
|
-
end
|
195
|
-
|
196
|
-
it 'can edit user billing address' do
|
197
|
-
click_link "Addresses"
|
198
|
-
|
199
|
-
within("#admin_user_edit_addresses") do
|
200
|
-
fill_in "user_bill_address_attributes_address1", with: "1313 Mockingbird Ln"
|
201
|
-
click_button 'Update'
|
202
|
-
expect(page).to have_field('user_bill_address_attributes_address1', with: "1313 Mockingbird Ln")
|
203
|
-
end
|
204
|
-
|
205
|
-
expect(user_a.reload.bill_address.address1).to eq "1313 Mockingbird Ln"
|
206
|
-
end
|
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
|
-
|
226
|
-
context 'invalid entry' do
|
227
|
-
around do |example|
|
228
|
-
::AlwaysInvalidUser = Class.new(Spree.user_class) do
|
229
|
-
validate :always_invalid_email
|
230
|
-
def always_invalid_email
|
231
|
-
errors.add(:email, "is invalid")
|
232
|
-
end
|
233
|
-
end
|
234
|
-
orig_class = Spree.user_class
|
235
|
-
Spree.user_class = "AlwaysInvalidUser"
|
236
|
-
|
237
|
-
example.run
|
238
|
-
|
239
|
-
Spree.user_class = orig_class.name
|
240
|
-
Object.send(:remove_const, "AlwaysInvalidUser")
|
241
|
-
end
|
242
|
-
|
243
|
-
it 'should show validation errors' do
|
244
|
-
fill_in 'user_email', with: 'something'
|
245
|
-
click_button 'Update'
|
246
|
-
|
247
|
-
within('#errorExplanation') do
|
248
|
-
expect(page).to have_content("Email is invalid")
|
249
|
-
end
|
250
|
-
|
251
|
-
within('.flash.error') do
|
252
|
-
expect(page).to have_content("Email is invalid")
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
|
-
context 'no api key exists' do
|
258
|
-
it 'can generate a new api key' do
|
259
|
-
within("#admin_user_edit_api_key") do
|
260
|
-
expect(user_a.spree_api_key).to be_blank
|
261
|
-
click_button "Generate API key"
|
262
|
-
end
|
263
|
-
|
264
|
-
expect(user_a.reload.spree_api_key).to be_present
|
265
|
-
|
266
|
-
expect(page).to have_content('Key: (hidden)')
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
context 'an api key exists' do
|
271
|
-
before do
|
272
|
-
user_a.generate_spree_api_key!
|
273
|
-
expect(user_a.reload.spree_api_key).to be_present
|
274
|
-
visit current_path
|
275
|
-
end
|
276
|
-
|
277
|
-
it 'can clear an api key' do
|
278
|
-
expect(page).to have_css('#current-api-key')
|
279
|
-
|
280
|
-
click_button "Clear key"
|
281
|
-
|
282
|
-
expect(page).to have_no_css('#current-api-key')
|
283
|
-
|
284
|
-
expect(user_a.reload.spree_api_key).to be_blank
|
285
|
-
end
|
286
|
-
|
287
|
-
it 'can regenerate an api key' do
|
288
|
-
old_key = user_a.spree_api_key
|
289
|
-
|
290
|
-
within("#admin_user_edit_api_key") do
|
291
|
-
click_button "Regenerate key"
|
292
|
-
end
|
293
|
-
|
294
|
-
expect(user_a.reload.spree_api_key).to be_present
|
295
|
-
expect(user_a.reload.spree_api_key).not_to eq old_key
|
296
|
-
|
297
|
-
expect(page).to have_content('Key: (hidden)')
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
context 'deleting users' do
|
303
|
-
let!(:an_user) { create(:user_with_addresses, email: 'an_user@example.com') }
|
304
|
-
let!(:order) { create(:completed_order_with_totals, user_id: an_user.id) }
|
305
|
-
|
306
|
-
context 'if an user has placed orders' do
|
307
|
-
before do
|
308
|
-
visit spree.admin_path
|
309
|
-
click_link 'Users'
|
310
|
-
end
|
311
|
-
|
312
|
-
it "can't be deleted" do
|
313
|
-
within "#spree_user_#{an_user.id}" do
|
314
|
-
expect(page).not_to have_selector('.fa-trash')
|
315
|
-
end
|
316
|
-
end
|
317
|
-
end
|
318
|
-
end
|
319
|
-
|
320
|
-
context 'order history with sorting' do
|
321
|
-
before do
|
322
|
-
orders
|
323
|
-
click_link user_a.email
|
324
|
-
within(".tabs") { click_link I18n.t("spree.admin.user.order_history") }
|
325
|
-
end
|
326
|
-
|
327
|
-
it_behaves_like 'a user page'
|
328
|
-
|
329
|
-
context "completed_at" do
|
330
|
-
it_behaves_like "a sortable attribute" do
|
331
|
-
let(:text_match_1) { I18n.l(order.completed_at.to_date) }
|
332
|
-
let(:text_match_2) { I18n.l(order_2.completed_at.to_date) }
|
333
|
-
let(:table_id) { "listing_orders" }
|
334
|
-
let(:sort_link) { "orders_completed_at_title" }
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
context :number do
|
339
|
-
it_behaves_like "a sortable attribute" do
|
340
|
-
let(:text_match_1) { order.number }
|
341
|
-
let(:text_match_2) { order_2.number }
|
342
|
-
let(:table_id) { "listing_orders" }
|
343
|
-
let(:sort_link) { "orders_number_title" }
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
context :total do
|
348
|
-
it_behaves_like "a sortable attribute" do
|
349
|
-
# Since Spree::Money renders each piece of the total in it's own span,
|
350
|
-
# we are just checking the dollar total matches. Mainly due to how
|
351
|
-
# RSpec matcher appear_before works since it can't index the broken up total.
|
352
|
-
let(:text_match_1) { order.total.to_i.to_s }
|
353
|
-
let(:text_match_2) { order_2.total.to_i.to_s }
|
354
|
-
let(:table_id) { "listing_orders" }
|
355
|
-
let(:sort_link) { "orders_total_title" }
|
356
|
-
end
|
357
|
-
end
|
358
|
-
|
359
|
-
context "state" do
|
360
|
-
let(:text_match_1) { "Complete" }
|
361
|
-
let(:text_match_2) { "Complete" }
|
362
|
-
let(:table_id) { "listing_orders" }
|
363
|
-
let(:sort_link) { "orders_#{attr}_title" }
|
364
|
-
end
|
365
|
-
end
|
366
|
-
|
367
|
-
context 'items purchased with sorting' do
|
368
|
-
before do
|
369
|
-
orders
|
370
|
-
click_link user_a.email
|
371
|
-
within(".tabs") { click_link I18n.t("spree.admin.user.items") }
|
372
|
-
end
|
373
|
-
|
374
|
-
it_behaves_like 'a user page'
|
375
|
-
|
376
|
-
context "completed_at" do
|
377
|
-
it_behaves_like "a sortable attribute" do
|
378
|
-
let(:text_match_1) { I18n.l(order.completed_at.to_date) }
|
379
|
-
let(:text_match_2) { I18n.l(order_2.completed_at.to_date) }
|
380
|
-
let(:table_id) { "listing_items" }
|
381
|
-
let(:sort_link) { "orders_completed_at_title" }
|
382
|
-
end
|
383
|
-
end
|
384
|
-
|
385
|
-
context "number" do
|
386
|
-
let(:text_match_1) { "R123" }
|
387
|
-
let(:text_match_2) { "R456" }
|
388
|
-
let(:table_id) { "listing_items" }
|
389
|
-
let(:sort_link) { "orders_#{attr}_title" }
|
390
|
-
end
|
391
|
-
|
392
|
-
context "state" do
|
393
|
-
let(:text_match_1) { "Complete" }
|
394
|
-
let(:text_match_2) { "Complete" }
|
395
|
-
let(:table_id) { "listing_items" }
|
396
|
-
let(:sort_link) { "orders_#{attr}_title" }
|
397
|
-
end
|
398
|
-
|
399
|
-
it "has item attributes" do
|
400
|
-
items = order.line_items | order_2.line_items
|
401
|
-
expect(page).to have_table 'listing_items'
|
402
|
-
within_table('listing_items') do
|
403
|
-
items.each do |item|
|
404
|
-
expect(page).to have_selector(".item-name", text: item.product.name)
|
405
|
-
expect(page).to have_selector(".item-price", text: item.single_money.to_html(html_wrap: false))
|
406
|
-
expect(page).to have_selector(".item-quantity", text: item.quantity)
|
407
|
-
expect(page).to have_selector(".item-total", text: item.money.to_html(html_wrap: false))
|
408
|
-
end
|
409
|
-
end
|
410
|
-
end
|
411
|
-
end
|
412
|
-
end
|