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
@@ -42,7 +42,7 @@ module Spree
|
|
42
42
|
let(:variant_price) { 15 }
|
43
43
|
|
44
44
|
it { is_expected.to eq("(Add: $5.00)") }
|
45
|
-
# Regression test for
|
45
|
+
# Regression test for https://github.com/spree/spree/issues/2737
|
46
46
|
it { is_expected.to be_html_safe }
|
47
47
|
end
|
48
48
|
|
@@ -119,7 +119,7 @@ module Spree
|
|
119
119
|
|
120
120
|
|
121
121
|
context "#product_description" do
|
122
|
-
# Regression test for
|
122
|
+
# Regression test for https://github.com/spree/spree/issues/1607
|
123
123
|
it "renders a product description without excessive paragraph breaks" do
|
124
124
|
product.description = %Q{
|
125
125
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus a ligula leo. Proin eu arcu at ipsum dapibus ullamcorper. Pellentesque egestas orci nec magna condimentum luctus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut ac ante et mauris bibendum ultricies non sed massa. Fusce facilisis dui eget lacus scelerisque eget aliquam urna ultricies. Duis et rhoncus quam. Praesent tellus nisi, ultrices sed iaculis quis, euismod interdum ipsum.</p>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Spree::TaxonsHelper, :type => :helper do
|
4
|
-
# Regression test for
|
4
|
+
# Regression test for https://github.com/spree/spree/issues/4382
|
5
5
|
it "#taxon_preview" do
|
6
6
|
taxon = create(:taxon)
|
7
7
|
child_taxon = create(:taxon, parent: taxon)
|
@@ -5,17 +5,13 @@ class FakeController < ApplicationController
|
|
5
5
|
end
|
6
6
|
|
7
7
|
describe Spree::Core::ControllerHelpers::PaymentParameters, type: :controller do
|
8
|
-
subject do
|
9
|
-
controller.move_payment_source_into_payments_attributes(params)
|
10
|
-
end
|
11
8
|
|
12
9
|
controller(FakeController) { }
|
13
10
|
|
14
11
|
describe '#move_payment_source_into_payments_attributes' do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
let(:credit_card_2_params) { attributes_for(:credit_card, name: 'Jordan2') }
|
12
|
+
subject do
|
13
|
+
controller.move_payment_source_into_payments_attributes(params)
|
14
|
+
end
|
19
15
|
|
20
16
|
let(:params) do
|
21
17
|
ActionController::Parameters.new(
|
@@ -35,6 +31,11 @@ describe Spree::Core::ControllerHelpers::PaymentParameters, type: :controller do
|
|
35
31
|
)
|
36
32
|
end
|
37
33
|
|
34
|
+
let(:payment_method_1) { create(:credit_card_payment_method) }
|
35
|
+
let(:payment_method_2) { create(:credit_card_payment_method) }
|
36
|
+
let(:credit_card_1_params) { attributes_for(:credit_card, name: 'Jordan1') }
|
37
|
+
let(:credit_card_2_params) { attributes_for(:credit_card, name: 'Jordan2') }
|
38
|
+
|
38
39
|
it 'produces the expected hash' do
|
39
40
|
expect(subject).to eq(
|
40
41
|
ActionController::Parameters.new(
|
@@ -77,4 +78,103 @@ describe Spree::Core::ControllerHelpers::PaymentParameters, type: :controller do
|
|
77
78
|
it('returns the original hash') { expect(subject).to eq(params) }
|
78
79
|
end
|
79
80
|
end
|
81
|
+
|
82
|
+
describe '#move_existing_card_into_payments_attributes' do
|
83
|
+
subject do
|
84
|
+
controller.move_existing_card_into_payments_attributes(params)
|
85
|
+
end
|
86
|
+
|
87
|
+
let(:params) do
|
88
|
+
ActionController::Parameters.new(
|
89
|
+
order: {
|
90
|
+
existing_card: '123',
|
91
|
+
other_order_param: 1,
|
92
|
+
},
|
93
|
+
cvc_confirm: '456',
|
94
|
+
other_param: 2,
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'produces the expected hash' do
|
99
|
+
expect(subject).to eq(
|
100
|
+
ActionController::Parameters.new(
|
101
|
+
order: {
|
102
|
+
payments_attributes: [
|
103
|
+
{
|
104
|
+
source_attributes: {
|
105
|
+
existing_card_id: '123',
|
106
|
+
verification_value: '456'
|
107
|
+
},
|
108
|
+
},
|
109
|
+
],
|
110
|
+
other_order_param: 1,
|
111
|
+
},
|
112
|
+
other_param: 2,
|
113
|
+
)
|
114
|
+
)
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'when cvc_confirm is missing' do
|
118
|
+
before { params.delete(:cvc_confirm) }
|
119
|
+
|
120
|
+
it 'produces the expected hash' do
|
121
|
+
expect(subject).to eq(
|
122
|
+
ActionController::Parameters.new(
|
123
|
+
order: {
|
124
|
+
payments_attributes: [
|
125
|
+
{
|
126
|
+
source_attributes: {
|
127
|
+
existing_card_id: '123',
|
128
|
+
verification_value: nil,
|
129
|
+
},
|
130
|
+
},
|
131
|
+
],
|
132
|
+
other_order_param: 1,
|
133
|
+
},
|
134
|
+
other_param: 2,
|
135
|
+
)
|
136
|
+
)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context 'when order params are missing' do
|
141
|
+
before { params.delete(:order) }
|
142
|
+
it('returns the original hash') { expect(subject).to eq(params) }
|
143
|
+
end
|
144
|
+
|
145
|
+
context 'when existing_card is missing' do
|
146
|
+
before { params[:order].delete(:existing_card) }
|
147
|
+
it('returns the original hash') { expect(subject).to eq(params) }
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
describe '#set_payment_parameters_amount' do
|
153
|
+
subject do
|
154
|
+
controller.set_payment_parameters_amount(params, order)
|
155
|
+
end
|
156
|
+
|
157
|
+
let(:params) do
|
158
|
+
ActionController::Parameters.new(
|
159
|
+
order: {
|
160
|
+
payments_attributes: [{}],
|
161
|
+
other_order_param: 1,
|
162
|
+
},
|
163
|
+
other_param: 2,
|
164
|
+
)
|
165
|
+
end
|
166
|
+
let(:order) { create(:order_with_line_items, line_items_price: 101.00, line_items_count: 1, shipment_cost: 0) }
|
167
|
+
|
168
|
+
it 'produces the expected hash' do
|
169
|
+
expect(subject).to eq(
|
170
|
+
ActionController::Parameters.new(
|
171
|
+
order: {
|
172
|
+
payments_attributes: [{amount: 101}],
|
173
|
+
other_order_param: 1,
|
174
|
+
},
|
175
|
+
other_param: 2,
|
176
|
+
)
|
177
|
+
)
|
178
|
+
end
|
179
|
+
end
|
80
180
|
end
|
@@ -46,7 +46,7 @@ module Spree
|
|
46
46
|
|
47
47
|
it 'optionally add completed at' do
|
48
48
|
params = { email: 'test@test.com',
|
49
|
-
completed_at: Time.
|
49
|
+
completed_at: Time.current,
|
50
50
|
line_items_attributes: line_items }
|
51
51
|
order = Importer::Order.import(user,params)
|
52
52
|
expect(order).to be_completed
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Spree::StockConfiguration do
|
4
|
+
before(:all) { @estimator_class = described_class.estimator_class.to_s }
|
5
|
+
after(:all) { described_class.estimator_class = @estimator_class }
|
6
|
+
|
7
|
+
describe '.estimator_class' do
|
8
|
+
subject { described_class.estimator_class }
|
9
|
+
let(:foo) { Struct.new :foo }
|
10
|
+
|
11
|
+
before { described_class.estimator_class = 'Foo' }
|
12
|
+
before { Foo = foo }
|
13
|
+
|
14
|
+
it { is_expected.to eq foo }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/address_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'address factory' do
|
5
|
+
let(:factory_class) { Spree::Address }
|
6
|
+
|
7
|
+
describe 'plain address' do
|
8
|
+
let(:factory) { :address }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'ship_address' do
|
14
|
+
let(:factory) { :ship_address }
|
15
|
+
|
16
|
+
it_behaves_like 'a working factory'
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'bill address' do
|
20
|
+
let(:factory) { :bill_address }
|
21
|
+
|
22
|
+
it_behaves_like 'a working factory'
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/adjustment_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'adjustment factory' do
|
5
|
+
let(:factory_class) { Spree::Adjustment }
|
6
|
+
|
7
|
+
describe 'plain adjustment' do
|
8
|
+
let(:factory) { :adjustment }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'tax adjustment' do
|
14
|
+
let(:factory) { :tax_adjustment }
|
15
|
+
|
16
|
+
it_behaves_like 'a working factory'
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/adjustment_reason_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'adjustment reason factory' do
|
5
|
+
let(:factory_class) { Spree::AdjustmentReason }
|
6
|
+
|
7
|
+
describe 'adjustment reason' do
|
8
|
+
let(:factory) { :adjustment_reason }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/calculator_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'calculator factory' do
|
5
|
+
let(:factory_class) { Spree::Calculator }
|
6
|
+
|
7
|
+
describe 'calculator' do
|
8
|
+
let(:factory) { :calculator }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'no amount calculator' do
|
14
|
+
let(:factory) { :no_amount_calculator }
|
15
|
+
|
16
|
+
it_behaves_like 'a working factory'
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'default_tax_calculator' do
|
20
|
+
let(:factory) { :default_tax_calculator }
|
21
|
+
|
22
|
+
it_behaves_like 'a working factory'
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'shipping calculator' do
|
26
|
+
let(:factory) { :shipping_calculator }
|
27
|
+
|
28
|
+
it_behaves_like 'a working factory'
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'shipping no amount calculator' do
|
32
|
+
let(:factory) { :shipping_no_amount_calculator }
|
33
|
+
|
34
|
+
it_behaves_like 'a working factory'
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'percent on item calculator' do
|
38
|
+
let(:factory) { :percent_on_item_calculator }
|
39
|
+
|
40
|
+
it_behaves_like 'a working factory'
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/carton_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'carton factory' do
|
5
|
+
let(:factory_class) { Spree::Carton }
|
6
|
+
|
7
|
+
describe 'plain adjustment' do
|
8
|
+
let(:factory) { :carton }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/country_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'country factory' do
|
5
|
+
let(:factory_class) { Spree::Country }
|
6
|
+
|
7
|
+
describe 'plain adjustment' do
|
8
|
+
let(:factory) { :country }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/credit_card_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'credit card factory' do
|
5
|
+
let(:factory_class) { Spree::CreditCard }
|
6
|
+
|
7
|
+
describe 'plain credit card' do
|
8
|
+
let(:factory) { :credit_card }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/customer_return_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'customer return factory' do
|
5
|
+
let(:factory_class) { Spree::CustomerReturn }
|
6
|
+
|
7
|
+
describe 'customer return' do
|
8
|
+
let(:factory) { :customer_return }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'customer return with accepted items' do
|
14
|
+
let(:factory) { :customer_return_with_accepted_items }
|
15
|
+
|
16
|
+
it_behaves_like 'a working factory'
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'customer return without return items' do
|
20
|
+
let(:factory) { :customer_return_without_return_items }
|
21
|
+
|
22
|
+
it "builds successfully" do
|
23
|
+
expect(build factory).to be_a(factory_class)
|
24
|
+
end
|
25
|
+
|
26
|
+
# No create test, because this factory is (intentionally) invalid
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/image_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'image factory' do
|
5
|
+
let(:factory_class) { Spree::Image }
|
6
|
+
|
7
|
+
describe 'plain adjustment' do
|
8
|
+
let(:factory) { :image }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/inventory_unit_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'inventory unit factory' do
|
5
|
+
let(:factory_class) { Spree::InventoryUnit }
|
6
|
+
|
7
|
+
describe 'plain inventory unit' do
|
8
|
+
let(:factory) { :inventory_unit }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/line_item_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'line item factory' do
|
5
|
+
let(:factory_class) { Spree::LineItem }
|
6
|
+
|
7
|
+
describe 'plain inventory unit' do
|
8
|
+
let(:factory) { :line_item }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/option_type_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'option type factory' do
|
5
|
+
let(:factory_class) { Spree::OptionType }
|
6
|
+
|
7
|
+
describe 'plain option type' do
|
8
|
+
let(:factory) { :option_type }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/option_value_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'option value factory' do
|
5
|
+
let(:factory_class) { Spree::OptionValue }
|
6
|
+
|
7
|
+
describe 'plain option value' do
|
8
|
+
let(:factory) { :option_value }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'spree/testing_support/factories/order_factory'
|
3
|
+
|
4
|
+
RSpec.describe 'order factory' do
|
5
|
+
let(:factory_class) { Spree::Order }
|
6
|
+
|
7
|
+
describe 'plain order' do
|
8
|
+
let(:factory) { :order }
|
9
|
+
|
10
|
+
it_behaves_like 'a working factory'
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
describe 'order with totals' do
|
15
|
+
let(:factory) { :order_with_totals }
|
16
|
+
|
17
|
+
it_behaves_like 'a working factory'
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'order with line items' do
|
21
|
+
let(:factory) { :order_with_line_items }
|
22
|
+
|
23
|
+
it_behaves_like 'a working factory'
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'completed order with totals' do
|
27
|
+
let(:factory) { :completed_order_with_totals }
|
28
|
+
|
29
|
+
it_behaves_like 'a working factory'
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'completed order with pending payment' do
|
33
|
+
let(:factory) { :completed_order_with_pending_payment }
|
34
|
+
|
35
|
+
it_behaves_like 'a working factory'
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'order ready to ship' do
|
39
|
+
let(:factory) { :order_ready_to_ship }
|
40
|
+
|
41
|
+
it_behaves_like 'a working factory'
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'shipped order' do
|
45
|
+
let(:factory) { :shipped_order }
|
46
|
+
|
47
|
+
it_behaves_like 'a working factory'
|
48
|
+
end
|
49
|
+
end
|