solidus_core 1.1.4 → 1.2.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of solidus_core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/images/logo/solidus_logo.png +0 -0
- data/app/helpers/spree/base_helper.rb +2 -3
- data/app/models/concerns/spree/adjustment_source.rb +1 -1
- data/app/models/concerns/spree/default_price.rb +3 -1
- data/app/models/concerns/spree/named_type.rb +1 -1
- data/app/models/concerns/spree/user_methods.rb +10 -0
- data/app/models/spree/adjustment.rb +1 -1
- data/app/models/spree/adjustment_reason.rb +2 -4
- data/app/models/spree/app_configuration.rb +36 -0
- data/app/models/spree/base.rb +10 -1
- data/app/models/spree/calculator/tiered_percent.rb +2 -1
- data/app/models/spree/classification.rb +1 -1
- data/app/models/spree/country.rb +3 -3
- data/app/models/spree/credit_card.rb +2 -2
- data/app/models/spree/customer_return.rb +3 -4
- data/app/models/spree/inventory_unit.rb +13 -24
- data/app/models/spree/item_adjustments.rb +5 -5
- data/app/models/spree/line_item.rb +6 -15
- data/app/models/spree/log_entry.rb +1 -1
- data/app/models/spree/option_type.rb +4 -2
- data/app/models/spree/option_type_prototype.rb +6 -0
- data/app/models/spree/option_value.rb +1 -1
- data/app/models/spree/order.rb +18 -63
- data/app/models/spree/order/checkout.rb +4 -2
- data/app/models/spree/order_cancellations.rb +52 -1
- data/app/models/spree/order_contents.rb +1 -1
- data/app/models/spree/order_merger.rb +143 -0
- data/app/models/spree/order_shipping.rb +3 -3
- data/app/models/spree/order_update_attributes.rb +42 -0
- data/app/models/spree/order_updater.rb +1 -1
- data/app/models/spree/payment.rb +16 -10
- data/app/models/spree/payment_create.rb +68 -0
- data/app/models/spree/payment_method.rb +0 -1
- data/app/models/spree/preference.rb +1 -1
- data/app/models/spree/price.rb +1 -8
- data/app/models/spree/product.rb +9 -44
- data/app/models/spree/product/scopes.rb +9 -7
- data/app/models/spree/promotion/rules/nth_order.rb +1 -1
- data/app/models/spree/promotion/rules/taxon.rb +2 -1
- data/app/models/spree/promotion_chooser.rb +1 -0
- data/app/models/spree/promotion_code.rb +1 -1
- data/app/models/spree/promotion_rule_taxon.rb +6 -0
- data/app/models/spree/property.rb +2 -1
- data/app/models/spree/property_prototype.rb +6 -0
- data/app/models/spree/prototype.rb +6 -2
- data/app/models/spree/reimbursement.rb +10 -0
- data/app/models/spree/return_item/eligibility_validator/time_since_purchase.rb +1 -1
- data/app/models/spree/return_reason.rb +1 -7
- data/app/models/spree/role_user.rb +3 -5
- data/app/models/spree/shipment.rb +6 -11
- data/app/models/spree/shipping_method.rb +1 -7
- data/app/models/spree/shipping_rate.rb +3 -14
- data/app/models/spree/stock/coordinator.rb +48 -4
- data/app/models/spree/stock/estimator.rb +3 -6
- data/app/models/spree/stock/packer.rb +18 -2
- data/app/models/spree/stock/shipping_rate_selector.rb +16 -0
- data/app/models/spree/stock/shipping_rate_sorter.rb +16 -0
- data/app/models/spree/stock_item.rb +19 -15
- data/app/models/spree/stock_location.rb +2 -12
- data/app/models/spree/stock_transfer.rb +3 -3
- data/app/models/spree/store_credit.rb +2 -2
- data/app/models/spree/tax_category.rb +3 -2
- data/app/models/spree/tax_rate.rb +7 -14
- data/app/models/spree/taxon.rb +4 -1
- data/app/models/spree/taxonomy.rb +1 -1
- data/app/models/spree/transfer_item.rb +2 -2
- data/app/models/spree/unit_cancel.rb +2 -0
- data/app/models/spree/variant.rb +9 -14
- data/app/models/spree/zone.rb +6 -0
- data/app/models/spree/zone_member.rb +1 -4
- data/app/views/spree/order_mailer/cancel_email.text.erb +0 -0
- data/config/locales/en.yml +7 -5
- data/db/default/spree/countries.rb +1 -1
- data/db/default/spree/zones.rb +5 -11
- data/db/migrate/20130213191427_create_default_stock.rb +1 -1
- data/db/migrate/20130306181701_add_address_fields_to_stock_location.rb +1 -1
- data/db/migrate/20140309033438_create_store_from_preferences.rb +5 -2
- data/db/migrate/20141009204607_add_store_id_to_orders.rb +6 -2
- data/db/migrate/20141215235502_remove_extra_products_slug_index.rb +5 -0
- data/db/migrate/20141217215630_update_product_slug_index.rb +6 -0
- data/db/migrate/20150225205344_move_promotion_code_to_promotion_code_value.rb +2 -2
- data/db/migrate/20150609093816_increase_scale_on_pre_tax_amounts.rb +10 -0
- data/db/migrate/20151117063249_convert_habtm_to_hmt_for_properties_prototypes.rb +17 -0
- data/db/migrate/20151124062500_convert_habtm_to_hmt_for_option_type_prototypes.rb +17 -0
- data/db/migrate/20151126063028_convert_habtm_to_hmt_for_taxons_promotion_rules.rb +15 -0
- data/db/migrate/20151219020209_add_stock_item_unique_index.rb +9 -0
- data/lib/generators/spree/dummy/dummy_generator.rb +1 -1
- data/lib/generators/spree/dummy/templates/rails/database.yml +1 -1
- data/lib/generators/spree/install/templates/config/initializers/spree.rb +25 -1
- data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/backend/all.js +3 -0
- data/lib/generators/spree/install/templates/vendor/assets/javascripts/spree/frontend/all.js +3 -0
- data/lib/generators/spree/install/templates/vendor/assets/stylesheets/spree/backend/all.css +3 -0
- data/lib/generators/spree/install/templates/vendor/assets/stylesheets/spree/frontend/all.css +3 -0
- data/lib/spree/core/controller_helpers/common.rb +1 -1
- data/lib/spree/core/controller_helpers/order.rb +1 -1
- data/lib/spree/core/controller_helpers/payment_parameters.rb +104 -5
- data/lib/spree/core/engine.rb +3 -2
- data/lib/spree/core/stock_configuration.rb +11 -0
- data/lib/spree/core/unreturned_item_charger.rb +4 -4
- data/lib/spree/core/version.rb +9 -1
- data/lib/spree/permission_sets/restricted_stock_transfer_management.rb +15 -24
- data/lib/spree/permitted_attributes.rb +3 -1
- data/lib/spree/testing_support/capybara_ext.rb +14 -40
- data/lib/spree/testing_support/factories.rb +0 -15
- data/lib/spree/testing_support/factories/address_factory.rb +3 -0
- data/lib/spree/testing_support/factories/adjustment_factory.rb +9 -1
- data/lib/spree/testing_support/factories/carton_factory.rb +4 -1
- data/lib/spree/testing_support/factories/customer_return_factory.rb +4 -0
- data/lib/spree/testing_support/factories/inventory_unit_factory.rb +5 -0
- data/lib/spree/testing_support/factories/line_item_factory.rb +3 -0
- data/lib/spree/testing_support/factories/option_type_factory.rb +6 -0
- data/lib/spree/testing_support/factories/{options_factory.rb → option_value_factory.rb} +0 -5
- data/lib/spree/testing_support/factories/order_factory.rb +13 -3
- data/lib/spree/testing_support/factories/order_promotion_factory.rb +3 -0
- data/lib/spree/testing_support/factories/payment_factory.rb +13 -5
- data/lib/spree/testing_support/factories/price_factory.rb +2 -0
- data/lib/spree/testing_support/factories/product_factory.rb +7 -1
- data/lib/spree/testing_support/factories/product_option_type_factory.rb +3 -0
- data/lib/spree/testing_support/factories/product_property_factory.rb +3 -0
- data/lib/spree/testing_support/factories/promotion_code_factory.rb +3 -0
- data/lib/spree/testing_support/factories/promotion_factory.rb +3 -0
- data/lib/spree/testing_support/factories/prototype_factory.rb +2 -0
- data/lib/spree/testing_support/factories/refund_factory.rb +10 -5
- data/lib/spree/testing_support/factories/refund_reason_factory.rb +5 -0
- data/lib/spree/testing_support/factories/reimbursement_factory.rb +2 -0
- data/lib/spree/testing_support/factories/return_authorization_factory.rb +4 -4
- data/lib/spree/testing_support/factories/return_item_factory.rb +4 -0
- data/lib/spree/testing_support/factories/return_reason_factory.rb +5 -0
- data/lib/spree/testing_support/factories/shipment_factory.rb +6 -1
- data/lib/spree/testing_support/factories/shipping_method_factory.rb +22 -10
- data/lib/spree/testing_support/factories/shipping_rate_factory.rb +9 -0
- data/lib/spree/testing_support/factories/state_factory.rb +2 -0
- data/lib/spree/testing_support/factories/stock_item_factory.rb +4 -1
- data/lib/spree/testing_support/factories/stock_location_factory.rb +8 -0
- data/lib/spree/testing_support/factories/stock_movement_factory.rb +2 -0
- data/lib/spree/testing_support/factories/{stock_factory.rb → stock_package_factory.rb} +5 -10
- data/lib/spree/testing_support/factories/stock_packer_factory.rb +13 -0
- data/lib/spree/testing_support/factories/stock_transfer_factory.rb +2 -2
- data/lib/spree/testing_support/factories/store_credit_event_factory.rb +4 -1
- data/lib/spree/testing_support/factories/store_credit_factory.rb +10 -6
- data/lib/spree/testing_support/factories/tax_category_factory.rb +2 -0
- data/lib/spree/testing_support/factories/tax_rate_factory.rb +4 -0
- data/lib/spree/testing_support/factories/taxon_factory.rb +2 -0
- data/lib/spree/testing_support/factories/user_factory.rb +6 -2
- data/lib/spree/testing_support/factories/variant_factory.rb +5 -0
- data/lib/spree/testing_support/factories/variant_property_rule_condition_factory.rb +3 -0
- data/lib/spree/testing_support/factories/variant_property_rule_factory.rb +4 -0
- data/lib/spree/testing_support/factories/variant_property_rule_value_factory.rb +3 -0
- data/lib/spree/testing_support/factories/zone_factory.rb +6 -0
- data/lib/spree/testing_support/sequences.rb +9 -0
- data/lib/tasks/exchanges.rake +4 -3
- data/lib/tasks/migrations/copy_shipped_shipments_to_cartons.rake +2 -2
- data/solidus_core.gemspec +4 -5
- data/spec/helpers/base_helper_spec.rb +6 -6
- data/spec/helpers/order_helper_spec.rb +1 -1
- data/spec/helpers/products_helper_spec.rb +2 -2
- data/spec/helpers/taxons_helper_spec.rb +1 -1
- data/spec/lib/spree/core/controller_helpers/payment_parameters_spec.rb +107 -7
- data/spec/lib/spree/core/importer/order_spec.rb +1 -1
- data/spec/lib/spree/core/stock_configuration_spec.rb +16 -0
- data/spec/lib/spree/core/testing_support/factories/address_factory_spec.rb +24 -0
- data/spec/lib/spree/core/testing_support/factories/adjustment_factory_spec.rb +18 -0
- data/spec/lib/spree/core/testing_support/factories/adjustment_reason_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/calculator_factory_spec.rb +42 -0
- data/spec/lib/spree/core/testing_support/factories/carton_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/country_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/credit_card_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb +28 -0
- data/spec/lib/spree/core/testing_support/factories/image_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/inventory_unit_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/line_item_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/option_type_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/option_value_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/order_factory_spec.rb +49 -0
- data/spec/lib/spree/core/testing_support/factories/order_promotion_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/payment_factory_spec.rb +24 -0
- data/spec/lib/spree/core/testing_support/factories/payment_method_factory_spec.rb +30 -0
- data/spec/lib/spree/core/testing_support/factories/price_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/product_factory_spec.rb +30 -0
- data/spec/lib/spree/core/testing_support/factories/product_option_type_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/product_property_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/promotion_category_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/promotion_code_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/promotion_factory_spec.rb +30 -0
- data/spec/lib/spree/core/testing_support/factories/property_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/prototype_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/refund_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/refund_reason_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/reimbursement_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/reimbursement_type_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/return_authorization_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/return_item_factory_spec.rb +18 -0
- data/spec/lib/spree/core/testing_support/factories/return_reason_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/role_factory_spec.rb +18 -0
- data/spec/lib/spree/core/testing_support/factories/shipment_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/shipping_category_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/shipping_method_factory_spec.rb +28 -0
- data/spec/lib/spree/core/testing_support/factories/shipping_rate_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/state_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/stock_item_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/stock_location_factory_spec.rb +24 -0
- data/spec/lib/spree/core/testing_support/factories/stock_movement_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/stock_package_factory_spec.rb +26 -0
- data/spec/lib/spree/core/testing_support/factories/stock_packer_factory_spec.rb +16 -0
- data/spec/lib/spree/core/testing_support/factories/stock_transfer_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_category_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_event_factory_spec.rb +42 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_type_factory_spec.rb +18 -0
- data/spec/lib/spree/core/testing_support/factories/store_credit_update_reason_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/store_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/tax_category_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/tax_rate_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/taxon_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/taxonomy_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/tracker_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/user_factory_spec.rb +22 -0
- data/spec/lib/spree/core/testing_support/factories/variant_factory_spec.rb +36 -0
- data/spec/lib/spree/core/testing_support/factories/variant_property_rule_condition_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/variant_property_rule_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/variant_property_rule_value_factory_spec.rb +12 -0
- data/spec/lib/spree/core/testing_support/factories/zone_factory_spec.rb +18 -0
- data/spec/lib/spree/core/unreturned_item_charger_spec.rb +1 -1
- data/spec/lib/spree/core/version_spec.rb +17 -0
- data/spec/lib/spree/money_spec.rb +1 -1
- data/spec/mailers/carton_mailer_spec.rb +1 -1
- data/spec/mailers/order_mailer_spec.rb +1 -1
- data/spec/mailers/reimbursement_mailer_spec.rb +1 -3
- data/spec/mailers/test_mailer_spec.rb +1 -3
- data/spec/models/spree/address_spec.rb +4 -4
- data/spec/models/spree/adjustment_reason_spec.rb +1 -3
- data/spec/models/spree/app_configuration_spec.rb +4 -0
- data/spec/models/spree/calculator/price_sack_spec.rb +3 -3
- data/spec/models/spree/calculator/shipping/price_sack_spec.rb +3 -3
- data/spec/models/spree/calculator/tiered_percent_spec.rb +86 -10
- data/spec/models/spree/carton_spec.rb +3 -1
- data/spec/models/spree/classification_spec.rb +3 -3
- data/spec/models/spree/credit_card_spec.rb +16 -16
- data/spec/models/spree/customer_return_spec.rb +1 -1
- data/spec/models/spree/gateway/bogus_simple.rb +1 -1
- data/spec/models/spree/inventory_unit_spec.rb +3 -3
- data/spec/models/spree/item_adjustments_spec.rb +1 -1
- data/spec/models/spree/line_item_spec.rb +2 -2
- data/spec/models/spree/option_type_spec.rb +2 -2
- data/spec/models/spree/option_value_spec.rb +2 -2
- data/spec/models/spree/order/callbacks_spec.rb +1 -1
- data/spec/models/spree/order/checkout_spec.rb +16 -11
- data/spec/models/spree/order/payment_spec.rb +24 -22
- data/spec/models/spree/order/state_machine_spec.rb +1 -1
- data/spec/models/spree/order/validations_spec.rb +1 -1
- data/spec/models/spree/order_cancellations_spec.rb +63 -0
- data/spec/models/spree/order_contents_spec.rb +1 -1
- data/spec/models/spree/order_merger_spec.rb +133 -0
- data/spec/models/spree/order_spec.rb +39 -159
- data/spec/models/spree/order_update_attributes_spec.rb +82 -0
- data/spec/models/spree/order_updater_spec.rb +6 -4
- data/spec/models/spree/payment_create_spec.rb +131 -0
- data/spec/models/spree/payment_spec.rb +130 -48
- data/spec/models/spree/permission_sets/restricted_stock_transfer_management_spec.rb +91 -33
- data/spec/models/spree/product_filter_spec.rb +3 -3
- data/spec/models/spree/product_spec.rb +80 -26
- data/spec/models/spree/promotion/actions/create_adjustment_spec.rb +1 -1
- data/spec/models/spree/promotion/actions/create_item_adjustments_spec.rb +2 -2
- data/spec/models/spree/promotion/rules/nth_order_spec.rb +1 -1
- data/spec/models/spree/promotion/rules/user_spec.rb +2 -2
- data/spec/models/spree/promotion_handler/coupon_spec.rb +2 -2
- data/spec/models/spree/promotion_spec.rb +18 -18
- data/spec/models/spree/reimbursement_spec.rb +22 -0
- data/spec/models/spree/return_item_spec.rb +2 -2
- data/spec/models/spree/shipment_spec.rb +28 -12
- data/spec/models/spree/shipping_method_spec.rb +2 -2
- data/spec/models/spree/shipping_rate_spec.rb +3 -3
- data/spec/models/spree/stock/coordinator_spec.rb +5 -0
- data/spec/models/spree/stock/estimator_spec.rb +35 -1
- data/spec/models/spree/stock/package_spec.rb +1 -1
- data/spec/models/spree/stock/packer_spec.rb +2 -3
- data/spec/models/spree/stock/shipping_rate_selector_spec.rb +16 -0
- data/spec/models/spree/stock/shipping_rate_sorter_spec.rb +16 -0
- data/spec/models/spree/stock_item_spec.rb +5 -7
- data/spec/models/spree/stock_location_spec.rb +5 -9
- data/spec/models/spree/stock_transfer_spec.rb +33 -13
- data/spec/models/spree/store_credit_event_spec.rb +1 -1
- data/spec/models/spree/store_credit_spec.rb +1 -1
- data/spec/models/spree/tax_rate_spec.rb +381 -120
- data/spec/models/spree/taxon_spec.rb +3 -3
- data/spec/models/spree/transfer_item_spec.rb +4 -4
- data/spec/models/spree/unit_cancel_spec.rb +1 -1
- data/spec/models/spree/variant_spec.rb +3 -3
- data/spec/models/spree/zone_spec.rb +35 -1
- data/spec/support/concerns/working_factories.rb +9 -0
- data/vendor/assets/javascripts/jquery-migrate-1.0.0.js +498 -0
- data/vendor/assets/javascripts/jquery.payment.js +231 -80
- metadata +103 -27
- data/app/models/spree/order/currency_updater.rb +0 -40
- data/spec/models/spree/order/currency_updater_spec.rb +0 -32
@@ -58,22 +58,70 @@ describe Spree::PermissionSets::RestrictedStockTransferManagement do
|
|
58
58
|
it { is_expected.to be_able_to(:transfer_from, source_location) }
|
59
59
|
it { is_expected.to be_able_to(:transfer_to, source_location) }
|
60
60
|
|
61
|
-
it { is_expected.
|
62
|
-
it { is_expected.
|
61
|
+
it { is_expected.to_not be_able_to(:transfer_from, destination_location) }
|
62
|
+
it { is_expected.to_not be_able_to(:transfer_to, destination_location) }
|
63
63
|
|
64
64
|
it { is_expected.to be_able_to(:display, transfer_with_source) }
|
65
65
|
it { is_expected.to be_able_to(:display, transfer_with_source_and_destination) }
|
66
|
-
it { is_expected.
|
66
|
+
it { is_expected.to_not be_able_to(:display, transfer_with_destination) }
|
67
67
|
|
68
68
|
it { is_expected.to be_able_to(:manage, transfer_with_source) }
|
69
|
-
it { is_expected.
|
70
|
-
it { is_expected.
|
69
|
+
it { is_expected.to be_able_to(:manage, transfer_with_source_and_destination) }
|
70
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_destination) }
|
71
71
|
|
72
72
|
it { is_expected.to be_able_to(:manage, source_transfer_item) }
|
73
|
-
it { is_expected.
|
74
|
-
it { is_expected.
|
73
|
+
it { is_expected.to be_able_to(:manage, source_and_destination_transfer_item) }
|
74
|
+
it { is_expected.to_not be_able_to(:manage, destination_transfer_item) }
|
75
|
+
|
76
|
+
context "stock transfer has been shipped" do
|
77
|
+
before do
|
78
|
+
transfer_with_source_and_destination.update_attributes!(shipped_at: Time.current)
|
79
|
+
described_class.new(ability).activate!
|
80
|
+
end
|
81
|
+
|
82
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_source_and_destination) }
|
83
|
+
it { is_expected.to_not be_able_to(:manage, source_and_destination_transfer_item) }
|
84
|
+
end
|
75
85
|
end
|
76
86
|
|
87
|
+
context "when the user is only associated with the destination location" do
|
88
|
+
let(:stock_locations) {[destination_location]}
|
89
|
+
|
90
|
+
it { is_expected.to be_able_to(:display, destination_location) }
|
91
|
+
it { is_expected.to_not be_able_to(:display, source_location) }
|
92
|
+
|
93
|
+
it { is_expected.to be_able_to(:display, Spree::StockTransfer) }
|
94
|
+
it { is_expected.to be_able_to(:admin, Spree::StockTransfer) }
|
95
|
+
it { is_expected.to be_able_to(:create, Spree::StockTransfer) }
|
96
|
+
|
97
|
+
it { is_expected.to_not be_able_to(:transfer_from, source_location) }
|
98
|
+
it { is_expected.to_not be_able_to(:transfer_to, source_location) }
|
99
|
+
|
100
|
+
it { is_expected.to be_able_to(:transfer_from, destination_location) }
|
101
|
+
it { is_expected.to be_able_to(:transfer_to, destination_location) }
|
102
|
+
|
103
|
+
it { is_expected.to be_able_to(:display, transfer_with_destination) }
|
104
|
+
it { is_expected.to_not be_able_to(:display, transfer_with_source) }
|
105
|
+
it { is_expected.to_not be_able_to(:display, transfer_with_source_and_destination) }
|
106
|
+
|
107
|
+
it { is_expected.to be_able_to(:manage, transfer_with_destination) }
|
108
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_source) }
|
109
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_source_and_destination) }
|
110
|
+
|
111
|
+
it { is_expected.to be_able_to(:manage, destination_transfer_item) }
|
112
|
+
it { is_expected.to_not be_able_to(:manage, source_transfer_item) }
|
113
|
+
it { is_expected.to_not be_able_to(:manage, source_and_destination_transfer_item) }
|
114
|
+
|
115
|
+
context "stock transfer has been shipped" do
|
116
|
+
before do
|
117
|
+
transfer_with_source_and_destination.update_attributes!(shipped_at: Time.current)
|
118
|
+
described_class.new(ability).activate!
|
119
|
+
end
|
120
|
+
|
121
|
+
it { is_expected.to be_able_to(:manage, transfer_with_source_and_destination) }
|
122
|
+
it { is_expected.to be_able_to(:manage, source_and_destination_transfer_item) }
|
123
|
+
end
|
124
|
+
end
|
77
125
|
|
78
126
|
context "when the user is associated with both locations" do
|
79
127
|
let(:stock_locations) {[source_location, destination_location]}
|
@@ -102,6 +150,16 @@ describe Spree::PermissionSets::RestrictedStockTransferManagement do
|
|
102
150
|
it { is_expected.to be_able_to(:manage, source_transfer_item) }
|
103
151
|
it { is_expected.to be_able_to(:manage, destination_transfer_item) }
|
104
152
|
it { is_expected.to be_able_to(:manage, source_and_destination_transfer_item) }
|
153
|
+
|
154
|
+
context "stock transfer has been shipped" do
|
155
|
+
before do
|
156
|
+
transfer_with_source_and_destination.update_attributes!(shipped_at: Time.current)
|
157
|
+
described_class.new(ability).activate!
|
158
|
+
end
|
159
|
+
|
160
|
+
it { is_expected.to be_able_to(:manage, transfer_with_source_and_destination) }
|
161
|
+
it { is_expected.to be_able_to(:manage, source_and_destination_transfer_item) }
|
162
|
+
end
|
105
163
|
end
|
106
164
|
|
107
165
|
context "when the user is associated with neither location" do
|
@@ -110,51 +168,51 @@ describe Spree::PermissionSets::RestrictedStockTransferManagement do
|
|
110
168
|
it { is_expected.to_not be_able_to(:display, source_location) }
|
111
169
|
it { is_expected.to_not be_able_to(:display, destination_location) }
|
112
170
|
|
113
|
-
it { is_expected.
|
114
|
-
it { is_expected.
|
115
|
-
it { is_expected.
|
171
|
+
it { is_expected.to_not be_able_to(:display, Spree::StockTransfer) }
|
172
|
+
it { is_expected.to_not be_able_to(:admin, Spree::StockTransfer) }
|
173
|
+
it { is_expected.to_not be_able_to(:create, Spree::StockTransfer) }
|
116
174
|
|
117
|
-
it { is_expected.
|
118
|
-
it { is_expected.
|
175
|
+
it { is_expected.to_not be_able_to(:transfer_from, source_location) }
|
176
|
+
it { is_expected.to_not be_able_to(:transfer_to, source_location) }
|
119
177
|
|
120
|
-
it { is_expected.
|
121
|
-
it { is_expected.
|
178
|
+
it { is_expected.to_not be_able_to(:transfer_from, destination_location) }
|
179
|
+
it { is_expected.to_not be_able_to(:transfer_to, destination_location) }
|
122
180
|
|
123
|
-
it { is_expected.
|
124
|
-
it { is_expected.
|
125
|
-
it { is_expected.
|
181
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_source) }
|
182
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_destination) }
|
183
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_source_and_destination) }
|
126
184
|
|
127
|
-
it { is_expected.
|
128
|
-
it { is_expected.
|
129
|
-
it { is_expected.
|
185
|
+
it { is_expected.to_not be_able_to(:manage, source_transfer_item) }
|
186
|
+
it { is_expected.to_not be_able_to(:manage, destination_transfer_item) }
|
187
|
+
it { is_expected.to_not be_able_to(:manage, source_and_destination_transfer_item) }
|
130
188
|
end
|
131
189
|
end
|
132
190
|
|
133
191
|
context "when not activated" do
|
134
192
|
let(:user) { create :user }
|
135
193
|
|
136
|
-
it { is_expected.
|
137
|
-
it { is_expected.
|
138
|
-
it { is_expected.
|
194
|
+
it { is_expected.to_not be_able_to(:display, Spree::StockTransfer) }
|
195
|
+
it { is_expected.to_not be_able_to(:admin, Spree::StockTransfer) }
|
196
|
+
it { is_expected.to_not be_able_to(:create, Spree::StockTransfer) }
|
139
197
|
|
140
198
|
it { is_expected.to_not be_able_to(:display, source_location) }
|
141
199
|
it { is_expected.to_not be_able_to(:display, destination_location) }
|
142
200
|
|
143
|
-
it { is_expected.
|
144
|
-
it { is_expected.
|
201
|
+
it { is_expected.to_not be_able_to(:transfer_from, source_location) }
|
202
|
+
it { is_expected.to_not be_able_to(:transfer_to, source_location) }
|
145
203
|
|
146
|
-
it { is_expected.
|
147
|
-
it { is_expected.
|
204
|
+
it { is_expected.to_not be_able_to(:transfer_from, destination_location) }
|
205
|
+
it { is_expected.to_not be_able_to(:transfer_to, destination_location) }
|
148
206
|
|
149
207
|
it { is_expected.to_not be_able_to(:display, source_location) }
|
150
208
|
it { is_expected.to_not be_able_to(:display, destination_location) }
|
151
209
|
|
152
|
-
it { is_expected.
|
153
|
-
it { is_expected.
|
154
|
-
it { is_expected.
|
210
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_source) }
|
211
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_destination) }
|
212
|
+
it { is_expected.to_not be_able_to(:manage, transfer_with_source_and_destination) }
|
155
213
|
|
156
|
-
it { is_expected.
|
157
|
-
it { is_expected.
|
158
|
-
it { is_expected.
|
214
|
+
it { is_expected.to_not be_able_to(:manage, source_transfer_item) }
|
215
|
+
it { is_expected.to_not be_able_to(:manage, destination_transfer_item) }
|
216
|
+
it { is_expected.to_not be_able_to(:manage, source_and_destination_transfer_item) }
|
159
217
|
end
|
160
218
|
end
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'spree/core/product_filters'
|
3
3
|
|
4
4
|
describe 'product filters', :type => :model do
|
5
|
-
# Regression test for
|
5
|
+
# Regression test for https://github.com/spree/spree/issues/1709
|
6
6
|
context 'finds products filtered by brand' do
|
7
7
|
let(:product) { create(:product) }
|
8
8
|
before do
|
@@ -11,7 +11,7 @@ describe 'product filters', :type => :model do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "does not attempt to call value method on Arel::Table" do
|
14
|
-
|
14
|
+
Spree::Core::ProductFilters.brand_filter
|
15
15
|
end
|
16
16
|
|
17
17
|
it "can find products in the 'Nike' brand" do
|
@@ -20,7 +20,7 @@ describe 'product filters', :type => :model do
|
|
20
20
|
it "sorts products without brand specified" do
|
21
21
|
product.set_property("brand", "Nike")
|
22
22
|
create(:product).set_property("brand", nil)
|
23
|
-
|
23
|
+
Spree::Core::ProductFilters.brand_filter[:labels]
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -38,16 +38,58 @@ describe Spree::Product, :type => :model do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
describe "#save" do
|
42
|
+
before { product.update_columns(updated_at: 1.day.ago) }
|
43
|
+
subject { product.save! }
|
44
|
+
|
45
|
+
shared_examples "a change occurred" do
|
46
|
+
it "should change updated_at" do
|
47
|
+
expect { subject }.to change{ product.updated_at }
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should touch taxons" do
|
51
|
+
taxon = create(:taxon, products: [product])
|
52
|
+
taxon.update_columns(updated_at: 1.day.ago)
|
53
|
+
product.taxons.reload
|
54
|
+
expect { subject }.to change{ taxon.reload.updated_at }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
shared_examples "no change occurred" do
|
59
|
+
it "should not change updated_at" do
|
60
|
+
expect { subject }.not_to change{ product.updated_at }
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should not touch taxons" do
|
64
|
+
taxon = create(:taxon, products: [product])
|
65
|
+
taxon.update_columns(updated_at: 1.day.ago)
|
66
|
+
product.taxons.reload
|
67
|
+
expect { subject }.not_to change{ taxon.reload.updated_at }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "when nothing has changed" do
|
72
|
+
it_behaves_like "no change occurred"
|
73
|
+
end
|
74
|
+
|
75
|
+
context "when the product itself was changed" do
|
76
|
+
before do
|
77
|
+
product.name = "Perri-air"
|
78
|
+
end
|
79
|
+
|
80
|
+
it_behaves_like "a change occurred"
|
81
|
+
end
|
42
82
|
|
43
83
|
context "when master variant changed" do
|
44
84
|
before do
|
45
85
|
product.master.sku = "Something changed"
|
46
86
|
end
|
47
87
|
|
88
|
+
it_behaves_like "a change occurred"
|
89
|
+
|
48
90
|
it "saves the master" do
|
49
|
-
|
50
|
-
product.
|
91
|
+
product.save!
|
92
|
+
expect(product.reload.master.sku).to eq "Something changed"
|
51
93
|
end
|
52
94
|
end
|
53
95
|
|
@@ -59,21 +101,11 @@ describe Spree::Product, :type => :model do
|
|
59
101
|
product.master.default_price.price = 12
|
60
102
|
end
|
61
103
|
|
62
|
-
|
63
|
-
expect(product.master).to receive(:save!)
|
64
|
-
product.save
|
65
|
-
end
|
104
|
+
it_behaves_like "a change occurred"
|
66
105
|
|
67
|
-
it "saves the
|
68
|
-
|
69
|
-
product.
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "when master variant and price haven't changed" do
|
74
|
-
it "does not save the master" do
|
75
|
-
expect(product.master).not_to receive(:save!)
|
76
|
-
product.save
|
106
|
+
it "saves the default_price" do
|
107
|
+
product.save!
|
108
|
+
expect(product.reload.master.default_price.price).to eq 12
|
77
109
|
end
|
78
110
|
end
|
79
111
|
end
|
@@ -103,7 +135,7 @@ describe Spree::Product, :type => :model do
|
|
103
135
|
end
|
104
136
|
|
105
137
|
context "#price" do
|
106
|
-
# Regression test for
|
138
|
+
# Regression test for https://github.com/spree/spree/issues/1173
|
107
139
|
it 'strips non-price characters' do
|
108
140
|
product.price = "$10"
|
109
141
|
expect(product.price).to eq(10.0)
|
@@ -232,11 +264,11 @@ describe Spree::Product, :type => :model do
|
|
232
264
|
|
233
265
|
it "doesnt raise ReadOnlyRecord error" do
|
234
266
|
Spree::StockMovement.create!(stock_item: stock_item, quantity: 1)
|
235
|
-
|
267
|
+
product.destroy
|
236
268
|
end
|
237
269
|
end
|
238
270
|
|
239
|
-
# Regression test for
|
271
|
+
# Regression test for https://github.com/spree/spree/issues/3737
|
240
272
|
context "has stock items" do
|
241
273
|
let(:product) { create(:product) }
|
242
274
|
it "can retrieve stock items" do
|
@@ -328,7 +360,7 @@ describe Spree::Product, :type => :model do
|
|
328
360
|
}.to change { product.properties.length }.by(1)
|
329
361
|
end
|
330
362
|
|
331
|
-
# Regression test for
|
363
|
+
# Regression test for https://github.com/spree/spree/issues/2455
|
332
364
|
it "should not overwrite properties' presentation names" do
|
333
365
|
Spree::Property.where(:name => 'foo').first_or_create!(:presentation => "Foo's Presentation Name")
|
334
366
|
product.set_property('foo', 'value1')
|
@@ -337,7 +369,7 @@ describe Spree::Product, :type => :model do
|
|
337
369
|
expect(Spree::Property.where(:name => 'bar').first.presentation).to eq("bar")
|
338
370
|
end
|
339
371
|
|
340
|
-
# Regression test for
|
372
|
+
# Regression test for https://github.com/spree/spree/issues/4416
|
341
373
|
context "#possible_promotions" do
|
342
374
|
let!(:promotion) do
|
343
375
|
create(:promotion, advertise: true, starts_at: 1.day.ago)
|
@@ -450,7 +482,7 @@ describe Spree::Product, :type => :model do
|
|
450
482
|
end
|
451
483
|
end
|
452
484
|
|
453
|
-
# Regression tests for
|
485
|
+
# Regression tests for https://github.com/spree/spree/issues/2352
|
454
486
|
context "classifications and taxons" do
|
455
487
|
it "is joined through classifications" do
|
456
488
|
reflection = Spree::Product.reflect_on_association(:taxons)
|
@@ -497,8 +529,30 @@ describe Spree::Product, :type => :model do
|
|
497
529
|
it { is_expected.to be_invalid }
|
498
530
|
end
|
499
531
|
|
500
|
-
|
501
|
-
product
|
502
|
-
|
532
|
+
describe '.new' do
|
533
|
+
let(:product) { Spree::Product.new(attributes) }
|
534
|
+
|
535
|
+
shared_examples "new product with master" do
|
536
|
+
it "initializes master correctly" do
|
537
|
+
expect(product.master.is_master).to be true
|
538
|
+
expect(product.master.product).to be product
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
context 'no attributes' do
|
543
|
+
let(:attributes) { {} }
|
544
|
+
it_behaves_like "new product with master"
|
545
|
+
end
|
546
|
+
|
547
|
+
context 'initializing with variant attributes' do
|
548
|
+
let(:attributes) { {sku: 'FOO'} }
|
549
|
+
|
550
|
+
it_behaves_like "new product with master"
|
551
|
+
|
552
|
+
it "initializes the variant with the correct attributes" do
|
553
|
+
expect(product.master.sku).to eq 'FOO'
|
554
|
+
expect(product.sku).to eq 'FOO'
|
555
|
+
end
|
556
|
+
end
|
503
557
|
end
|
504
558
|
end
|
@@ -14,7 +14,7 @@ describe Spree::Promotion::Actions::CreateAdjustment, :type => :model do
|
|
14
14
|
allow(action).to receive_messages(:promotion => promotion)
|
15
15
|
end
|
16
16
|
|
17
|
-
# Regression test for
|
17
|
+
# Regression test for https://github.com/spree/spree/issues/3966
|
18
18
|
it "does not apply an adjustment if the amount is 0" do
|
19
19
|
action.calculator.preferred_amount = 0
|
20
20
|
action.perform(payload)
|
@@ -16,7 +16,7 @@ module Spree
|
|
16
16
|
end
|
17
17
|
|
18
18
|
context "#perform" do
|
19
|
-
# Regression test for
|
19
|
+
# Regression test for https://github.com/spree/spree/issues/3966
|
20
20
|
context "when calculator computes 0" do
|
21
21
|
before do
|
22
22
|
allow(action).to receive_messages :compute_amount => 0
|
@@ -143,7 +143,7 @@ module Spree
|
|
143
143
|
end
|
144
144
|
|
145
145
|
it "nullifies adjustments for completed orders" do
|
146
|
-
order = Order.create(completed_at: Time.
|
146
|
+
order = Order.create(completed_at: Time.current)
|
147
147
|
adjustment = action.adjustments.create!(label: "Check", amount: 0, order: order, adjustable: order)
|
148
148
|
|
149
149
|
expect {
|
@@ -47,7 +47,7 @@ describe Spree::Promotion::Rules::NthOrder do
|
|
47
47
|
|
48
48
|
context "when this order is completed and is still the 'nth' order" do
|
49
49
|
before do
|
50
|
-
order.update_attributes(completed_at: Time.
|
50
|
+
order.update_attributes(completed_at: Time.current)
|
51
51
|
end
|
52
52
|
|
53
53
|
it { is_expected.to be true }
|
@@ -27,11 +27,11 @@ describe Spree::Promotion::Rules::User, :type => :model do
|
|
27
27
|
expect(rule).not_to be_eligible(order)
|
28
28
|
end
|
29
29
|
|
30
|
-
# Regression test for
|
30
|
+
# Regression test for https://github.com/spree/spree/issues/3885
|
31
31
|
it "can assign to user_ids" do
|
32
32
|
user1 = Spree::LegacyUser.create!(:email => "test1@example.com")
|
33
33
|
user2 = Spree::LegacyUser.create!(:email => "test2@example.com")
|
34
|
-
|
34
|
+
rule.user_ids = "#{user1.id}, #{user2.id}"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -111,7 +111,7 @@ module Spree
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
-
# Regression test for
|
114
|
+
# Regression test for https://github.com/spree/spree/issues/4211
|
115
115
|
context "with incorrect coupon code casing" do
|
116
116
|
before { allow(order).to receive_messages :coupon_code => "10OFF" }
|
117
117
|
it "successfully activates promo" do
|
@@ -140,7 +140,7 @@ module Spree
|
|
140
140
|
order.contents.add create(:variant)
|
141
141
|
end
|
142
142
|
|
143
|
-
# regression spec for
|
143
|
+
# regression spec for https://github.com/spree/spree/issues/4515
|
144
144
|
it "successfully activates promo" do
|
145
145
|
subject.apply
|
146
146
|
expect(subject).to be_successful
|
@@ -104,7 +104,7 @@ describe Spree::Promotion, :type => :model do
|
|
104
104
|
promotion.created_at = 2.days.ago
|
105
105
|
|
106
106
|
@user = create(:user)
|
107
|
-
@order = create(:order, user: @user, created_at: DateTime.
|
107
|
+
@order = create(:order, user: @user, created_at: DateTime.current)
|
108
108
|
@payload = { :order => @order, :user => @user }
|
109
109
|
end
|
110
110
|
|
@@ -131,7 +131,7 @@ describe Spree::Promotion, :type => :model do
|
|
131
131
|
|
132
132
|
it "does activate if newer then order" do
|
133
133
|
expect(@action1).to receive(:perform).with(hash_including(@payload))
|
134
|
-
promotion.created_at = DateTime.
|
134
|
+
promotion.created_at = DateTime.current + 2
|
135
135
|
expect(promotion.activate(@payload)).to be true
|
136
136
|
end
|
137
137
|
|
@@ -301,28 +301,28 @@ describe Spree::Promotion, :type => :model do
|
|
301
301
|
end
|
302
302
|
|
303
303
|
it "should be expired if it hasn't started yet" do
|
304
|
-
promotion.starts_at = Time.
|
304
|
+
promotion.starts_at = Time.current + 1.day
|
305
305
|
expect(promotion).to be_expired
|
306
306
|
end
|
307
307
|
|
308
308
|
it "should be expired if it has already ended" do
|
309
|
-
promotion.expires_at = Time.
|
309
|
+
promotion.expires_at = Time.current - 1.day
|
310
310
|
expect(promotion).to be_expired
|
311
311
|
end
|
312
312
|
|
313
313
|
it "should not be expired if it has started already" do
|
314
|
-
promotion.starts_at = Time.
|
314
|
+
promotion.starts_at = Time.current - 1.day
|
315
315
|
expect(promotion).not_to be_expired
|
316
316
|
end
|
317
317
|
|
318
318
|
it "should not be expired if it has not ended yet" do
|
319
|
-
promotion.expires_at = Time.
|
319
|
+
promotion.expires_at = Time.current + 1.day
|
320
320
|
expect(promotion).not_to be_expired
|
321
321
|
end
|
322
322
|
|
323
323
|
it "should not be expired if current time is within starts_at and expires_at range" do
|
324
|
-
promotion.starts_at = Time.
|
325
|
-
promotion.expires_at = Time.
|
324
|
+
promotion.starts_at = Time.current - 1.day
|
325
|
+
promotion.expires_at = Time.current + 1.day
|
326
326
|
expect(promotion).not_to be_expired
|
327
327
|
end
|
328
328
|
end
|
@@ -333,28 +333,28 @@ describe Spree::Promotion, :type => :model do
|
|
333
333
|
end
|
334
334
|
|
335
335
|
it "should not be active if it hasn't started yet" do
|
336
|
-
promotion.starts_at = Time.
|
336
|
+
promotion.starts_at = Time.current + 1.day
|
337
337
|
expect(promotion.active?).to eq(false)
|
338
338
|
end
|
339
339
|
|
340
340
|
it "should not be active if it has already ended" do
|
341
|
-
promotion.expires_at = Time.
|
341
|
+
promotion.expires_at = Time.current - 1.day
|
342
342
|
expect(promotion.active?).to eq(false)
|
343
343
|
end
|
344
344
|
|
345
345
|
it "should be active if it has started already" do
|
346
|
-
promotion.starts_at = Time.
|
346
|
+
promotion.starts_at = Time.current - 1.day
|
347
347
|
expect(promotion.active?).to eq(true)
|
348
348
|
end
|
349
349
|
|
350
350
|
it "should be active if it has not ended yet" do
|
351
|
-
promotion.expires_at = Time.
|
351
|
+
promotion.expires_at = Time.current + 1.day
|
352
352
|
expect(promotion.active?).to eq(true)
|
353
353
|
end
|
354
354
|
|
355
355
|
it "should be active if current time is within starts_at and expires_at range" do
|
356
|
-
promotion.starts_at = Time.
|
357
|
-
promotion.expires_at = Time.
|
356
|
+
promotion.starts_at = Time.current - 1.day
|
357
|
+
promotion.expires_at = Time.current + 1.day
|
358
358
|
expect(promotion.active?).to eq(true)
|
359
359
|
end
|
360
360
|
|
@@ -399,7 +399,7 @@ describe Spree::Promotion, :type => :model do
|
|
399
399
|
expect(promotion.usage_count).to eq(0)
|
400
400
|
end
|
401
401
|
|
402
|
-
# Regression test for
|
402
|
+
# Regression test for https://github.com/spree/spree/issues/4112
|
403
403
|
it "does not count ineligible adjustments" do
|
404
404
|
adjustment.update_column(:eligible, false)
|
405
405
|
expect(promotion.usage_count).to eq(0)
|
@@ -440,7 +440,7 @@ describe Spree::Promotion, :type => :model do
|
|
440
440
|
it { is_expected.to be true }
|
441
441
|
|
442
442
|
context "when promotion is expired" do
|
443
|
-
before { promotion.expires_at = Time.
|
443
|
+
before { promotion.expires_at = Time.current - 10.days }
|
444
444
|
it { is_expected.to be false }
|
445
445
|
end
|
446
446
|
|
@@ -688,7 +688,7 @@ describe Spree::Promotion, :type => :model do
|
|
688
688
|
end
|
689
689
|
end
|
690
690
|
|
691
|
-
# regression for
|
691
|
+
# regression for https://github.com/spree/spree/issues/4059
|
692
692
|
# admin form posts the code and path as empty string
|
693
693
|
describe "normalize blank values for path" do
|
694
694
|
it "will save blank value as nil value instead" do
|
@@ -714,7 +714,7 @@ describe Spree::Promotion, :type => :model do
|
|
714
714
|
before do
|
715
715
|
promotion.activate(order: order)
|
716
716
|
order.update!
|
717
|
-
order.completed_at = Time.
|
717
|
+
order.completed_at = Time.current
|
718
718
|
order.save!
|
719
719
|
end
|
720
720
|
|