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
@@ -87,7 +87,9 @@ module Spree
|
|
87
87
|
@@source_attributes = [
|
88
88
|
:number, :month, :year, :expiry, :verification_value,
|
89
89
|
:first_name, :last_name, :cc_type, :gateway_customer_profile_id,
|
90
|
-
:gateway_payment_profile_id, :last_digits, :name, :encrypted_data
|
90
|
+
:gateway_payment_profile_id, :last_digits, :name, :encrypted_data,
|
91
|
+
:existing_card_id,
|
92
|
+
]
|
91
93
|
|
92
94
|
@@stock_item_attributes = [:variant, :stock_location, :backorderable, :variant_id]
|
93
95
|
|
@@ -13,19 +13,11 @@ module CapybaraExt
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def within_row(num, &block)
|
16
|
-
|
17
|
-
within("table.index tbody tr:nth-child(#{num})", &block)
|
18
|
-
else
|
19
|
-
within(:xpath, all("table.index tbody tr")[num-1].path, &block)
|
20
|
-
end
|
16
|
+
within("table.index tbody tr:nth-of-type(#{num})", &block)
|
21
17
|
end
|
22
18
|
|
23
19
|
def column_text(num)
|
24
|
-
|
25
|
-
find("td:nth-child(#{num})").text
|
26
|
-
else
|
27
|
-
all("td")[num-1].text
|
28
|
-
end
|
20
|
+
find("td:nth-of-type(#{num})").text
|
29
21
|
end
|
30
22
|
|
31
23
|
def fill_in_quantity(table_column, selector, quantity)
|
@@ -43,18 +35,15 @@ module CapybaraExt
|
|
43
35
|
end
|
44
36
|
|
45
37
|
def select2_search_without_selection(value, options)
|
46
|
-
|
47
|
-
page.execute_script "$('input.select2-input').val('#{value}').trigger('keyup-change');"
|
48
|
-
end
|
49
|
-
|
50
|
-
def targetted_select2_search(value, options)
|
51
|
-
find("#{options[:from]}:not(.select2-container-disabled)").click
|
38
|
+
find("#{options[:from]}:not(.select2-container-disabled):not(.select2-offscreen)").click
|
52
39
|
|
53
40
|
within_entire_page do
|
54
|
-
|
55
|
-
select2input.set(value)
|
41
|
+
find("input.select2-input.select2-focused").set(value)
|
56
42
|
end
|
43
|
+
end
|
57
44
|
|
45
|
+
def targetted_select2_search(value, options)
|
46
|
+
select2_search_without_selection(value, from: options[:from])
|
58
47
|
select_select2_result(value)
|
59
48
|
end
|
60
49
|
|
@@ -94,12 +83,17 @@ module CapybaraExt
|
|
94
83
|
def select_select2_result(value)
|
95
84
|
# results are in a div appended to the end of the document
|
96
85
|
within_entire_page do
|
97
|
-
page.find("div.select2-result-label", text: %r{#{Regexp.escape(value)}}i).click
|
86
|
+
page.find("div.select2-result-label", text: %r{#{Regexp.escape(value)}}i, match: :prefer_exact).click
|
98
87
|
end
|
99
88
|
end
|
100
89
|
|
101
90
|
def find_label_by_text(text)
|
102
|
-
find
|
91
|
+
# This used to find the label by it's text using an xpath query, so we use
|
92
|
+
# a case insensitive search to avoid breakage with existing usage.
|
93
|
+
# We need to select labels which are not .select2-offscreen, as select2
|
94
|
+
# makes a duplicate label with the same text, and we want to be sure to
|
95
|
+
# find the original.
|
96
|
+
find('label:not(.select2-offscreen)', text: %r{#{Regexp.escape(text)}}i, match: :one)
|
103
97
|
end
|
104
98
|
|
105
99
|
def wait_for_ajax
|
@@ -124,11 +118,6 @@ module CapybaraExt
|
|
124
118
|
end
|
125
119
|
end
|
126
120
|
|
127
|
-
Capybara.configure do |config|
|
128
|
-
config.match = :prefer_exact
|
129
|
-
config.ignore_hidden_elements = true
|
130
|
-
end
|
131
|
-
|
132
121
|
RSpec::Matchers.define :have_meta do |name, expected|
|
133
122
|
match do |actual|
|
134
123
|
has_css?("meta[name='#{name}'][content='#{expected}']", visible: false)
|
@@ -144,21 +133,6 @@ RSpec::Matchers.define :have_meta do |name, expected|
|
|
144
133
|
end
|
145
134
|
end
|
146
135
|
|
147
|
-
RSpec::Matchers.define :have_title do |expected|
|
148
|
-
match do |actual|
|
149
|
-
has_css?("title", text: expected, visible: false)
|
150
|
-
end
|
151
|
-
|
152
|
-
failure_message do |actual|
|
153
|
-
actual = first("title")
|
154
|
-
if actual
|
155
|
-
"expected that title would have been '#{expected}' but was '#{actual.text}'"
|
156
|
-
else
|
157
|
-
"expected that title would exist with '#{expected}'"
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
136
|
RSpec.configure do |c|
|
163
137
|
c.include CapybaraExt
|
164
138
|
end
|
@@ -1,20 +1,5 @@
|
|
1
1
|
require 'factory_girl'
|
2
2
|
|
3
|
-
Spree::Zone.class_eval do
|
4
|
-
def self.global
|
5
|
-
find_by(name: 'GlobalZone') || FactoryGirl.create(:global_zone)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
3
|
Dir["#{File.dirname(__FILE__)}/factories/**"].each do |f|
|
10
4
|
require File.expand_path(f)
|
11
5
|
end
|
12
|
-
|
13
|
-
FactoryGirl.define do
|
14
|
-
sequence(:random_string) { Faker::Lorem.sentence }
|
15
|
-
sequence(:random_description) { Faker::Lorem.paragraphs(1 + Kernel.rand(5)).join("\n") }
|
16
|
-
sequence(:random_email) { Faker::Internet.email }
|
17
|
-
|
18
|
-
sequence(:sku) { |n| "SKU-#{n}" }
|
19
|
-
sequence(:random_code) { Faker::Lorem.characters(10) }
|
20
|
-
end
|
@@ -1,6 +1,13 @@
|
|
1
|
+
require 'spree/testing_support/factories/line_item_factory'
|
2
|
+
require 'spree/testing_support/factories/order_factory'
|
3
|
+
require 'spree/testing_support/factories/tax_category_factory'
|
4
|
+
require 'spree/testing_support/factories/tax_rate_factory'
|
5
|
+
require 'spree/testing_support/factories/zone_factory'
|
6
|
+
|
1
7
|
FactoryGirl.define do
|
2
8
|
factory :adjustment, class: Spree::Adjustment do
|
3
|
-
|
9
|
+
order
|
10
|
+
adjustable { order }
|
4
11
|
amount 100.0
|
5
12
|
label 'Shipping'
|
6
13
|
association(:source, factory: :tax_rate)
|
@@ -8,6 +15,7 @@ FactoryGirl.define do
|
|
8
15
|
end
|
9
16
|
|
10
17
|
factory :tax_adjustment, class: Spree::Adjustment do
|
18
|
+
order { adjustable.order }
|
11
19
|
association(:adjustable, factory: :line_item)
|
12
20
|
amount 10.0
|
13
21
|
label 'VAT 5%'
|
@@ -1,9 +1,12 @@
|
|
1
|
+
require 'spree/testing_support/factories/shipment_factory'
|
2
|
+
require 'spree/testing_support/factories/inventory_unit_factory'
|
3
|
+
|
1
4
|
FactoryGirl.define do
|
2
5
|
factory :carton, class: Spree::Carton do
|
3
6
|
address
|
4
7
|
stock_location
|
5
8
|
shipping_method
|
6
|
-
shipped_at { Time.
|
9
|
+
shipped_at { Time.current }
|
7
10
|
inventory_units do
|
8
11
|
[
|
9
12
|
build(
|
@@ -1,3 +1,7 @@
|
|
1
|
+
require 'spree/testing_support/factories/stock_location_factory'
|
2
|
+
require 'spree/testing_support/factories/order_factory'
|
3
|
+
require 'spree/testing_support/factories/return_item_factory'
|
4
|
+
|
1
5
|
FactoryGirl.define do
|
2
6
|
|
3
7
|
factory :customer_return, class: Spree::CustomerReturn do
|
@@ -1,3 +1,8 @@
|
|
1
|
+
require 'spree/testing_support/factories/line_item_factory'
|
2
|
+
require 'spree/testing_support/factories/variant_factory'
|
3
|
+
require 'spree/testing_support/factories/order_factory'
|
4
|
+
require 'spree/testing_support/factories/shipment_factory'
|
5
|
+
|
1
6
|
FactoryGirl.define do
|
2
7
|
factory :inventory_unit, class: Spree::InventoryUnit do
|
3
8
|
variant
|
@@ -1,3 +1,10 @@
|
|
1
|
+
require 'spree/testing_support/factories/address_factory'
|
2
|
+
require 'spree/testing_support/factories/shipment_factory'
|
3
|
+
require 'spree/testing_support/factories/store_factory'
|
4
|
+
require 'spree/testing_support/factories/user_factory'
|
5
|
+
require 'spree/testing_support/factories/line_item_factory'
|
6
|
+
require 'spree/testing_support/factories/payment_factory'
|
7
|
+
|
1
8
|
FactoryGirl.define do
|
2
9
|
factory :order, class: Spree::Order do
|
3
10
|
user
|
@@ -27,16 +34,19 @@ FactoryGirl.define do
|
|
27
34
|
line_items_attributes { [{}] * line_items_count }
|
28
35
|
shipment_cost 100
|
29
36
|
shipping_method nil
|
37
|
+
stock_location { create(:stock_location) }
|
30
38
|
end
|
31
39
|
|
32
40
|
after(:create) do |order, evaluator|
|
41
|
+
evaluator.stock_location # must evaluate before creating line items
|
42
|
+
|
33
43
|
evaluator.line_items_attributes.each do |attributes|
|
34
44
|
attributes = {order: order, price: evaluator.line_items_price}.merge(attributes)
|
35
45
|
create(:line_item, attributes)
|
36
46
|
end
|
37
47
|
order.line_items.reload
|
38
48
|
|
39
|
-
create(:shipment, order: order, cost: evaluator.shipment_cost, shipping_method: evaluator.shipping_method, address: evaluator.ship_address)
|
49
|
+
create(:shipment, order: order, cost: evaluator.shipment_cost, shipping_method: evaluator.shipping_method, address: evaluator.ship_address, stock_location: evaluator.stock_location)
|
40
50
|
order.shipments.reload
|
41
51
|
|
42
52
|
order.update!
|
@@ -80,14 +90,14 @@ FactoryGirl.define do
|
|
80
90
|
after(:create) do |order, evaluator|
|
81
91
|
order.shipments.each do |shipment|
|
82
92
|
shipment.inventory_units.update_all state: 'shipped'
|
83
|
-
shipment.update_columns(state: 'shipped', shipped_at: Time.
|
93
|
+
shipment.update_columns(state: 'shipped', shipped_at: Time.current)
|
84
94
|
if evaluator.with_cartons
|
85
95
|
Spree::Carton.create!(
|
86
96
|
stock_location: shipment.stock_location,
|
87
97
|
address: shipment.address,
|
88
98
|
shipping_method: shipment.shipping_method,
|
89
99
|
inventory_units: shipment.inventory_units,
|
90
|
-
shipped_at: Time.
|
100
|
+
shipped_at: Time.current,
|
91
101
|
)
|
92
102
|
end
|
93
103
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
require 'spree/testing_support/factories/payment_method_factory'
|
2
|
+
require 'spree/testing_support/factories/credit_card_factory'
|
3
|
+
require 'spree/testing_support/factories/order_factory'
|
4
|
+
require 'spree/testing_support/factories/store_credit_factory'
|
5
|
+
|
1
6
|
FactoryGirl.define do
|
2
7
|
factory :payment, aliases: [:credit_card_payment], class: Spree::Payment do
|
3
|
-
amount 45.75
|
4
8
|
association(:payment_method, factory: :credit_card_payment_method)
|
5
9
|
association(:source, factory: :credit_card)
|
6
10
|
order
|
@@ -8,15 +12,19 @@ FactoryGirl.define do
|
|
8
12
|
response_code '12345'
|
9
13
|
|
10
14
|
factory :payment_with_refund do
|
11
|
-
|
12
|
-
|
13
|
-
create(:refund, amount: 5, payment: payment)
|
15
|
+
transient do
|
16
|
+
refund_amount 5
|
14
17
|
end
|
18
|
+
|
19
|
+
amount { refund_amount }
|
20
|
+
|
21
|
+
state 'completed'
|
22
|
+
|
23
|
+
refunds { build_list :refund, 1, amount: refund_amount }
|
15
24
|
end
|
16
25
|
end
|
17
26
|
|
18
27
|
factory :check_payment, class: Spree::Payment do
|
19
|
-
amount 45.75
|
20
28
|
association(:payment_method, factory: :check_payment_method)
|
21
29
|
order
|
22
30
|
end
|
@@ -1,7 +1,13 @@
|
|
1
|
+
require 'spree/testing_support/sequences'
|
2
|
+
require 'spree/testing_support/factories/shipping_category_factory'
|
3
|
+
require 'spree/testing_support/factories/stock_location_factory'
|
4
|
+
require 'spree/testing_support/factories/tax_category_factory'
|
5
|
+
require 'spree/testing_support/factories/product_option_type_factory'
|
6
|
+
|
1
7
|
FactoryGirl.define do
|
2
8
|
factory :base_product, class: Spree::Product do
|
3
9
|
sequence(:name) { |n| "Product ##{n} - #{Kernel.rand(9999)}" }
|
4
|
-
description
|
10
|
+
description "As seen on TV!"
|
5
11
|
price 19.99
|
6
12
|
cost_price 17.00
|
7
13
|
sku { generate(:sku) }
|
@@ -1,14 +1,19 @@
|
|
1
|
+
require 'spree/testing_support/factories/payment_factory'
|
2
|
+
require 'spree/testing_support/factories/refund_reason_factory'
|
3
|
+
|
1
4
|
FactoryGirl.define do
|
2
5
|
sequence(:refund_transaction_id) { |n| "fake-refund-transaction-#{n}"}
|
3
6
|
|
4
7
|
factory :refund, class: Spree::Refund do
|
8
|
+
transient do
|
9
|
+
payment_amount 100
|
10
|
+
end
|
11
|
+
|
5
12
|
amount 100.00
|
6
13
|
transaction_id { generate(:refund_transaction_id) }
|
7
|
-
|
14
|
+
payment do
|
15
|
+
association(:payment, state: 'completed', amount: payment_amount)
|
16
|
+
end
|
8
17
|
association(:reason, factory: :refund_reason)
|
9
18
|
end
|
10
|
-
|
11
|
-
factory :refund_reason, class: Spree::RefundReason do
|
12
|
-
sequence(:name) { |n| "Refund for return ##{n}" }
|
13
|
-
end
|
14
19
|
end
|
@@ -1,3 +1,7 @@
|
|
1
|
+
require 'spree/testing_support/factories/order_factory'
|
2
|
+
require 'spree/testing_support/factories/stock_location_factory'
|
3
|
+
require 'spree/testing_support/factories/return_reason_factory'
|
4
|
+
|
1
5
|
FactoryGirl.define do
|
2
6
|
factory :return_authorization, class: Spree::ReturnAuthorization do
|
3
7
|
association(:order, factory: :shipped_order)
|
@@ -11,8 +15,4 @@ FactoryGirl.define do
|
|
11
15
|
association(:stock_location, factory: :stock_location)
|
12
16
|
association(:reason, factory: :return_reason)
|
13
17
|
end
|
14
|
-
|
15
|
-
factory :return_reason, class: Spree::ReturnReason do
|
16
|
-
sequence(:name) { |n| "Defect ##{n}" }
|
17
|
-
end
|
18
18
|
end
|
@@ -1,3 +1,7 @@
|
|
1
|
+
require 'spree/testing_support/factories/inventory_unit_factory'
|
2
|
+
require 'spree/testing_support/factories/return_reason_factory'
|
3
|
+
require 'spree/testing_support/factories/return_authorization_factory'
|
4
|
+
|
1
5
|
FactoryGirl.define do
|
2
6
|
factory :return_item, class: Spree::ReturnItem do
|
3
7
|
association(:inventory_unit, factory: :inventory_unit, state: :shipped)
|