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
@@ -97,7 +97,7 @@ describe Spree::Money do
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
# Regression test for
|
100
|
+
# Regression test for https://github.com/spree/spree/issues/2634
|
101
101
|
it "formats as plain by default" do
|
102
102
|
money = Spree::Money.new(10, symbol_position: :after)
|
103
103
|
expect(money.to_s).to eq("10.00 €")
|
@@ -8,7 +8,7 @@ describe Spree::CartonMailer do
|
|
8
8
|
let(:carton) { create(:carton) }
|
9
9
|
let(:order) { carton.orders.first }
|
10
10
|
|
11
|
-
# Regression test for
|
11
|
+
# Regression test for https://github.com/spree/spree/issues/2196
|
12
12
|
it "doesn't include out of stock in the email body" do
|
13
13
|
shipment_email = Spree::CartonMailer.shipped_email(order: order, carton: carton)
|
14
14
|
expect(shipment_email.body).not_to include(%Q{Out of Stock})
|
@@ -74,7 +74,7 @@ describe Spree::OrderMailer, :type => :mailer do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
context "displays unit costs from line item" do
|
77
|
-
# Regression test for
|
77
|
+
# Regression test for https://github.com/spree/spree/issues/2772
|
78
78
|
|
79
79
|
# Tests mailer view spree/order_mailer/confirm_email.text.erb
|
80
80
|
specify do
|
@@ -10,9 +10,7 @@ describe Spree::ReimbursementMailer, :type => :mailer do
|
|
10
10
|
it "accepts a reimbursement id as an alternative to a Reimbursement object" do
|
11
11
|
expect(Spree::Reimbursement).to receive(:find).with(reimbursement.id).and_return(reimbursement)
|
12
12
|
|
13
|
-
|
14
|
-
Spree::ReimbursementMailer.reimbursement_email(reimbursement.id).body
|
15
|
-
}.not_to raise_error
|
13
|
+
Spree::ReimbursementMailer.reimbursement_email(reimbursement.id).body
|
16
14
|
end
|
17
15
|
|
18
16
|
context "emails must be translatable" do
|
@@ -8,8 +8,6 @@ describe Spree::TestMailer, :type => :mailer do
|
|
8
8
|
let(:user) { create(:user) }
|
9
9
|
|
10
10
|
it "confirm_email accepts a user id as an alternative to a User object" do
|
11
|
-
|
12
|
-
test_email = Spree::TestMailer.test_email('test@example.com')
|
13
|
-
}.not_to raise_error
|
11
|
+
Spree::TestMailer.test_email('test@example.com')
|
14
12
|
end
|
15
13
|
end
|
@@ -175,7 +175,7 @@ describe Spree::Address, :type => :model do
|
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
|
-
# Regression test for
|
178
|
+
# Regression test for https://github.com/spree/spree/issues/1142
|
179
179
|
it "uses the first available country if :default_country_id is set to an invalid value" do
|
180
180
|
Spree::Config[:default_country_id] = "0"
|
181
181
|
expect(Spree::Address.build_default.country).to eq default_country
|
@@ -277,14 +277,14 @@ describe Spree::Address, :type => :model do
|
|
277
277
|
let(:base_attributes) do
|
278
278
|
{
|
279
279
|
'id' => 1,
|
280
|
-
'created_at' => Time.
|
281
|
-
'updated_at' => Time.
|
280
|
+
'created_at' => Time.current,
|
281
|
+
'updated_at' => Time.current,
|
282
282
|
'address1' => '1234 way',
|
283
283
|
}
|
284
284
|
end
|
285
285
|
let(:merge_attributes) do
|
286
286
|
{
|
287
|
-
'updated_at' => Time.
|
287
|
+
'updated_at' => Time.current,
|
288
288
|
'address2' => 'apt 2',
|
289
289
|
}
|
290
290
|
end
|
@@ -12,17 +12,17 @@ describe Spree::Calculator::PriceSack, :type => :model do
|
|
12
12
|
let(:order) { stub_model(Spree::Order) }
|
13
13
|
let(:shipment) { stub_model(Spree::Shipment, :amount => 10) }
|
14
14
|
|
15
|
-
# Regression test for
|
15
|
+
# Regression test for https://github.com/spree/spree/issues/714 and https://github.com/spree/spree/issues/739
|
16
16
|
it "computes with an order object" do
|
17
17
|
calculator.compute(order)
|
18
18
|
end
|
19
19
|
|
20
|
-
# Regression test for
|
20
|
+
# Regression test for https://github.com/spree/spree/issues/1156
|
21
21
|
it "computes with a shipment object" do
|
22
22
|
calculator.compute(shipment)
|
23
23
|
end
|
24
24
|
|
25
|
-
# Regression test for
|
25
|
+
# Regression test for https://github.com/spree/spree/issues/2055
|
26
26
|
it "computes the correct amount" do
|
27
27
|
expect(calculator.compute(2)).to eq(calculator.preferred_normal_amount)
|
28
28
|
expect(calculator.compute(6)).to eq(calculator.preferred_discount_amount)
|
@@ -12,17 +12,17 @@ describe Spree::Calculator::PriceSack, :type => :model do
|
|
12
12
|
let(:order) { stub_model(Spree::Order) }
|
13
13
|
let(:shipment) { stub_model(Spree::Shipment, :amount => 10) }
|
14
14
|
|
15
|
-
# Regression test for
|
15
|
+
# Regression test for https://github.com/spree/spree/issues/714 and https://github.com/spree/spree/issues/739
|
16
16
|
it "computes with an order object" do
|
17
17
|
calculator.compute(order)
|
18
18
|
end
|
19
19
|
|
20
|
-
# Regression test for
|
20
|
+
# Regression test for https://github.com/spree/spree/issues/1156
|
21
21
|
it "computes with a shipment object" do
|
22
22
|
calculator.compute(shipment)
|
23
23
|
end
|
24
24
|
|
25
|
-
# Regression test for
|
25
|
+
# Regression test for https://github.com/spree/spree/issues/2055
|
26
26
|
it "computes the correct amount" do
|
27
27
|
expect(calculator.compute(2)).to eq(calculator.preferred_normal_amount)
|
28
28
|
expect(calculator.compute(6)).to eq(calculator.preferred_discount_amount)
|
@@ -26,22 +26,98 @@ describe Spree::Calculator::TieredPercent, :type => :model do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "#compute" do
|
29
|
-
let(:
|
29
|
+
let(:order) { create(:order_with_line_items, line_items_count: line_item_count, line_items_price: price) }
|
30
|
+
let(:price) { 10 }
|
31
|
+
|
30
32
|
before do
|
31
33
|
calculator.preferred_base_percent = 10
|
32
34
|
calculator.preferred_tiers = {
|
33
|
-
|
34
|
-
|
35
|
+
20 => 15,
|
36
|
+
30 => 20
|
35
37
|
}
|
36
38
|
end
|
37
|
-
|
38
|
-
context "
|
39
|
-
let(:
|
40
|
-
|
39
|
+
|
40
|
+
context "with a line item" do
|
41
|
+
let(:line_item) { order.line_items.first }
|
42
|
+
subject { calculator.compute(line_item) }
|
43
|
+
|
44
|
+
context "for multiple line items" do
|
45
|
+
context "when amount falls within the first tier" do
|
46
|
+
let(:line_item_count) { 1 }
|
47
|
+
it { is_expected.to eq 1.0 }
|
48
|
+
end
|
49
|
+
|
50
|
+
context "when amount falls within the second tier" do
|
51
|
+
let(:line_item_count) { 2 }
|
52
|
+
it { is_expected.to eq 1.5 }
|
53
|
+
end
|
54
|
+
|
55
|
+
context "when amount falls within the third tier" do
|
56
|
+
let(:line_item_count) { 3 }
|
57
|
+
it { is_expected.to eq 2.0 }
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "for a single line item" do
|
62
|
+
let(:line_item_count) { 1 }
|
63
|
+
|
64
|
+
context "when amount falls within the first tier" do
|
65
|
+
let(:price) { 10 }
|
66
|
+
it { is_expected.to eq 1.0 }
|
67
|
+
end
|
68
|
+
|
69
|
+
context "when amount falls within the second tier" do
|
70
|
+
let(:price) { 20 }
|
71
|
+
it { is_expected.to eq 3.0 }
|
72
|
+
end
|
73
|
+
|
74
|
+
context "when amount falls within the third tier" do
|
75
|
+
let(:price) { 30 }
|
76
|
+
it { is_expected.to eq 6.0 }
|
77
|
+
end
|
78
|
+
end
|
41
79
|
end
|
42
|
-
|
43
|
-
|
44
|
-
|
80
|
+
|
81
|
+
context "with an order" do
|
82
|
+
subject { calculator.compute(order) }
|
83
|
+
|
84
|
+
let(:line_item_count) { 1 }
|
85
|
+
|
86
|
+
context "for multiple line items" do
|
87
|
+
context "when amount falls within the first tier" do
|
88
|
+
let(:line_item_count) { 1 }
|
89
|
+
it { is_expected.to eq 1.0 }
|
90
|
+
end
|
91
|
+
|
92
|
+
context "when amount falls within the second tier" do
|
93
|
+
let(:line_item_count) { 2 }
|
94
|
+
it { is_expected.to eq 3.0 }
|
95
|
+
end
|
96
|
+
|
97
|
+
context "when amount falls within the third tier" do
|
98
|
+
let(:line_item_count) { 3 }
|
99
|
+
it { is_expected.to eq 6.0 }
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
context "for a single line item" do
|
104
|
+
let(:line_item_count) { 1 }
|
105
|
+
|
106
|
+
context "when amount falls within the first tier" do
|
107
|
+
let(:price) { 10 }
|
108
|
+
it { is_expected.to eq 1.0 }
|
109
|
+
end
|
110
|
+
|
111
|
+
context "when amount falls within the second tier" do
|
112
|
+
let(:price) { 20 }
|
113
|
+
it { is_expected.to eq 3.0 }
|
114
|
+
end
|
115
|
+
|
116
|
+
context "when amount falls within the third tier" do
|
117
|
+
let(:price) { 30 }
|
118
|
+
it { is_expected.to eq 6.0 }
|
119
|
+
end
|
120
|
+
end
|
45
121
|
end
|
46
122
|
end
|
47
123
|
end
|
@@ -2,12 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Spree
|
4
4
|
describe Classification, :type => :model do
|
5
|
-
# Regression test for
|
5
|
+
# Regression test for https://github.com/spree/spree/issues/3494
|
6
6
|
it "cannot link the same taxon to the same product more than once" do
|
7
7
|
product = create(:product)
|
8
8
|
taxon = create(:taxon)
|
9
9
|
add_taxon = lambda { product.taxons << taxon }
|
10
|
-
|
10
|
+
add_taxon.call
|
11
11
|
expect(add_taxon).to raise_error(ActiveRecord::RecordInvalid)
|
12
12
|
end
|
13
13
|
|
@@ -90,4 +90,4 @@ module Spree
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
93
|
-
end
|
93
|
+
end
|
@@ -5,7 +5,7 @@ describe Spree::CreditCard, type: :model do
|
|
5
5
|
{
|
6
6
|
number: '4111111111111111',
|
7
7
|
verification_value: '123',
|
8
|
-
expiry: "12 / #{(Time.
|
8
|
+
expiry: "12 / #{(Time.current.year + 1).to_s.last(2)}",
|
9
9
|
name: 'Spree Commerce'
|
10
10
|
}
|
11
11
|
end
|
@@ -38,12 +38,12 @@ describe Spree::CreditCard, type: :model do
|
|
38
38
|
|
39
39
|
context "#can_capture?" do
|
40
40
|
it "should be true if payment is pending" do
|
41
|
-
payment = mock_model(Spree::Payment, pending?: true, created_at: Time.
|
41
|
+
payment = mock_model(Spree::Payment, pending?: true, created_at: Time.current)
|
42
42
|
expect(credit_card.can_capture?(payment)).to be true
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should be true if payment is checkout" do
|
46
|
-
payment = mock_model(Spree::Payment, pending?: false, checkout?: true, created_at: Time.
|
46
|
+
payment = mock_model(Spree::Payment, pending?: false, checkout?: true, created_at: Time.current)
|
47
47
|
expect(credit_card.can_capture?(payment)).to be true
|
48
48
|
end
|
49
49
|
end
|
@@ -154,7 +154,7 @@ describe Spree::CreditCard, type: :model do
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
# Regression test for
|
157
|
+
# Regression test for https://github.com/spree/spree/issues/3847 and https://github.com/spree/spree/issues/3896
|
158
158
|
context "#expiry=" do
|
159
159
|
it "can set with a 2-digit month and year" do
|
160
160
|
credit_card.expiry = '04 / 15'
|
@@ -193,12 +193,12 @@ describe Spree::CreditCard, type: :model do
|
|
193
193
|
end
|
194
194
|
|
195
195
|
it "does not blow up when passed an empty string" do
|
196
|
-
|
196
|
+
credit_card.expiry = ''
|
197
197
|
end
|
198
198
|
|
199
|
-
# Regression test for
|
199
|
+
# Regression test for https://github.com/spree/spree/issues/4725
|
200
200
|
it "does not blow up when passed one number" do
|
201
|
-
|
201
|
+
credit_card.expiry = '12'
|
202
202
|
end
|
203
203
|
|
204
204
|
end
|
@@ -254,7 +254,7 @@ describe Spree::CreditCard, type: :model do
|
|
254
254
|
|
255
255
|
context "#associations" do
|
256
256
|
it "should be able to access its payments" do
|
257
|
-
|
257
|
+
credit_card.payments.to_a
|
258
258
|
end
|
259
259
|
end
|
260
260
|
|
@@ -281,8 +281,8 @@ describe Spree::CreditCard, type: :model do
|
|
281
281
|
context "#to_active_merchant" do
|
282
282
|
before do
|
283
283
|
credit_card.number = "4111111111111111"
|
284
|
-
credit_card.year = Time.
|
285
|
-
credit_card.month = Time.
|
284
|
+
credit_card.year = Time.current.year
|
285
|
+
credit_card.month = Time.current.month
|
286
286
|
credit_card.name = "Ludwig van Beethoven"
|
287
287
|
credit_card.verification_value = 123
|
288
288
|
end
|
@@ -290,8 +290,8 @@ describe Spree::CreditCard, type: :model do
|
|
290
290
|
it "converts to an ActiveMerchant::Billing::CreditCard object" do
|
291
291
|
am_card = credit_card.to_active_merchant
|
292
292
|
expect(am_card.number).to eq("4111111111111111")
|
293
|
-
expect(am_card.year).to eq(Time.
|
294
|
-
expect(am_card.month).to eq(Time.
|
293
|
+
expect(am_card.year).to eq(Time.current.year)
|
294
|
+
expect(am_card.month).to eq(Time.current.month)
|
295
295
|
expect(am_card.first_name).to eq("Ludwig")
|
296
296
|
expect(am_card.last_name).to eq("van Beethoven")
|
297
297
|
expect(am_card.verification_value).to eq(123)
|
@@ -325,17 +325,17 @@ describe Spree::CreditCard, type: :model do
|
|
325
325
|
user = FactoryGirl.create(:user)
|
326
326
|
first = FactoryGirl.create(:credit_card, user: user, default: true)
|
327
327
|
second = FactoryGirl.create(:credit_card, user: user, default: false)
|
328
|
-
first.update_columns(year: DateTime.
|
328
|
+
first.update_columns(year: DateTime.current.year, month: 1.month.ago.month)
|
329
329
|
|
330
|
-
|
330
|
+
second.update_attributes!(default: true)
|
331
331
|
end
|
332
332
|
|
333
333
|
it 'allows this card to save even if the previously default card has expired' do
|
334
334
|
user = FactoryGirl.create(:user)
|
335
335
|
first = FactoryGirl.create(:credit_card, user: user, default: true)
|
336
336
|
second = FactoryGirl.create(:credit_card, user: user, default: false)
|
337
|
-
first.update_columns(year: DateTime.
|
337
|
+
first.update_columns(year: DateTime.current.year, month: 1.month.ago.month)
|
338
338
|
|
339
|
-
|
339
|
+
second.update_attributes!(default: true)
|
340
340
|
end
|
341
341
|
end
|
@@ -202,7 +202,7 @@ describe Spree::CustomerReturn, :type => :model do
|
|
202
202
|
|
203
203
|
it "should NOT raise an error when no stock item exists in the stock location" do
|
204
204
|
inventory_unit.find_stock_item.destroy
|
205
|
-
|
205
|
+
create(:customer_return_without_return_items, return_items: [return_item], stock_location_id: new_stock_location.id)
|
206
206
|
end
|
207
207
|
|
208
208
|
it "should not update the stock item counts in the original stock location" do
|
@@ -4,7 +4,7 @@ describe Spree::Gateway::BogusSimple, :type => :model do
|
|
4
4
|
|
5
5
|
subject { Spree::Gateway::BogusSimple.new }
|
6
6
|
|
7
|
-
# regression test for
|
7
|
+
# regression test for https://github.com/spree/spree/issues/3824
|
8
8
|
describe "#capture" do
|
9
9
|
it "returns success with the right response code" do
|
10
10
|
response = subject.capture(123, '12345', {})
|
@@ -8,7 +8,7 @@ describe Spree::InventoryUnit, :type => :model do
|
|
8
8
|
context "#backordered_for_stock_item" do
|
9
9
|
let(:order) do
|
10
10
|
order = create(:order, state: 'complete', ship_address: create(:ship_address))
|
11
|
-
order.completed_at = Time.
|
11
|
+
order.completed_at = Time.current
|
12
12
|
create(:shipment, order: order, stock_location: stock_location)
|
13
13
|
order.shipments.reload
|
14
14
|
create(:line_item, order: order, variant: stock_item.variant)
|
@@ -37,10 +37,10 @@ describe Spree::InventoryUnit, :type => :model do
|
|
37
37
|
stock_item.set_count_on_hand(-2)
|
38
38
|
end
|
39
39
|
|
40
|
-
# Regression for
|
40
|
+
# Regression for https://github.com/spree/spree/issues/3066
|
41
41
|
it "returns modifiable objects" do
|
42
42
|
units = Spree::InventoryUnit.backordered_for_stock_item(stock_item)
|
43
|
-
|
43
|
+
units.first.save!
|
44
44
|
end
|
45
45
|
|
46
46
|
it "finds inventory units from its stock location when the unit's variant matches the stock item's variant" do
|
@@ -253,7 +253,7 @@ module Spree
|
|
253
253
|
promo_c.update_column(:eligible, false)
|
254
254
|
end
|
255
255
|
|
256
|
-
# regression for
|
256
|
+
# regression for https://github.com/spree/spree/issues/3274
|
257
257
|
it "still makes the previous best eligible adjustment valid" do
|
258
258
|
subject.update
|
259
259
|
expect(line_item.adjustments.promotion.eligible.first.label).to eq('Promotion A')
|
@@ -89,7 +89,7 @@ describe Spree::LineItem, :type => :model do
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
# Test for
|
92
|
+
# Test for https://github.com/spree/spree/issues/3391
|
93
93
|
context '#copy_price' do
|
94
94
|
it "copies over a variant's prices" do
|
95
95
|
line_item.price = nil
|
@@ -103,7 +103,7 @@ describe Spree::LineItem, :type => :model do
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
-
# Test for
|
106
|
+
# Test for https://github.com/spree/spree/issues/3481
|
107
107
|
context '#copy_tax_category' do
|
108
108
|
it "copies over a variant's tax category" do
|
109
109
|
line_item.tax_category = nil
|