mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Merge pull request #6274 from luisramos0/rubocop
Use rubocop auto correct to fix a number of issues
This commit is contained in:
@@ -61,11 +61,10 @@ Layout/LineLength:
|
||||
- app/models/product_import/unit_converter.rb
|
||||
- app/models/proxy_order.rb
|
||||
- app/models/schedule.rb
|
||||
- app/models/spree/app_configuration_decorator.rb
|
||||
- app/models/spree/app_configuration.rb
|
||||
- app/models/spree/gateway/stripe_connect.rb
|
||||
- app/models/spree/image.rb
|
||||
- app/models/spree/line_item_decorator.rb
|
||||
- app/models/spree/order_decorator.rb
|
||||
- app/models/spree/order.rb
|
||||
- app/models/spree/payment_method.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/user.rb
|
||||
@@ -74,6 +73,7 @@ Layout/LineLength:
|
||||
- app/models/variant_override_set.rb
|
||||
- app/serializers/api/admin/subscription_line_item_serializer.rb
|
||||
- app/services/cart_service.rb
|
||||
- app/services/checkout/post_checkout_actions.rb
|
||||
- app/services/default_stock_location.rb
|
||||
- app/services/embedded_page_service.rb
|
||||
- app/services/order_cycle_form.rb
|
||||
@@ -101,7 +101,6 @@ Layout/LineLength:
|
||||
- lib/open_food_network/scope_variants_for_search.rb
|
||||
- lib/open_food_network/xero_invoices_report.rb
|
||||
- lib/spree/localized_number.rb
|
||||
- lib/spree/product_filters.rb
|
||||
- lib/tasks/data.rake
|
||||
- lib/tasks/enterprises.rake
|
||||
- spec/controllers/admin/bulk_line_items_controller_spec.rb
|
||||
@@ -263,12 +262,17 @@ Layout/LineLength:
|
||||
- spec/models/spree/adjustment_spec.rb
|
||||
- spec/models/spree/classification_spec.rb
|
||||
- spec/models/spree/gateway/stripe_connect_spec.rb
|
||||
- spec/models/spree/inventory_unit_spec.rb
|
||||
- spec/models/spree/line_item_spec.rb
|
||||
- spec/models/spree/order/checkout_spec.rb
|
||||
- spec/models/spree/order_inventory_spec.rb
|
||||
- spec/models/spree/order_spec.rb
|
||||
- spec/models/spree/order/state_machine_spec.rb
|
||||
- spec/models/spree/payment_method_spec.rb
|
||||
- spec/models/spree/payment_spec.rb
|
||||
- spec/models/spree/product_set_spec.rb
|
||||
- spec/models/spree/product_spec.rb
|
||||
- spec/models/spree/return_authorization_spec.rb
|
||||
- spec/models/spree/shipping_method_spec.rb
|
||||
- spec/models/spree/stock_item_spec.rb
|
||||
- spec/models/spree/taxon_spec.rb
|
||||
@@ -298,6 +302,7 @@ Layout/LineLength:
|
||||
- spec/serializers/api/order_serializer_spec.rb
|
||||
- spec/services/cart_service_spec.rb
|
||||
- spec/services/checkout/form_data_adapter_spec.rb
|
||||
- spec/services/checkout/post_checkout_actions_spec.rb
|
||||
- spec/services/embedded_page_service_spec.rb
|
||||
- spec/services/exchange_products_renderer_spec.rb
|
||||
- spec/services/order_cycle_distributed_products_spec.rb
|
||||
@@ -384,17 +389,22 @@ Metrics/AbcSize:
|
||||
- app/models/proxy_order.rb
|
||||
- app/models/spree/ability.rb
|
||||
- app/models/spree/address.rb
|
||||
- app/models/spree/line_item_decorator.rb
|
||||
- app/models/spree/line_item.rb
|
||||
- app/models/spree/order/checkout.rb
|
||||
- app/models/spree/order_decorator.rb
|
||||
- app/models/spree/order_contents.rb
|
||||
- app/models/spree/order_inventory.rb
|
||||
- app/models/spree/order.rb
|
||||
- app/models/spree/payment/processing.rb
|
||||
- app/models/spree/payment.rb
|
||||
- app/models/spree/preference.rb
|
||||
- app/models/spree/preferences/preferable_class_methods.rb
|
||||
- app/models/spree/preferences/preferable.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/return_authorization.rb
|
||||
- app/models/spree/shipment.rb
|
||||
- app/models/spree/taxon.rb
|
||||
- app/models/spree/tax_rate.rb
|
||||
- app/models/spree/zone.rb
|
||||
- app/serializers/api/admin/enterprise_serializer.rb
|
||||
- app/serializers/api/product_serializer.rb
|
||||
- app/serializers/api/variant_serializer.rb
|
||||
- app/services/cart_service.rb
|
||||
@@ -517,7 +527,11 @@ Metrics/CyclomaticComplexity:
|
||||
- app/models/spree/order/checkout.rb
|
||||
- app/models/spree/payment_method.rb
|
||||
- app/models/spree/payment.rb
|
||||
- app/models/spree/preference.rb
|
||||
- app/models/spree/preferences/preferable.rb
|
||||
- app/models/spree/preferences/preferable_class_methods.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/return_authorization.rb
|
||||
- app/models/spree/zone.rb
|
||||
- app/models/variant_override_set.rb
|
||||
- app/services/cart_service.rb
|
||||
@@ -551,7 +565,10 @@ Metrics/PerceivedComplexity:
|
||||
- app/models/spree/order/checkout.rb
|
||||
- app/models/spree/payment_method.rb
|
||||
- app/models/spree/payment.rb
|
||||
- app/models/spree/preferences/preferable.rb
|
||||
- app/models/spree/preferences/preferable_class_methods.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/return_authorization.rb
|
||||
- app/models/spree/zone.rb
|
||||
- app/models/variant_override_set.rb
|
||||
- app/services/cart_service.rb
|
||||
@@ -577,7 +594,7 @@ Metrics/PerceivedComplexity:
|
||||
- app/models/spree/ability.rb
|
||||
- app/models/spree/address.rb
|
||||
- app/models/spree/order/checkout.rb
|
||||
- app/models/spree/order_decorator.rb
|
||||
- app/models/spree/order.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/zone.rb
|
||||
- engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb
|
||||
@@ -595,61 +612,6 @@ Metrics/PerceivedComplexity:
|
||||
Metrics/MethodLength:
|
||||
Max: 10
|
||||
Exclude:
|
||||
- app/controllers/admin/enterprise_fees_controller.rb
|
||||
- app/controllers/admin/enterprises_controller.rb
|
||||
- app/controllers/spree/admin/taxons_controller.rb
|
||||
- app/controllers/spree/orders_controller.rb
|
||||
- app/helpers/checkout_helper.rb
|
||||
- app/helpers/order_cycles_helper.rb
|
||||
- app/helpers/spree/admin/base_helper.rb
|
||||
- app/helpers/spree/admin/navigation_helper.rb
|
||||
- app/models/enterprise.rb
|
||||
- app/models/enterprise_relationship.rb
|
||||
- app/models/spree/ability.rb
|
||||
- app/models/spree/address.rb
|
||||
- app/models/spree/order/checkout.rb
|
||||
- app/models/spree/payment_method.rb
|
||||
- app/models/spree/payment.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/zone.rb
|
||||
- app/models/variant_override_set.rb
|
||||
- app/services/cart_service.rb
|
||||
- engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb
|
||||
- engines/order_management/app/services/order_management/stock/estimator.rb
|
||||
- lib/active_merchant/billing/gateways/stripe_payment_intents.rb
|
||||
- lib/discourse/single_sign_on.rb
|
||||
- lib/open_food_network/enterprise_issue_validator.rb
|
||||
- lib/spree/core/calculated_adjustments.rb
|
||||
- lib/spree/core/controller_helpers/order.rb
|
||||
- lib/spree/core/controller_helpers/respond_with.rb
|
||||
- lib/spree/core/controller_helpers/ssl.rb
|
||||
- lib/spree/localized_number.rb
|
||||
- spec/models/product_importer_spec.rb
|
||||
- app/controllers/admin/enterprises_controller.rb
|
||||
- app/controllers/api/variants_controller.rb
|
||||
- app/controllers/spree/admin/taxons_controller.rb
|
||||
- app/controllers/spree/orders_controller.rb
|
||||
- app/helpers/checkout_helper.rb
|
||||
- app/helpers/order_cycles_helper.rb
|
||||
- app/helpers/spree/admin/navigation_helper.rb
|
||||
- app/models/enterprise_relationship.rb
|
||||
- app/models/spree/ability.rb
|
||||
- app/models/spree/address.rb
|
||||
- app/models/spree/order/checkout.rb
|
||||
- app/models/spree/order_decorator.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/zone.rb
|
||||
- engines/order_management/app/services/order_management/reports/bulk_coop/bulk_coop_report.rb
|
||||
- engines/order_management/app/services/order_management/stock/estimator.rb
|
||||
- lib/active_merchant/billing/gateways/stripe_payment_intents.rb
|
||||
- lib/discourse/single_sign_on.rb
|
||||
- lib/open_food_network/enterprise_issue_validator.rb
|
||||
- lib/spree/core/calculated_adjustments.rb
|
||||
- lib/spree/core/controller_helpers/order.rb
|
||||
- lib/spree/core/controller_helpers/respond_with.rb
|
||||
- lib/spree/core/controller_helpers/ssl.rb
|
||||
- lib/spree/localized_number.rb
|
||||
- spec/models/product_importer_spec.rb
|
||||
- app/controllers/admin/contents_controller.rb
|
||||
- app/controllers/admin/customers_controller.rb
|
||||
- app/controllers/admin/enterprise_fees_controller.rb
|
||||
@@ -699,10 +661,17 @@ Metrics/MethodLength:
|
||||
- app/models/spree/address.rb
|
||||
- app/models/spree/credit_card.rb
|
||||
- app/models/spree/order/checkout.rb
|
||||
- app/models/spree/order_decorator.rb
|
||||
- app/models/spree/order_contents.rb
|
||||
- app/models/spree/order_inventory.rb
|
||||
- app/models/spree/order.rb
|
||||
- app/models/spree/payment_method.rb
|
||||
- app/models/spree/payment/processing.rb
|
||||
- app/models/spree/preference.rb
|
||||
- app/models/spree/preferences/preferable_class_methods.rb
|
||||
- app/models/spree/preferences/preferable.rb
|
||||
- app/models/spree/preferences/store.rb
|
||||
- app/models/spree/product_decorator.rb
|
||||
- app/models/spree/return_authorization.rb
|
||||
- app/models/spree/shipment.rb
|
||||
- app/models/spree/taxon.rb
|
||||
- app/models/spree/tax_rate.rb
|
||||
@@ -783,6 +752,8 @@ Metrics/ClassLength:
|
||||
- app/models/spree/ability.rb
|
||||
- app/models/spree/address.rb
|
||||
- app/models/spree/credit_card.rb
|
||||
- app/models/spree/line_item.rb
|
||||
- app/models/spree/order.rb
|
||||
- app/models/spree/payment.rb
|
||||
- app/models/spree/shipment.rb
|
||||
- app/models/spree/user.rb
|
||||
@@ -817,6 +788,7 @@ Metrics/ModuleLength:
|
||||
- lib/open_food_network/column_preference_defaults.rb
|
||||
- spec/controllers/admin/order_cycles_controller_spec.rb
|
||||
- spec/controllers/api/orders_controller_spec.rb
|
||||
- spec/lib/open_food_network/order_cycle_form_applicator_spec.rb
|
||||
- spec/lib/open_food_network/order_cycle_permissions_spec.rb
|
||||
- spec/models/spree/adjustment_spec.rb
|
||||
- spec/models/spree/credit_card_spec.rb
|
||||
@@ -831,3 +803,9 @@ Metrics/ParameterLists:
|
||||
- app/models/product_import/entry_processor.rb
|
||||
- lib/open_food_network/xero_invoices_report.rb
|
||||
- spec/features/admin/reports_spec.rb
|
||||
|
||||
Lint/UselessAssignment:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
- 'app/models/spree/taxon.rb'
|
||||
- 'lib/spree/core/controller_helpers/common.rb'
|
||||
|
||||
@@ -1,144 +1,11 @@
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --exclude-limit 1400`
|
||||
# on 2020-10-14 09:49:36 +0100 using RuboCop version 0.81.0.
|
||||
# on 2020-10-30 17:18:53 +0000 using RuboCop version 0.81.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: with_first_argument, with_fixed_indentation
|
||||
Layout/ArgumentAlignment:
|
||||
Exclude:
|
||||
- 'spec/models/spree/address_spec.rb'
|
||||
- 'spec/models/spree/order/checkout_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyleAlignWith.
|
||||
# SupportedStylesAlignWith: either, start_of_block, start_of_line
|
||||
Layout/BlockAlignment:
|
||||
Exclude:
|
||||
- 'spec/models/spree/order/checkout_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
Layout/EmptyLines:
|
||||
Exclude:
|
||||
- 'spec/features/admin/variants_spec.rb'
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: empty_lines, no_empty_lines
|
||||
Layout/EmptyLinesAroundBlockBody:
|
||||
Exclude:
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
- 'spec/models/spree/zone_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
||||
Layout/ExtraSpacing:
|
||||
Exclude:
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
- 'spec/requests/api/orders_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
|
||||
Layout/FirstArrayElementIndentation:
|
||||
Exclude:
|
||||
- 'spec/views/spree/admin/payment_methods/index.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
||||
Layout/FirstHashElementIndentation:
|
||||
Exclude:
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
- 'spec/swagger_helper.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
||||
# SupportedHashRocketStyles: key, separator, table
|
||||
# SupportedColonStyles: key, separator, table
|
||||
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
||||
Layout/HashAlignment:
|
||||
Exclude:
|
||||
- 'spec/lib/open_food_network/packing_report_spec.rb'
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: normal, indented_internal_methods
|
||||
Layout/IndentationConsistency:
|
||||
Exclude:
|
||||
- 'spec/models/spree/order/checkout_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: symmetrical, new_line, same_line
|
||||
Layout/MultilineHashBraceLayout:
|
||||
Exclude:
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
||||
# SupportedStylesForExponentOperator: space, no_space
|
||||
Layout/SpaceAroundOperators:
|
||||
Exclude:
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
||||
# SupportedStyles: space, no_space
|
||||
# SupportedStylesForEmptyBraces: space, no_space
|
||||
Layout/SpaceInsideBlockBraces:
|
||||
Exclude:
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
|
||||
# Offense count: 11
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
||||
# SupportedStyles: space, no_space, compact
|
||||
# SupportedStylesForEmptyBraces: space, no_space
|
||||
Layout/SpaceInsideHashLiteralBraces:
|
||||
Exclude:
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
- 'spec/requests/api/orders_spec.rb'
|
||||
- 'spec/services/checkout/form_data_adapter_spec.rb'
|
||||
- 'spec/services/user_locale_setter_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: final_newline, final_blank_line
|
||||
Layout/TrailingEmptyLines:
|
||||
Exclude:
|
||||
- 'spec/factories.rb'
|
||||
- 'spec/factories/address_factory.rb'
|
||||
- 'spec/support/request/stripe_helper.rb'
|
||||
|
||||
# Offense count: 6
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowInHeredoc.
|
||||
Layout/TrailingWhitespace:
|
||||
Exclude:
|
||||
- 'spec/features/consumer/shopping/shopping_spec.rb'
|
||||
- 'spec/lib/open_food_network/orders_and_fulfillments_report/customer_totals_report_spec.rb'
|
||||
- 'spec/requests/api/orders_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Lint/DuplicateMethods:
|
||||
Exclude:
|
||||
@@ -152,20 +19,6 @@ Lint/IneffectiveAccessModifier:
|
||||
- 'app/services/mail_configuration.rb'
|
||||
- 'lib/open_food_network/feature_toggle.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
||||
Lint/UnusedBlockArgument:
|
||||
Exclude:
|
||||
- 'spec/factories/stock_location_factory.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
||||
Lint/UnusedMethodArgument:
|
||||
Exclude:
|
||||
- 'spec/views/spree/admin/payment_methods/index.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 3
|
||||
# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
|
||||
Lint/UselessAccessModifier:
|
||||
@@ -174,19 +27,20 @@ Lint/UselessAccessModifier:
|
||||
- 'app/services/mail_configuration.rb'
|
||||
- 'lib/open_food_network/feature_toggle.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Offense count: 2
|
||||
Lint/UselessAssignment:
|
||||
Exclude:
|
||||
- 'spec/**/*'
|
||||
- 'lib/spree/core/controller_helpers/common.rb'
|
||||
- 'app/models/spree/taxon.rb'
|
||||
- 'lib/spree/core/controller_helpers/common.rb'
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 10
|
||||
Naming/AccessorMethodName:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/taxonomies_controller.rb'
|
||||
- 'app/models/spree/adjustment.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/services/checkout/post_checkout_actions.rb'
|
||||
- 'lib/spree/core/controller_helpers/common.rb'
|
||||
- 'spec/support/request/shop_workflow.rb'
|
||||
- 'spec/support/request/web_helper.rb'
|
||||
@@ -206,7 +60,7 @@ Naming/MemoizedInstanceVariableName:
|
||||
- 'app/mailers/producer_mailer.rb'
|
||||
- 'lib/open_food_network/address_finder.rb'
|
||||
|
||||
# Offense count: 20
|
||||
# Offense count: 24
|
||||
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
|
||||
# NamePrefix: is_, has_, have_
|
||||
# ForbiddenPrefixes: is_, has_, have_
|
||||
@@ -220,10 +74,11 @@ Naming/PredicateName:
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/spree/adjustment.rb'
|
||||
- 'app/models/spree/credit_card.rb'
|
||||
- 'app/models/spree/line_item_decorator.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/line_item.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/payment_method.rb'
|
||||
- 'app/models/spree/preferences/file_configuration.rb'
|
||||
- 'app/models/spree/preferences/preferable.rb'
|
||||
- 'app/models/spree/shipping_method.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'lib/open_food_network/customers_report.rb'
|
||||
@@ -262,21 +117,14 @@ Rails/Date:
|
||||
- 'app/models/order_cycle.rb'
|
||||
- 'app/models/spree/credit_card.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforceForPrefixed.
|
||||
Rails/Delegate:
|
||||
Exclude:
|
||||
- 'app/models/spree/line_item.rb'
|
||||
- 'engines/order_management/app/services/order_management/reports/bulk_coop/renderers/html_renderer.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: Whitelist.
|
||||
# Whitelist: find_by_sql
|
||||
Rails/DynamicFindBy:
|
||||
Exclude:
|
||||
- 'spec/factories/state_factory.rb'
|
||||
|
||||
# Offense count: 16
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: slashes, arguments
|
||||
@@ -307,13 +155,12 @@ Rails/FindBy:
|
||||
- 'app/models/product_import/spreadsheet_data.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/FindEach:
|
||||
Exclude:
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/shipment.rb'
|
||||
|
||||
# Offense count: 9
|
||||
@@ -324,13 +171,13 @@ Rails/HasAndBelongsToMany:
|
||||
- 'app/models/concerns/payment_method_distributors.rb'
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/spree/line_item_decorator.rb'
|
||||
- 'app/models/spree/line_item.rb'
|
||||
- 'app/models/spree/role.rb'
|
||||
- 'app/models/spree/shipping_method.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/spree/zone.rb'
|
||||
|
||||
# Offense count: 35
|
||||
# Offense count: 38
|
||||
# Configuration parameters: Include.
|
||||
# Include: app/models/**/*.rb
|
||||
Rails/HasManyOrHasOneDependent:
|
||||
@@ -341,9 +188,10 @@ Rails/HasManyOrHasOneDependent:
|
||||
- 'app/models/spree/address.rb'
|
||||
- 'app/models/spree/adjustment.rb'
|
||||
- 'app/models/spree/credit_card.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/payment_method.rb'
|
||||
- 'app/models/spree/property.rb'
|
||||
- 'app/models/spree/return_authorization.rb'
|
||||
- 'app/models/spree/shipment.rb'
|
||||
- 'app/models/spree/shipping_category.rb'
|
||||
- 'app/models/spree/shipping_method.rb'
|
||||
@@ -392,7 +240,7 @@ Rails/LexicallyScopedActionFilter:
|
||||
- 'app/controllers/spree/users_controller.rb'
|
||||
- 'app/controllers/user_passwords_controller.rb'
|
||||
|
||||
# Offense count: 13
|
||||
# Offense count: 14
|
||||
Rails/OutputSafety:
|
||||
Exclude:
|
||||
- 'app/controllers/spree/admin/reports_controller.rb'
|
||||
@@ -415,15 +263,16 @@ Rails/RakeEnvironment:
|
||||
- 'lib/capistrano/tasks/**/*.rake'
|
||||
- 'lib/tasks/specs.rake'
|
||||
|
||||
# Offense count: 9
|
||||
# Offense count: 11
|
||||
Rails/ReflectionClassName:
|
||||
Exclude:
|
||||
- 'app/models/customer.rb'
|
||||
- 'app/models/distributor_shipping_method.rb'
|
||||
- 'app/models/enterprise_role.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/subscription.rb'
|
||||
|
||||
# Offense count: 243
|
||||
# Offense count: 247
|
||||
# Configuration parameters: Blacklist, Whitelist.
|
||||
# Blacklist: decrement!, decrement_counter, increment!, increment_counter, toggle!, touch, update_all, update_attribute, update_column, update_columns, update_counters
|
||||
Rails/SkipsModelValidations:
|
||||
@@ -442,7 +291,8 @@ Rails/SkipsModelValidations:
|
||||
- 'app/models/spree/address.rb'
|
||||
- 'app/models/spree/adjustment.rb'
|
||||
- 'app/models/spree/credit_card.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/inventory_unit.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/payment.rb'
|
||||
- 'app/models/spree/shipment.rb'
|
||||
- 'app/models/spree/shipping_method.rb'
|
||||
@@ -480,7 +330,6 @@ Rails/SkipsModelValidations:
|
||||
- 'spec/features/admin/order_cycles/complex_editing_spec.rb'
|
||||
- 'spec/features/admin/order_cycles/simple_spec.rb'
|
||||
- 'spec/features/admin/order_spec.rb'
|
||||
- 'spec/features/admin/payments_spec.rb'
|
||||
- 'spec/features/admin/reports_spec.rb'
|
||||
- 'spec/features/consumer/caching/shops_caching_spec.rb'
|
||||
- 'spec/features/consumer/shopping/checkout_spec.rb'
|
||||
@@ -501,6 +350,7 @@ Rails/SkipsModelValidations:
|
||||
- 'spec/models/spree/adjustment_spec.rb'
|
||||
- 'spec/models/spree/asset_spec.rb'
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
- 'spec/models/spree/order_inventory_spec.rb'
|
||||
- 'spec/models/spree/order_spec.rb'
|
||||
- 'spec/models/spree/tax_category_spec.rb'
|
||||
- 'spec/models/spree/variant_spec.rb'
|
||||
@@ -533,7 +383,7 @@ Rails/UniqueValidationWithoutIndex:
|
||||
# Environments: development, test, production
|
||||
Rails/UnknownEnv:
|
||||
Exclude:
|
||||
- 'app/models/spree/app_configuration_decorator.rb'
|
||||
- 'app/models/spree/app_configuration.rb'
|
||||
- 'lib/spree/core/controller_helpers/ssl.rb'
|
||||
|
||||
# Offense count: 2
|
||||
@@ -542,7 +392,7 @@ Style/CaseEquality:
|
||||
- 'app/helpers/angular_form_helper.rb'
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
|
||||
# Offense count: 64
|
||||
# Offense count: 29
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
||||
# SupportedStyles: nested, compact
|
||||
@@ -556,6 +406,7 @@ Style/ClassAndModuleChildren:
|
||||
- 'app/models/tag_rule/filter_order_cycles.rb'
|
||||
- 'app/models/tag_rule/filter_payment_methods.rb'
|
||||
- 'app/models/tag_rule/filter_shipping_methods.rb'
|
||||
- 'app/serializers/api/address_serializer.rb'
|
||||
- 'app/serializers/api/country_serializer.rb'
|
||||
- 'app/serializers/api/currency_config_serializer.rb'
|
||||
- 'app/serializers/api/current_order_serializer.rb'
|
||||
@@ -589,7 +440,7 @@ Style/FormatStringToken:
|
||||
- 'lib/open_food_network/sales_tax_report.rb'
|
||||
- 'spec/features/admin/bulk_order_management_spec.rb'
|
||||
|
||||
# Offense count: 818
|
||||
# Offense count: 765
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: always, always_true, never
|
||||
@@ -781,13 +632,10 @@ Style/FrozenStringLiteralComment:
|
||||
- 'app/models/product_import/unit_converter.rb'
|
||||
- 'app/models/proxy_order.rb'
|
||||
- 'app/models/schedule.rb'
|
||||
- 'app/models/spree/app_configuration_decorator.rb'
|
||||
- 'app/models/spree/gateway/migs.rb'
|
||||
- 'app/models/spree/gateway/pin.rb'
|
||||
- 'app/models/spree/gateway/stripe_connect.rb'
|
||||
- 'app/models/spree/line_item_decorator.rb'
|
||||
- 'app/models/spree/option_type_decorator.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/preferences/file_configuration.rb'
|
||||
- 'app/models/spree/price_decorator.rb'
|
||||
- 'app/models/spree/product_decorator.rb'
|
||||
@@ -976,7 +824,6 @@ Style/FrozenStringLiteralComment:
|
||||
- 'lib/spree/authentication_helpers.rb'
|
||||
- 'lib/spree/localized_number.rb'
|
||||
- 'lib/spree/money_decorator.rb'
|
||||
- 'lib/spree/product_filters.rb'
|
||||
- 'lib/stripe/account_connector.rb'
|
||||
- 'lib/stripe/profile_storer.rb'
|
||||
- 'lib/stripe/webhook_handler.rb'
|
||||
@@ -1044,6 +891,7 @@ Style/FrozenStringLiteralComment:
|
||||
- 'spec/controllers/shops_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/adjustments_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/base_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/general_settings_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/invoices_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/mail_methods_controller_spec.rb'
|
||||
- 'spec/controllers/spree/admin/orders/customer_details_controller_spec.rb'
|
||||
@@ -1197,7 +1045,6 @@ Style/FrozenStringLiteralComment:
|
||||
- 'spec/lib/open_food_network/users_and_enterprises_report_spec.rb'
|
||||
- 'spec/lib/open_food_network/xero_invoices_report_spec.rb'
|
||||
- 'spec/lib/spree/localized_number_spec.rb'
|
||||
- 'spec/lib/spree/product_filters_spec.rb'
|
||||
- 'spec/lib/stripe/account_connector_spec.rb'
|
||||
- 'spec/lib/stripe/webhook_handler_spec.rb'
|
||||
- 'spec/lib/tasks/enterprises_rake_spec.rb'
|
||||
@@ -1241,7 +1088,6 @@ Style/FrozenStringLiteralComment:
|
||||
- 'spec/models/spree/classification_spec.rb'
|
||||
- 'spec/models/spree/credit_card_spec.rb'
|
||||
- 'spec/models/spree/gateway/stripe_connect_spec.rb'
|
||||
- 'spec/models/spree/image_spec.rb'
|
||||
- 'spec/models/spree/line_item_spec.rb'
|
||||
- 'spec/models/spree/order/checkout_spec.rb'
|
||||
- 'spec/models/spree/order_spec.rb'
|
||||
@@ -1348,7 +1194,6 @@ Style/FrozenStringLiteralComment:
|
||||
- 'spec/support/products_helper.rb'
|
||||
- 'spec/support/request/admin_helper.rb'
|
||||
- 'spec/support/request/authentication_helper.rb'
|
||||
- 'spec/support/request/checkout_helper.rb'
|
||||
- 'spec/support/request/cookie_helper.rb'
|
||||
- 'spec/support/request/distribution_helper.rb'
|
||||
- 'spec/support/request/menu_helper.rb'
|
||||
@@ -1367,7 +1212,7 @@ Style/FrozenStringLiteralComment:
|
||||
- 'spec/views/spree/admin/payment_methods/index.html.haml_spec.rb'
|
||||
- 'spec/views/spree/admin/shared/_order_links.html.haml_spec.rb'
|
||||
|
||||
# Offense count: 48
|
||||
# Offense count: 44
|
||||
# Configuration parameters: MinBodyLength.
|
||||
Style/GuardClause:
|
||||
Exclude:
|
||||
@@ -1383,7 +1228,7 @@ Style/GuardClause:
|
||||
- 'app/models/enterprise.rb'
|
||||
- 'app/models/enterprise_group.rb'
|
||||
- 'app/models/producer_property.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/preferences/preferable_class_methods.rb'
|
||||
- 'app/models/spree/price_decorator.rb'
|
||||
- 'app/models/spree/product_decorator.rb'
|
||||
- 'app/services/order_syncer.rb'
|
||||
@@ -1392,25 +1237,15 @@ Style/GuardClause:
|
||||
- 'lib/open_food_network/order_cycle_form_applicator.rb'
|
||||
- 'lib/open_food_network/rack_request_blocker.rb'
|
||||
- 'spec/support/delayed_job_helper.rb'
|
||||
- 'spec/support/request/checkout_helper.rb'
|
||||
- 'spec/support/request/distribution_helper.rb'
|
||||
- 'spec/support/request/shop_workflow.rb'
|
||||
|
||||
# Offense count: 66
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
||||
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
||||
Style/HashSyntax:
|
||||
Exclude:
|
||||
- 'spec/factories/stock_location_factory.rb'
|
||||
- 'spec/models/spree/credit_card_spec.rb'
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Offense count: 3
|
||||
Style/MissingRespondToMissing:
|
||||
Exclude:
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/models/spree/gateway.rb'
|
||||
- 'app/models/spree/preferences/configuration.rb'
|
||||
|
||||
# Offense count: 2
|
||||
Style/MixinUsage:
|
||||
@@ -1418,7 +1253,7 @@ Style/MixinUsage:
|
||||
- 'lib/open_food_network/orders_and_fulfillments_report.rb'
|
||||
- 'spec/lib/open_food_network/packing_report_spec.rb'
|
||||
|
||||
# Offense count: 36
|
||||
# Offense count: 43
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
|
||||
# SupportedStyles: predicate, comparison
|
||||
@@ -1432,8 +1267,11 @@ Style/NumericPredicate:
|
||||
- 'app/models/product_import/product_importer.rb'
|
||||
- 'app/models/product_import/spreadsheet_entry.rb'
|
||||
- 'app/models/spree/gateway/stripe_connect.rb'
|
||||
- 'app/models/spree/line_item_decorator.rb'
|
||||
- 'app/models/spree/order_decorator.rb'
|
||||
- 'app/models/spree/line_item.rb'
|
||||
- 'app/models/spree/order.rb'
|
||||
- 'app/models/spree/order_contents.rb'
|
||||
- 'app/models/spree/order_inventory.rb'
|
||||
- 'app/models/spree/preferences/preferable.rb'
|
||||
- 'app/models/spree/user.rb'
|
||||
- 'app/models/variant_override.rb'
|
||||
- 'app/services/cart_service.rb'
|
||||
@@ -1446,37 +1284,7 @@ Style/NumericPredicate:
|
||||
- 'lib/spree/money_decorator.rb'
|
||||
- 'lib/tasks/sample_data.rake'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: compact, exploded
|
||||
Style/RaiseArgs:
|
||||
Exclude:
|
||||
- 'spec/controllers/checkout_controller_spec.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
Style/RandomWithOffset:
|
||||
Exclude:
|
||||
- 'spec/factories.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
|
||||
# SupportedStyles: slashes, percent_r, mixed
|
||||
Style/RegexpLiteral:
|
||||
Exclude:
|
||||
- 'lib/spree/core/controller_helpers/auth.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle.
|
||||
# SupportedStyles: implicit, explicit
|
||||
Style/RescueStandardError:
|
||||
Exclude:
|
||||
- 'lib/spree/core/delegate_belongs_to.rb'
|
||||
|
||||
# Offense count: 231
|
||||
# Offense count: 241
|
||||
Style/Send:
|
||||
Exclude:
|
||||
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
|
||||
@@ -1501,8 +1309,10 @@ Style/Send:
|
||||
- 'spec/models/enterprise_spec.rb'
|
||||
- 'spec/models/exchange_spec.rb'
|
||||
- 'spec/models/spree/gateway/stripe_connect_spec.rb'
|
||||
- 'spec/models/spree/order_inventory_spec.rb'
|
||||
- 'spec/models/spree/order_spec.rb'
|
||||
- 'spec/models/spree/payment_spec.rb'
|
||||
- 'spec/models/spree/return_authorization_spec.rb'
|
||||
- 'spec/models/spree/tax_rate_spec.rb'
|
||||
- 'spec/models/tag_rule/discount_order_spec.rb'
|
||||
- 'spec/models/tag_rule/filter_order_cycles_spec.rb'
|
||||
@@ -1520,3 +1330,11 @@ Style/Send:
|
||||
Style/StructInheritance:
|
||||
Exclude:
|
||||
- 'lib/open_food_network/enterprise_fee_applicator.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IgnoredMethods.
|
||||
# IgnoredMethods: respond_to, define_method
|
||||
Style/SymbolProc:
|
||||
Exclude:
|
||||
- 'app/models/spree/preferences/preferable.rb'
|
||||
|
||||
@@ -43,7 +43,7 @@ module Spree
|
||||
end
|
||||
end
|
||||
|
||||
disallowed_urls.map!{ |url| url[/\/\w+$/] }
|
||||
disallowed_urls.map!{ |url| url[%r{/\w+$}] }
|
||||
return if disallowed_urls.include?(request.fullpath)
|
||||
|
||||
session['spree_user_return_to'] = request.fullpath.gsub('//', '/')
|
||||
|
||||
@@ -61,7 +61,7 @@ module DelegateBelongsTo
|
||||
methods.reject!{ |x| default_rejected_delegate_columns.include?(x.to_s) }
|
||||
end
|
||||
methods
|
||||
rescue
|
||||
rescue StandardError
|
||||
[]
|
||||
end
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ describe CheckoutController, type: :controller do
|
||||
call_count = 0
|
||||
allow(order_checkout_restart).to receive(:call) do
|
||||
call_count += 1
|
||||
raise Spree::Core::GatewayError.new("Gateway blow up") if call_count == 1
|
||||
raise Spree::Core::GatewayError, "Gateway blow up" if call_count == 1
|
||||
end
|
||||
|
||||
spree_post :edit
|
||||
|
||||
@@ -2,7 +2,7 @@ require 'ffaker'
|
||||
|
||||
FactoryBot.define do
|
||||
sequence(:random_string) { Faker::Lorem.sentence }
|
||||
sequence(:random_description) { Faker::Lorem.paragraphs(1 + Kernel.rand(5)).join("\n") }
|
||||
sequence(:random_description) { Faker::Lorem.paragraphs(Kernel.rand(1..5)).join("\n") }
|
||||
sequence(:random_email) { Faker::Internet.email }
|
||||
|
||||
factory :classification, class: Spree::Classification do
|
||||
@@ -124,4 +124,4 @@ FactoryBot.define do
|
||||
stripe_user_id "abc123"
|
||||
stripe_publishable_key "xyz456"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,4 +27,4 @@ FactoryBot.define do
|
||||
phone { Faker::PhoneNumber.phone_number }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ FactoryBot.define do
|
||||
name 'Alabama'
|
||||
abbr 'AL'
|
||||
country do |country|
|
||||
if usa = Spree::Country.find_by_numcode(840)
|
||||
if usa = Spree::Country.find_by(numcode: 840)
|
||||
country = usa
|
||||
else
|
||||
country.association(:country)
|
||||
|
||||
@@ -20,14 +20,14 @@ FactoryBot.define do
|
||||
end
|
||||
|
||||
factory :stock_location_with_items do
|
||||
after(:create) do |stock_location, evaluator|
|
||||
after(:create) do |stock_location, _evaluator|
|
||||
# variant will add itself to all stock_locations in an after_create
|
||||
# creating a product will automatically create a master variant
|
||||
product_1 = create(:product)
|
||||
product_2 = create(:product)
|
||||
|
||||
stock_location.stock_items.where(:variant_id => product_1.master.id).first.adjust_count_on_hand(10)
|
||||
stock_location.stock_items.where(:variant_id => product_2.master.id).first.adjust_count_on_hand(20)
|
||||
stock_location.stock_items.where(variant_id: product_1.master.id).first.adjust_count_on_hand(10)
|
||||
stock_location.stock_items.where(variant_id: product_2.master.id).first.adjust_count_on_hand(20)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,7 +12,6 @@ feature '
|
||||
# Given a product with a unit-related option type
|
||||
product = create(:simple_product, variant_unit: "weight", variant_unit_scale: "1")
|
||||
|
||||
|
||||
# When I create a variant on the product
|
||||
login_as_admin_and_visit spree.admin_product_variants_path product
|
||||
click_link 'New Variant'
|
||||
|
||||
@@ -83,7 +83,7 @@ RSpec.describe OpenFoodNetwork::OrdersAndFulfillmentsReport::CustomerTotalsRepor
|
||||
|
||||
context "displaying payment fees" do
|
||||
context "with both failed and completed payments present" do
|
||||
let!(:order) {
|
||||
let!(:order) {
|
||||
create(:order_ready_to_ship, user: customer.user,
|
||||
customer: customer, distributor: distributor)
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ module OpenFoodNetwork
|
||||
context "that has granted P-OC to the distributor" do
|
||||
let(:order2) {
|
||||
create(:order, distributor: distributor, completed_at: 1.day.ago,
|
||||
bill_address: create(:address), ship_address: create(:address))
|
||||
bill_address: create(:address), ship_address: create(:address))
|
||||
}
|
||||
let(:line_item2) {
|
||||
build(:line_item_with_shipment, product: create(:simple_product, supplier: supplier))
|
||||
@@ -54,7 +54,7 @@ module OpenFoodNetwork
|
||||
before do
|
||||
order2.line_items << line_item2
|
||||
create(:enterprise_relationship, parent: supplier, child: distributor,
|
||||
permissions_list: [:add_to_order_cycle])
|
||||
permissions_list: [:add_to_order_cycle])
|
||||
end
|
||||
|
||||
it "shows line items supplied by my producers, with names hidden" do
|
||||
@@ -78,7 +78,7 @@ module OpenFoodNetwork
|
||||
context "that has not granted P-OC to the distributor" do
|
||||
let(:order2) {
|
||||
create(:order, distributor: distributor, completed_at: 1.day.ago,
|
||||
bill_address: create(:address), ship_address: create(:address))
|
||||
bill_address: create(:address), ship_address: create(:address))
|
||||
}
|
||||
let(:line_item2) {
|
||||
build(:line_item_with_shipment, product: create(:simple_product, supplier: supplier))
|
||||
|
||||
@@ -27,8 +27,8 @@ module Stripe
|
||||
allow(Stripe).to receive(:api_key) { "sk_test_12345" }
|
||||
|
||||
stub_customers_post_request email: credit_card.user.email,
|
||||
response: { customer_id: new_customer_id },
|
||||
stripe_account_header: true
|
||||
response: { customer_id: new_customer_id },
|
||||
stripe_account_header: true
|
||||
stub_request(:post,
|
||||
"https://api.stripe.com/v1/payment_methods/#{new_payment_method_id}/attach")
|
||||
.with(body: { customer: new_customer_id },
|
||||
|
||||
@@ -512,9 +512,9 @@ describe Enterprise do
|
||||
describe "presentation of attributes" do
|
||||
let(:distributor) {
|
||||
build_stubbed(:distributor_enterprise,
|
||||
website: "http://www.google.com",
|
||||
facebook: "www.facebook.com/roger",
|
||||
linkedin: "https://linkedin.com")
|
||||
website: "http://www.google.com",
|
||||
facebook: "www.facebook.com/roger",
|
||||
linkedin: "https://linkedin.com")
|
||||
}
|
||||
|
||||
it "strips http from url fields" do
|
||||
|
||||
@@ -4,7 +4,6 @@ describe ProductImport::InventoryResetStrategy do
|
||||
let(:inventory_reset) { described_class.new(excluded_items_ids) }
|
||||
|
||||
describe '#reset' do
|
||||
|
||||
context 'when there are excluded_items_ids' do
|
||||
let(:enterprise) { variant.product.supplier }
|
||||
let(:variant) { build_stubbed(:variant) }
|
||||
|
||||
@@ -7,18 +7,18 @@ describe Spree::Address do
|
||||
it "creates a copy of the address with the exception of the id, updated_at and created_at attributes" do
|
||||
state = build_stubbed(:state)
|
||||
original = build_stubbed(:address,
|
||||
address1: 'address1',
|
||||
address2: 'address2',
|
||||
alternative_phone: 'alternative_phone',
|
||||
city: 'city',
|
||||
country: state.country,
|
||||
firstname: 'firstname',
|
||||
lastname: 'lastname',
|
||||
company: 'company',
|
||||
phone: 'phone',
|
||||
state_id: state.id,
|
||||
state_name: state.name,
|
||||
zipcode: 'zip_code')
|
||||
address1: 'address1',
|
||||
address2: 'address2',
|
||||
alternative_phone: 'alternative_phone',
|
||||
city: 'city',
|
||||
country: state.country,
|
||||
firstname: 'firstname',
|
||||
lastname: 'lastname',
|
||||
company: 'company',
|
||||
phone: 'phone',
|
||||
state_id: state.id,
|
||||
state_name: state.name,
|
||||
zipcode: 'zip_code')
|
||||
|
||||
cloned = original.clone
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ module Spree
|
||||
|
||||
it "should be true if payment is checkout" do
|
||||
payment = build_stubbed(:payment, created_at: Time.zone.now)
|
||||
allow(payment).to receive_messages :pending? => false,
|
||||
:checkout? => true
|
||||
allow(payment).to receive_messages pending?: false,
|
||||
checkout?: true
|
||||
expect(credit_card.can_capture?(payment)).to be_truthy
|
||||
end
|
||||
end
|
||||
@@ -54,16 +54,16 @@ module Spree
|
||||
|
||||
it "should be false when order payment_state is not 'credit_owed'" do
|
||||
payment = build_stubbed(:payment,
|
||||
order: create(:order, payment_state: 'paid'))
|
||||
order: create(:order, payment_state: 'paid'))
|
||||
allow(payment).to receive(:completed?) { true }
|
||||
expect(credit_card.can_credit?(payment)).to be_falsy
|
||||
end
|
||||
|
||||
it "should be false when credit_allowed is zero" do
|
||||
payment = build_stubbed(:payment,
|
||||
order: create(:order, payment_state: 'credit_owed'))
|
||||
allow(payment).to receive_messages :completed? => true,
|
||||
:credit_allowed => 0
|
||||
order: create(:order, payment_state: 'credit_owed'))
|
||||
allow(payment).to receive_messages completed?: true,
|
||||
credit_allowed: 0
|
||||
|
||||
expect(credit_card.can_credit?(payment)).to be_falsy
|
||||
end
|
||||
|
||||
@@ -60,7 +60,7 @@ describe Spree::Order::Checkout do
|
||||
it "cannot transition to address without any line items" do
|
||||
expect(order.line_items).to be_blank
|
||||
expect(lambda { order.next! }).to raise_error(StateMachine::InvalidTransition,
|
||||
/#{Spree.t(:there_are_no_items_for_this_order)}/)
|
||||
/#{Spree.t(:there_are_no_items_for_this_order)}/)
|
||||
end
|
||||
|
||||
context "from address" do
|
||||
@@ -83,7 +83,7 @@ describe Spree::Order::Checkout do
|
||||
specify do
|
||||
transition = lambda { order.next! }
|
||||
expect(transition).to raise_error(StateMachine::InvalidTransition,
|
||||
/#{Spree.t(:items_cannot_be_shipped)}/)
|
||||
/#{Spree.t(:items_cannot_be_shipped)}/)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -122,7 +122,7 @@ describe Spree::Order::Checkout do
|
||||
order.state = 'payment'
|
||||
end
|
||||
|
||||
context "when payment is required" do
|
||||
context "when payment is required" do
|
||||
before do
|
||||
allow(order).to receive_messages confirmation_required?: false
|
||||
allow(order).to receive_messages payment_required?: true
|
||||
|
||||
@@ -6,7 +6,7 @@ module Spree
|
||||
describe Spree::Order do
|
||||
let(:order) { build(:order) }
|
||||
let(:updater) { OrderManagement::Order::Updater.new(order) }
|
||||
let(:bogus) { create(:bogus_payment_method, distributors: [create(:enterprise)]) }
|
||||
let(:bogus) { create(:bogus_payment_method, distributors: [create(:enterprise)]) }
|
||||
|
||||
before do
|
||||
# So that Payment#purchase! is called during processing
|
||||
|
||||
@@ -46,8 +46,8 @@ describe Spree::OrderInventory do
|
||||
|
||||
expect(subject.send(:add_to_shipment, shipment, variant, 5)).to eq 5
|
||||
|
||||
units = shipment.inventory_units.group_by &:variant_id
|
||||
units = units[variant.id].group_by &:state
|
||||
units = shipment.inventory_units.group_by(&:variant_id)
|
||||
units = units[variant.id].group_by(&:state)
|
||||
expect(units['backordered'].size).to eq 2
|
||||
expect(units['on_hand'].size).to eq 3
|
||||
end
|
||||
@@ -103,8 +103,8 @@ describe Spree::OrderInventory do
|
||||
|
||||
it 'should destroy backordered units first' do
|
||||
allow(shipment).to receive_messages(inventory_units_for: [build(:inventory_unit, variant_id: variant.id, state: 'backordered'),
|
||||
build(:inventory_unit, variant_id: variant.id, state: 'on_hand'),
|
||||
build(:inventory_unit, variant_id: variant.id, state: 'backordered')])
|
||||
build(:inventory_unit, variant_id: variant.id, state: 'on_hand'),
|
||||
build(:inventory_unit, variant_id: variant.id, state: 'backordered')])
|
||||
|
||||
expect(shipment.inventory_units_for[0]).to receive(:destroy)
|
||||
expect(shipment.inventory_units_for[1]).not_to receive(:destroy)
|
||||
@@ -115,7 +115,7 @@ describe Spree::OrderInventory do
|
||||
|
||||
it 'should destroy unshipped units first' do
|
||||
allow(shipment).to receive_messages(inventory_units_for: [build(:inventory_unit, variant_id: variant.id, state: 'shipped'),
|
||||
build(:inventory_unit, variant_id: variant.id, state: 'on_hand')] )
|
||||
build(:inventory_unit, variant_id: variant.id, state: 'on_hand')] )
|
||||
|
||||
expect(shipment.inventory_units_for[0]).not_to receive(:destroy)
|
||||
expect(shipment.inventory_units_for[1]).to receive(:destroy)
|
||||
@@ -125,7 +125,7 @@ describe Spree::OrderInventory do
|
||||
|
||||
it 'only attempts to destroy as many units as are eligible, and return amount destroyed' do
|
||||
allow(shipment).to receive_messages(inventory_units_for: [build(:inventory_unit, variant_id: variant.id, state: 'shipped'),
|
||||
build(:inventory_unit, variant_id: variant.id, state: 'on_hand')] )
|
||||
build(:inventory_unit, variant_id: variant.id, state: 'on_hand')] )
|
||||
|
||||
expect(shipment.inventory_units_for[0]).not_to receive(:destroy)
|
||||
expect(shipment.inventory_units_for[1]).to receive(:destroy)
|
||||
|
||||
@@ -27,7 +27,7 @@ describe Spree::Order do
|
||||
context "#generate_order_number" do
|
||||
it "should generate a random string" do
|
||||
expect(order.generate_order_number.is_a?(String)).to be_truthy
|
||||
expect((!order.generate_order_number.to_s.empty?)).to be_truthy
|
||||
expect(!order.generate_order_number.to_s.empty?).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ describe Spree::Payment do
|
||||
context 'original specs from Spree' do
|
||||
let(:order) { create(:order) }
|
||||
let(:gateway) do
|
||||
gateway = Spree::Gateway::Bogus.new(:environment => 'test', :active => true)
|
||||
gateway.stub :source_required => true
|
||||
gateway = Spree::Gateway::Bogus.new(environment: 'test', active: true)
|
||||
gateway.stub source_required: true
|
||||
gateway
|
||||
end
|
||||
|
||||
@@ -23,13 +23,13 @@ describe Spree::Payment do
|
||||
let(:amount_in_cents) { payment.amount.to_f * 100 }
|
||||
|
||||
let(:success_response) do
|
||||
double('success_response', :success? => true,
|
||||
:authorization => '123',
|
||||
:avs_result => { 'code' => 'avs-code' },
|
||||
:cvv_result => { 'code' => 'cvv-code', 'message' => "CVV Result"})
|
||||
double('success_response', success?: true,
|
||||
authorization: '123',
|
||||
avs_result: { 'code' => 'avs-code' },
|
||||
cvv_result: { 'code' => 'cvv-code', 'message' => "CVV Result" })
|
||||
end
|
||||
|
||||
let(:failed_response) { double('gateway_response', :success? => false) }
|
||||
let(:failed_response) { double('gateway_response', success?: false) }
|
||||
|
||||
context "extends LocalizedNumber" do
|
||||
subject { build_stubbed(:payment) }
|
||||
@@ -61,7 +61,6 @@ describe Spree::Payment do
|
||||
payment.failure
|
||||
expect(payment.state).to eql('failed')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'invalidate' do
|
||||
@@ -102,10 +101,9 @@ describe Spree::Payment do
|
||||
|
||||
it "should invalidate if payment method doesnt support source" do
|
||||
payment.payment_method.should_receive(:supports?).with(payment.source).and_return(false)
|
||||
expect { payment.process!}.to raise_error(Spree::Core::GatewayError)
|
||||
expect { payment.process! }.to raise_error(Spree::Core::GatewayError)
|
||||
expect(payment.state).to eq('invalid')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "#authorize" do
|
||||
@@ -117,10 +115,10 @@ describe Spree::Payment do
|
||||
end
|
||||
|
||||
it "should call authorize on the gateway with the currency code" do
|
||||
payment.stub :currency => 'GBP'
|
||||
payment.stub currency: 'GBP'
|
||||
payment.payment_method.should_receive(:authorize).with(amount_in_cents,
|
||||
card,
|
||||
hash_including({:currency => "GBP"})).and_return(success_response)
|
||||
hash_including({ currency: "GBP" })).and_return(success_response)
|
||||
payment.authorize!
|
||||
end
|
||||
|
||||
@@ -131,7 +129,7 @@ describe Spree::Payment do
|
||||
|
||||
context "when gateway does not match the environment" do
|
||||
it "should raise an exception" do
|
||||
gateway.stub :environment => "foo"
|
||||
gateway.stub environment: "foo"
|
||||
expect { payment.authorize! }.to raise_error(Spree::Core::GatewayError)
|
||||
end
|
||||
end
|
||||
@@ -182,8 +180,8 @@ describe Spree::Payment do
|
||||
|
||||
context "when gateway does not match the environment" do
|
||||
it "should raise an exception" do
|
||||
gateway.stub :environment => "foo"
|
||||
expect { payment.purchase! }.to raise_error(Spree::Core::GatewayError)
|
||||
gateway.stub environment: "foo"
|
||||
expect { payment.purchase! }.to raise_error(Spree::Core::GatewayError)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -237,7 +235,7 @@ describe Spree::Payment do
|
||||
end
|
||||
|
||||
it "should store the response_code" do
|
||||
gateway.stub :capture => success_response
|
||||
gateway.stub capture: success_response
|
||||
payment.capture!
|
||||
expect(payment.response_code).to eq('123')
|
||||
end
|
||||
@@ -245,7 +243,7 @@ describe Spree::Payment do
|
||||
|
||||
context "if unsuccessful" do
|
||||
it "should not make payment complete" do
|
||||
gateway.stub :capture => failed_response
|
||||
gateway.stub capture: failed_response
|
||||
payment.should_receive(:failure)
|
||||
payment.should_not_receive(:complete)
|
||||
expect { payment.capture! }.to raise_error(Spree::Core::GatewayError)
|
||||
@@ -273,7 +271,7 @@ describe Spree::Payment do
|
||||
|
||||
context "when profiles are supported" do
|
||||
it "should call payment_gateway.void with the payment's response_code" do
|
||||
gateway.stub :payment_profiles_supported? => true
|
||||
gateway.stub payment_profiles_supported?: true
|
||||
gateway.should_receive(:void).with('123', card, anything).and_return(success_response)
|
||||
payment.void_transaction!
|
||||
end
|
||||
@@ -281,7 +279,7 @@ describe Spree::Payment do
|
||||
|
||||
context "when profiles are not supported" do
|
||||
it "should call payment_gateway.void with the payment's response_code" do
|
||||
gateway.stub :payment_profiles_supported? => false
|
||||
gateway.stub payment_profiles_supported?: false
|
||||
gateway.should_receive(:void).with('123', anything).and_return(success_response)
|
||||
payment.void_transaction!
|
||||
end
|
||||
@@ -295,7 +293,7 @@ describe Spree::Payment do
|
||||
context "when gateway does not match the environment" do
|
||||
it "should raise an exception" do
|
||||
payment = build_stubbed(:payment, payment_method: gateway)
|
||||
gateway.stub :environment => "foo"
|
||||
gateway.stub environment: "foo"
|
||||
expect { payment.void_transaction! }.to raise_error(Spree::Core::GatewayError)
|
||||
end
|
||||
end
|
||||
@@ -311,7 +309,7 @@ describe Spree::Payment do
|
||||
|
||||
context "if unsuccessful" do
|
||||
it "should not void the payment" do
|
||||
gateway.stub :void => failed_response
|
||||
gateway.stub void: failed_response
|
||||
payment.should_not_receive(:void)
|
||||
expect { payment.void_transaction! }.to raise_error(Spree::Core::GatewayError)
|
||||
end
|
||||
@@ -335,8 +333,8 @@ describe Spree::Payment do
|
||||
|
||||
context "when outstanding_balance is less than payment amount" do
|
||||
before do
|
||||
payment.order.stub :outstanding_balance => 10
|
||||
payment.stub :credit_allowed => 1000
|
||||
payment.order.stub outstanding_balance: 10
|
||||
payment.stub credit_allowed: 1000
|
||||
end
|
||||
|
||||
it "should call credit on the gateway with the credit amount and response_code" do
|
||||
@@ -347,7 +345,7 @@ describe Spree::Payment do
|
||||
|
||||
context "when outstanding_balance is equal to payment amount" do
|
||||
before do
|
||||
payment.order.stub :outstanding_balance => payment.amount
|
||||
payment.order.stub outstanding_balance: payment.amount
|
||||
end
|
||||
|
||||
it "should call credit on the gateway with the credit amount and response_code" do
|
||||
@@ -358,7 +356,7 @@ describe Spree::Payment do
|
||||
|
||||
context "when outstanding_balance is greater than payment amount" do
|
||||
before do
|
||||
payment.order.stub :outstanding_balance => 101
|
||||
payment.order.stub outstanding_balance: 101
|
||||
end
|
||||
|
||||
it "should call credit on the gateway with the original payment amount and response_code" do
|
||||
@@ -375,7 +373,7 @@ describe Spree::Payment do
|
||||
context "when gateway does not match the environment" do
|
||||
it "should raise an exception" do
|
||||
payment = build_stubbed(:payment, payment_method: gateway)
|
||||
gateway.stub :environment => "foo"
|
||||
gateway.stub environment: "foo"
|
||||
expect { payment.credit! }.to raise_error(Spree::Core::GatewayError)
|
||||
end
|
||||
end
|
||||
@@ -421,7 +419,7 @@ describe Spree::Payment do
|
||||
|
||||
context "when response is unsuccessful" do
|
||||
it "should not create a payment" do
|
||||
gateway.stub :credit => failed_response
|
||||
gateway.stub credit: failed_response
|
||||
Spree::Payment.should_not_receive(:create)
|
||||
expect { payment.credit! }.to raise_error(Spree::Core::GatewayError)
|
||||
end
|
||||
@@ -451,7 +449,7 @@ describe Spree::Payment do
|
||||
context "raises no error if source is not specified" do
|
||||
specify do
|
||||
payment = build_stubbed(:payment, source: nil, payment_method: gateway)
|
||||
payment.payment_method.stub(:source_required? => false)
|
||||
payment.payment_method.stub(source_required?: false)
|
||||
expect { payment.process! }.not_to raise_error
|
||||
end
|
||||
end
|
||||
@@ -519,18 +517,17 @@ describe Spree::Payment do
|
||||
gateway.save!
|
||||
|
||||
order = create(:order)
|
||||
payment = Spree::Payment.create(:amount => 100, :order => order, :payment_method => gateway)
|
||||
payment = Spree::Payment.create(amount: 100, order: order, payment_method: gateway)
|
||||
order.should_receive(:update!)
|
||||
payment.save
|
||||
end
|
||||
|
||||
context "when profiles are supported" do
|
||||
before do
|
||||
gateway.stub :payment_profiles_supported? => true
|
||||
payment.source.stub :has_payment_profile? => false
|
||||
gateway.stub payment_profiles_supported?: true
|
||||
payment.source.stub has_payment_profile?: false
|
||||
end
|
||||
|
||||
|
||||
context "when there is an error connecting to the gateway" do
|
||||
it "should call gateway_error " do
|
||||
pending '[Spree build] Failing spec'
|
||||
@@ -539,10 +536,10 @@ describe Spree::Payment do
|
||||
expect(gateway).to receive(:create_profile).and_raise(connection_error)
|
||||
expect do
|
||||
Spree::Payment.create(
|
||||
:amount => 100,
|
||||
:order => order,
|
||||
:source => card,
|
||||
:payment_method => gateway
|
||||
amount: 100,
|
||||
order: order,
|
||||
source: card,
|
||||
payment_method: gateway
|
||||
)
|
||||
end.should raise_error(Spree::Core::GatewayError)
|
||||
end
|
||||
@@ -560,19 +557,17 @@ describe Spree::Payment do
|
||||
expect(gateway).to receive(:create_profile)
|
||||
|
||||
Spree::Payment.create(
|
||||
:amount => 100,
|
||||
:order => create(:order),
|
||||
:source => card,
|
||||
:payment_method => gateway
|
||||
amount: 100,
|
||||
order: create(:order),
|
||||
source: card,
|
||||
payment_method: gateway
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
context "when profiles are not supported" do
|
||||
before { gateway.stub :payment_profiles_supported? => false }
|
||||
before { gateway.stub payment_profiles_supported?: false }
|
||||
|
||||
it "should not create a payment profile" do
|
||||
gateway.name = 'Gateway'
|
||||
@@ -581,10 +576,10 @@ describe Spree::Payment do
|
||||
|
||||
gateway.should_not_receive :create_profile
|
||||
payment = Spree::Payment.create(
|
||||
:amount => 100,
|
||||
:order => create(:order),
|
||||
:source => card,
|
||||
:payment_method => gateway
|
||||
amount: 100,
|
||||
order: create(:order),
|
||||
source: card,
|
||||
payment_method: gateway
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -592,13 +587,12 @@ describe Spree::Payment do
|
||||
|
||||
context "#build_source" do
|
||||
it "should build the payment's source" do
|
||||
params = { :amount => 100, :payment_method => gateway,
|
||||
:source_attributes => {
|
||||
:expiry =>"1 / 99",
|
||||
:number => '1234567890123',
|
||||
:verification_value => '123'
|
||||
}
|
||||
}
|
||||
params = { amount: 100, payment_method: gateway,
|
||||
source_attributes: {
|
||||
expiry: "1 / 99",
|
||||
number: '1234567890123',
|
||||
verification_value: '123'
|
||||
} }
|
||||
|
||||
payment = Spree::Payment.new(params)
|
||||
expect(payment).to be_valid
|
||||
@@ -606,8 +600,8 @@ describe Spree::Payment do
|
||||
end
|
||||
|
||||
it "errors when payment source not valid" do
|
||||
params = { :amount => 100, :payment_method => gateway,
|
||||
:source_attributes => {:expiry => "1 / 12" }}
|
||||
params = { amount: 100, payment_method: gateway,
|
||||
source_attributes: { expiry: "1 / 12" } }
|
||||
|
||||
payment = Spree::Payment.new(params)
|
||||
expect(payment).not_to be_valid
|
||||
@@ -633,7 +627,7 @@ describe Spree::Payment do
|
||||
|
||||
# Regression test for #2216
|
||||
context "#gateway_options" do
|
||||
before { order.stub(:last_ip_address => "192.168.1.1") }
|
||||
before { order.stub(last_ip_address: "192.168.1.1") }
|
||||
|
||||
it "contains an IP" do
|
||||
expect(payment.gateway_options[:ip]).to eq(order.last_ip_address)
|
||||
@@ -823,7 +817,7 @@ describe Spree::Payment do
|
||||
|
||||
it "creates adjustment" do
|
||||
payment = create(:payment, order: order, payment_method: payment_method,
|
||||
amount: order.total)
|
||||
amount: order.total)
|
||||
expect(payment.adjustment).to be_present
|
||||
expect(payment.adjustment.amount).not_to eq(0)
|
||||
end
|
||||
|
||||
@@ -107,7 +107,6 @@ describe Spree::Zone do
|
||||
before { state_zone.members.create(zoneable: state) }
|
||||
|
||||
it "should be true" do
|
||||
|
||||
expect(state_zone.include?(address)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,18 +20,18 @@ describe 'api/orders', type: :request do
|
||||
response(200, 'get orders') do
|
||||
# Adds model metadata for Swagger UI. Ideally we'd be able to just add:
|
||||
# schema '$ref' => '#/components/schemas/Order_Concise'
|
||||
# Which would also validate the response in the test, this is an open
|
||||
# Which would also validate the response in the test, this is an open
|
||||
# issue with rswag: https://github.com/rswag/rswag/issues/268
|
||||
metadata[:response][:content] = {
|
||||
metadata[:response][:content] = {
|
||||
"application/json": {
|
||||
schema: {'$ref' => '#/components/schemas/Order_Concise'}
|
||||
schema: { '$ref' => '#/components/schemas/Order_Concise' }
|
||||
}
|
||||
}
|
||||
context "when there are four orders with different properties set" do
|
||||
let!(:order_dist_1) { create(:order_with_distributor, email: "specific_name@example.com") }
|
||||
let!(:order_dist_2) { create(:order_with_totals_and_distribution) }
|
||||
let!(:order_dist_1_complete) { create(:order, distributor: order_dist_1.distributor, state: 'complete', completed_at: Time.zone.today - 7.days) }
|
||||
let!(:order_dist_1_credit_owed) { create(:order, distributor: order_dist_1.distributor, payment_state: 'credit_owed', completed_at: Time.zone.today) }
|
||||
let!(:order_dist_1_complete) { create(:order, distributor: order_dist_1.distributor, state: 'complete', completed_at: Time.zone.today - 7.days) }
|
||||
let!(:order_dist_1_credit_owed) { create(:order, distributor: order_dist_1.distributor, payment_state: 'credit_owed', completed_at: Time.zone.today) }
|
||||
|
||||
let(:user) { order_dist_1.distributor.owner }
|
||||
let(:'X-Spree-Token') do
|
||||
@@ -64,7 +64,7 @@ describe 'api/orders', type: :request do
|
||||
end
|
||||
end
|
||||
|
||||
context "and queried within a date range" do
|
||||
context "and queried within a date range" do
|
||||
let(:'q[completed_at_gt]') { Time.zone.today - 7.days - 1.second }
|
||||
let(:'q[completed_at_lt]') { Time.zone.today - 6.days }
|
||||
|
||||
@@ -116,7 +116,7 @@ describe 'api/orders', type: :request do
|
||||
|
||||
context "and queried by a specific order_cycle" do
|
||||
let(:'q[order_cycle_id_eq]') {
|
||||
order_dist_2.order_cycle.id
|
||||
order_dist_2.order_cycle.id
|
||||
}
|
||||
|
||||
before { order_dist_2.distributor.update_attributes owner: user }
|
||||
|
||||
@@ -38,7 +38,7 @@ describe Checkout::FormDataAdapter do
|
||||
|
||||
describe "and a credit card is provided" do
|
||||
before do
|
||||
params[:order][:payments_attributes].first[:source_attributes] = {number: "4444333322221111"}
|
||||
params[:order][:payments_attributes].first[:source_attributes] = { number: "4444333322221111" }
|
||||
end
|
||||
|
||||
it "fills in missing credit card brand" do
|
||||
|
||||
@@ -108,7 +108,7 @@ describe UserLocaleSetter do
|
||||
end
|
||||
|
||||
context "with a locale set in cookies" do
|
||||
let(:cookies) { {locale: "es"} }
|
||||
let(:cookies) { { locale: "es" } }
|
||||
|
||||
it "set the user's locale to the cookie value" do
|
||||
service.ensure_valid_locale_persisted
|
||||
|
||||
@@ -17,9 +17,9 @@ Check out our repo! https://github.com/openfoodfoundation/openfoodnetwork',
|
||||
components: {
|
||||
securitySchemes: {
|
||||
api_key: {
|
||||
type: :apiKey,
|
||||
name: 'X-Spree-Token',
|
||||
in: :header
|
||||
type: :apiKey,
|
||||
name: 'X-Spree-Token',
|
||||
in: :header
|
||||
}
|
||||
},
|
||||
schemas: {
|
||||
|
||||
@@ -9,15 +9,15 @@ describe "spree/admin/payment_methods/index.html.haml" do
|
||||
|
||||
def new_object_url() "" end
|
||||
|
||||
def edit_object_url(object, options = {}) "" end
|
||||
def edit_object_url(_object, _options = {}) "" end
|
||||
|
||||
def object_url(object = nil, options = {}) "" end
|
||||
def object_url(_object = nil, _options = {}) "" end
|
||||
end
|
||||
|
||||
assign(:payment_methods, [
|
||||
create(:payment_method),
|
||||
create(:payment_method)
|
||||
])
|
||||
create(:payment_method),
|
||||
create(:payment_method)
|
||||
])
|
||||
end
|
||||
|
||||
describe "payment methods index page" do
|
||||
|
||||
Reference in New Issue
Block a user