solidus_backend 2.10.5 → 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 +21 -120
- 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
Binary file
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Spree::Admin::BaseHelper, type: :helper do
|
6
|
-
include Spree::Admin::BaseHelper
|
7
|
-
|
8
|
-
context "#datepicker_field_value" do
|
9
|
-
it "should return nil when date is empty" do
|
10
|
-
date = nil
|
11
|
-
expect(datepicker_field_value(date)).to be_nil
|
12
|
-
end
|
13
|
-
|
14
|
-
it "should return a formatted date when date is present" do
|
15
|
-
date = "2013-08-14".to_time
|
16
|
-
expect(datepicker_field_value(date)).to eq("2013/08/14")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "#admin_layout" do
|
21
|
-
subject { admin_layout(value) }
|
22
|
-
|
23
|
-
context "when no initial value has been set" do
|
24
|
-
context "and an argument is sent" do
|
25
|
-
let(:value) { "full-width" }
|
26
|
-
it { is_expected.to eq "full-width" }
|
27
|
-
end
|
28
|
-
|
29
|
-
context "and no argument is sent" do
|
30
|
-
let(:value) { nil }
|
31
|
-
it { is_expected.to be_nil }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "when an initial value is set" do
|
36
|
-
before { admin_layout("full-width") }
|
37
|
-
|
38
|
-
context "and it is called again without an argument" do
|
39
|
-
let(:value) { nil }
|
40
|
-
it { is_expected.to eq "full-width" }
|
41
|
-
end
|
42
|
-
|
43
|
-
context "and it is called again with an argument" do
|
44
|
-
let(:value) { "centered" }
|
45
|
-
it { is_expected.to eq "centered" }
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,139 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Spree::Admin::NavigationHelper, type: :helper do
|
6
|
-
describe "#tab" do
|
7
|
-
context "creating an admin tab" do
|
8
|
-
it "should capitalize the first letter of each word in the tab's label" do
|
9
|
-
admin_tab = helper.tab(:orders)
|
10
|
-
expect(admin_tab).to include("Orders")
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "selection" do
|
15
|
-
context "when match_path option is not supplied" do
|
16
|
-
subject(:tab) { helper.tab(:orders) }
|
17
|
-
|
18
|
-
it "should be selected if the controller matches" do
|
19
|
-
allow(controller).to receive(:controller_name).and_return("orders")
|
20
|
-
expect(subject).to include('class="selected"')
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should not be selected if the controller does not match" do
|
24
|
-
allow(controller).to receive(:controller_name).and_return("bonobos")
|
25
|
-
expect(subject).not_to include('class="selected"')
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should be selected if the current path" do
|
29
|
-
allow(helper).to receive(:request).and_return(double(ActionDispatch::Request, fullpath: "/admin/orders"))
|
30
|
-
expect(subject).to include('class="selected"')
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should not be selected if not current path" do
|
34
|
-
allow(helper).to receive(:request).and_return(double(ActionDispatch::Request, fullpath: "/admin/products"))
|
35
|
-
expect(subject).not_to include('class="selected"')
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
context "when match_path option is supplied" do
|
40
|
-
before do
|
41
|
-
allow(helper).to receive(:request).and_return(double(ActionDispatch::Request, fullpath: "/admin/orders/edit/1"))
|
42
|
-
end
|
43
|
-
|
44
|
-
it "should be selected if the fullpath matches" do
|
45
|
-
allow(controller).to receive(:controller_name).and_return("bonobos")
|
46
|
-
tab = helper.tab(:orders, match_path: '/orders')
|
47
|
-
expect(tab).to include('class="selected"')
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should be selected if the fullpath matches a regular expression" do
|
51
|
-
allow(controller).to receive(:controller_name).and_return("bonobos")
|
52
|
-
tab = helper.tab(:orders, match_path: /orders$|orders\//)
|
53
|
-
expect(tab).to include('class="selected"')
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should not be selected if the fullpath does not match" do
|
57
|
-
allow(controller).to receive(:controller_name).and_return("bonobos")
|
58
|
-
tab = helper.tab(:orders, match_path: '/shady')
|
59
|
-
expect(tab).not_to include('class="selected"')
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should not be selected if the fullpath does not match a regular expression" do
|
63
|
-
allow(controller).to receive(:controller_name).and_return("bonobos")
|
64
|
-
tab = helper.tab(:orders, match_path: /shady$|shady\//)
|
65
|
-
expect(tab).not_to include('class="selected"')
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should accept a block of content to append" do
|
71
|
-
admin_tab = helper.tab(:orders){ 'foo' }
|
72
|
-
expect(admin_tab).to end_with("foo</li>")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe "#link_to_delete" do
|
77
|
-
let!(:item) { create(:stock_item) }
|
78
|
-
let(:options) { {} }
|
79
|
-
let(:link) { subject }
|
80
|
-
|
81
|
-
subject { helper.link_to_delete(item, options) }
|
82
|
-
|
83
|
-
# object_url is provided by the ResourceController abstract controller.
|
84
|
-
# as we cannot set a custom controller for helper tests, we need to fake it
|
85
|
-
before do
|
86
|
-
without_partial_double_verification do
|
87
|
-
allow(helper).to receive(:object_url) do |o|
|
88
|
-
"/stock_items/#{o.to_param}"
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
it "generates a deletion link for the resource" do
|
94
|
-
expect(link).to include("href=\"/stock_items/#{item.to_param}\"")
|
95
|
-
expect(link).to include("data-action=\"remove\"")
|
96
|
-
expect(link).to include("data-confirm=\"Are you sure?\"")
|
97
|
-
expect(link).to include("<span class=\"text\">Delete</span>")
|
98
|
-
end
|
99
|
-
|
100
|
-
it "allows customization of the url" do
|
101
|
-
options[:url] = "/test/url"
|
102
|
-
expect(link).to include("href=\"/test/url\"")
|
103
|
-
end
|
104
|
-
|
105
|
-
it "allows customization of the link name" do
|
106
|
-
options[:name] = "Delete Item"
|
107
|
-
expect(link).to include("name=\"Delete Item\"")
|
108
|
-
expect(link).to include("<span class=\"text\">Delete Item</span>")
|
109
|
-
end
|
110
|
-
|
111
|
-
it "allows customization of the confirmation message" do
|
112
|
-
options[:confirm] = "Please confirm."
|
113
|
-
expect(link).to include("data-confirm=\"Please confirm.\"")
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
describe "#solidus_icon" do
|
118
|
-
context "if given an icon_name" do
|
119
|
-
subject(:solidus_icon) { helper.solidus_icon('example-icon-name') }
|
120
|
-
|
121
|
-
it { is_expected.to eq "<i class=\"example-icon-name\"></i>" }
|
122
|
-
end
|
123
|
-
|
124
|
-
context "if not given nil icon_name" do
|
125
|
-
subject(:solidus_icon) { helper.solidus_icon(nil) }
|
126
|
-
|
127
|
-
it { is_expected.to eq "" }
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
describe "#icon" do
|
132
|
-
subject(:icon) { helper.icon('icon-name') }
|
133
|
-
|
134
|
-
it "is a deprecated way to use #solidus_icon" do
|
135
|
-
expect(Spree::Deprecation).to receive(:warn).with("icon is deprecated and will be removed from Solidus 3.0 (use solidus_icon instead)", instance_of(Array))
|
136
|
-
expect(subject).to eq helper.solidus_icon('icon-name')
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Spree::Admin::StockMovementsHelper, type: :helper do
|
6
|
-
describe "#pretty_originator" do
|
7
|
-
let!(:stock_location) { create(:stock_location_with_items) }
|
8
|
-
let!(:stock_item) { stock_location.stock_items.first }
|
9
|
-
let(:stock_movement) { create(:stock_movement, stock_item: stock_item, originator: originator) }
|
10
|
-
|
11
|
-
subject { helper.pretty_originator(stock_movement) }
|
12
|
-
|
13
|
-
context "originator has a number" do
|
14
|
-
let(:originator) { create(:order) }
|
15
|
-
|
16
|
-
it "returns the originator's number" do
|
17
|
-
expect(subject).to eq originator.number
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context "originator doesn't have a number" do
|
22
|
-
let(:originator) { create(:user) }
|
23
|
-
|
24
|
-
it "returns an empty string" do
|
25
|
-
expect(subject).to eq ""
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Spree::Admin::StoreCreditEventsHelper, type: :helper do
|
6
|
-
describe "#store_credit_event_admin_action_name" do
|
7
|
-
let(:store_credit_event) { create(:store_credit_event, action: action) }
|
8
|
-
|
9
|
-
subject { store_credit_event_admin_action_name(store_credit_event) }
|
10
|
-
|
11
|
-
context "capture event" do
|
12
|
-
let(:action) { Spree::StoreCredit::CAPTURE_ACTION }
|
13
|
-
|
14
|
-
it "returns the action's display text" do
|
15
|
-
expect(subject).to eq "Used"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
context "authorize event" do
|
20
|
-
let(:action) { Spree::StoreCredit::AUTHORIZE_ACTION }
|
21
|
-
|
22
|
-
it "returns the action's display text" do
|
23
|
-
expect(subject).to eq "Authorized"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "eligible event" do
|
28
|
-
let(:action) { Spree::StoreCredit::ELIGIBLE_ACTION }
|
29
|
-
|
30
|
-
it "returns the action's display text" do
|
31
|
-
expect(subject).to eq "Eligibility Verified"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context "allocation event" do
|
36
|
-
let(:action) { Spree::StoreCredit::ALLOCATION_ACTION }
|
37
|
-
|
38
|
-
it "returns the action's display text" do
|
39
|
-
expect(subject).to eq "Added"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "void event" do
|
44
|
-
let(:action) { Spree::StoreCredit::VOID_ACTION }
|
45
|
-
|
46
|
-
it "returns the action's display text" do
|
47
|
-
expect(subject).to eq "Voided"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context "credit event" do
|
52
|
-
let(:action) { Spree::StoreCredit::CREDIT_ACTION }
|
53
|
-
|
54
|
-
it "returns the action's display text" do
|
55
|
-
expect(subject).to eq "Credit"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "#store_credit_event_originator_link" do
|
61
|
-
let(:store_credit_event) { create(:store_credit_adjustment_event, originator: originator) }
|
62
|
-
|
63
|
-
subject { store_credit_event_originator_link(store_credit_event) }
|
64
|
-
|
65
|
-
context "originator is a user" do
|
66
|
-
let(:originator) { create(:user) }
|
67
|
-
|
68
|
-
it "returns a link to the user's edit page" do
|
69
|
-
expect(subject).to eq %(<a target=\"_blank\" href=\"/admin/users/#{originator.id}/edit\">User - #{originator.email}</a>)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "originator is a payment" do
|
74
|
-
let(:originator) { create(:payment) }
|
75
|
-
|
76
|
-
it "returns a link to the order's payments page" do
|
77
|
-
expect(subject).to eq %(<a target=\"_blank\" href=\"/admin/orders/#{originator.order.number}/payments/#{originator.id}\">Payment - Order ##{originator.order.number}</a>)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
context "originator is a refund" do
|
82
|
-
let(:originator) { create(:refund, amount: 1.0) }
|
83
|
-
|
84
|
-
it "returns a link to the order's payments page" do
|
85
|
-
expect(subject).to eq %(<a target=\"_blank\" href=\"/admin/orders/#{originator.payment.order.number}/payments\">Refund - Order ##{originator.payment.order.number}</a>)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context "originator is not specifically handled" do
|
90
|
-
let(:originator) { create(:store_credit) }
|
91
|
-
|
92
|
-
it "raises an error" do
|
93
|
-
expect { subject }.to raise_error(RuntimeError, "Unexpected originator type Spree::StoreCredit")
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
module Spree
|
5
|
-
describe Spree::PromotionRulesHelper, type: :helper do
|
6
|
-
it "does not include existing rules in options" do
|
7
|
-
promotion = Spree::Promotion.new
|
8
|
-
promotion.promotion_rules << Spree::Promotion::Rules::ItemTotal.new
|
9
|
-
|
10
|
-
options = helper.options_for_promotion_rule_types(promotion)
|
11
|
-
expect(options).not_to match(/ItemTotal/)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<%= javascript_include_tag *@suite.spec_assets, debug: @suite.config.expand_assets, allow_non_precompiled: true %>
|
2
|
-
<%= render "spree/admin/shared/js_locale_data" %>
|
3
|
-
<%= javascript_tag do -%>
|
4
|
-
Spree.env = "<%= Rails.env %>";
|
5
|
-
<% end %>
|
6
|
-
<script type="text/javascript">
|
7
|
-
Teaspoon.onWindowLoad(Teaspoon.execute);
|
8
|
-
</script>
|
@@ -1,48 +0,0 @@
|
|
1
|
-
describe('Spree.formatMoney', function() {
|
2
|
-
it('can format USD', function() {
|
3
|
-
expect(Spree.formatMoney(10, 'USD')).to.equal('$10.00');
|
4
|
-
expect(Spree.formatMoney('10', 'USD')).to.equal('$10.00');
|
5
|
-
expect(Spree.formatMoney(12.34, 'USD')).to.equal('$12.34');
|
6
|
-
expect(Spree.formatMoney('12.34', 'USD')).to.equal('$12.34');
|
7
|
-
expect(Spree.formatMoney(1000, 'USD')).to.equal('$1,000.00');
|
8
|
-
});
|
9
|
-
|
10
|
-
it('can format CAD', function() {
|
11
|
-
expect(Spree.formatMoney(1000, 'CAD')).to.equal('$1,000.00');
|
12
|
-
});
|
13
|
-
|
14
|
-
it('can format GBP', function() {
|
15
|
-
expect(Spree.formatMoney(1000, 'GBP')).to.equal('£1,000.00');
|
16
|
-
});
|
17
|
-
|
18
|
-
it('can format EUR', function() {
|
19
|
-
expect(Spree.formatMoney(1000, 'EUR')).to.equal('€1,000.00');
|
20
|
-
});
|
21
|
-
|
22
|
-
it('can format YEN', function() {
|
23
|
-
expect(Spree.formatMoney(1000, 'JPY')).to.equal('¥1,000');
|
24
|
-
});
|
25
|
-
|
26
|
-
describe('with comma as decimal', function() {
|
27
|
-
support.withTranslations({
|
28
|
-
currency_delimiter: ".",
|
29
|
-
currency_separator: ","
|
30
|
-
});
|
31
|
-
|
32
|
-
it('can format USD', function() {
|
33
|
-
expect(Spree.formatMoney(10, 'USD')).to.equal('$10,00');
|
34
|
-
expect(Spree.formatMoney('10', 'USD')).to.equal('$10,00');
|
35
|
-
expect(Spree.formatMoney(12.34, 'USD')).to.equal('$12,34');
|
36
|
-
expect(Spree.formatMoney('12.34', 'USD')).to.equal('$12,34');
|
37
|
-
expect(Spree.formatMoney(1000, 'GBP')).to.equal('£1.000,00');
|
38
|
-
});
|
39
|
-
|
40
|
-
it('can format EUR', function() {
|
41
|
-
expect(Spree.formatMoney(1000, 'EUR')).to.equal('€1.000,00');
|
42
|
-
});
|
43
|
-
|
44
|
-
it('can format YEN', function() {
|
45
|
-
expect(Spree.formatMoney(1000, 'JPY')).to.equal('¥1.000');
|
46
|
-
});
|
47
|
-
});
|
48
|
-
});
|
@@ -1,13 +0,0 @@
|
|
1
|
-
//= require ./support/show_errors
|
2
|
-
//= require support/sinon
|
3
|
-
//= require support/chai
|
4
|
-
//= require support/chai-jq-0.0.7
|
5
|
-
|
6
|
-
//= require_self
|
7
|
-
//= require jquery
|
8
|
-
//= require rails-ujs
|
9
|
-
//= require spree/backend
|
10
|
-
//= require_tree ./support
|
11
|
-
|
12
|
-
window.support = {};
|
13
|
-
window.expect = chai.expect;
|
@@ -1,58 +0,0 @@
|
|
1
|
-
describe('Spree.t', function() {
|
2
|
-
support.withTranslations({
|
3
|
-
simple: "simple",
|
4
|
-
nested: {
|
5
|
-
key: "nested key"
|
6
|
-
},
|
7
|
-
deeply: {
|
8
|
-
nested: {
|
9
|
-
key: "deeply nested key"
|
10
|
-
}
|
11
|
-
}
|
12
|
-
})
|
13
|
-
|
14
|
-
it('can get a simple key', function() {
|
15
|
-
expect(Spree.t('simple')).to.equal('simple');
|
16
|
-
});
|
17
|
-
|
18
|
-
it('can get a nested key', function() {
|
19
|
-
expect(Spree.t('nested.key')).to.equal('nested key');
|
20
|
-
});
|
21
|
-
|
22
|
-
it('can get a nested key using scope', function() {
|
23
|
-
expect(Spree.t('key', {scope: 'nested'})).to.equal('nested key');
|
24
|
-
});
|
25
|
-
|
26
|
-
it('can get a deeply nested key', function() {
|
27
|
-
expect(Spree.t('deeply.nested.key')).to.equal('deeply nested key');
|
28
|
-
});
|
29
|
-
|
30
|
-
it('can get a deeply nested key using scope', function() {
|
31
|
-
expect(Spree.t('nested.key', {scope: 'deeply'})).to.equal('deeply nested key');
|
32
|
-
expect(Spree.t('key', {scope: 'deeply.nested'})).to.equal('deeply nested key');
|
33
|
-
});
|
34
|
-
|
35
|
-
it('ignores default when key exists', function() {
|
36
|
-
expect(Spree.t('simple', {default: 'foo'})).to.equal('simple');
|
37
|
-
});
|
38
|
-
|
39
|
-
it('returns a default for a missing key', function() {
|
40
|
-
expect(Spree.t('does_not_exist', {default: 'foo'})).to.equal('foo');
|
41
|
-
});
|
42
|
-
});
|
43
|
-
|
44
|
-
describe('Spree.human_attribute_name', function() {
|
45
|
-
support.withTranslations({
|
46
|
-
activerecord: {
|
47
|
-
attributes: {
|
48
|
-
"spree/model": {
|
49
|
-
"name": "Name"
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
});
|
54
|
-
|
55
|
-
it('can get attribute names', function() {
|
56
|
-
expect(Spree.human_attribute_name('spree/model', "name")).to.equal('Name');
|
57
|
-
});
|
58
|
-
});
|