From 90bdd84ee9eb866b78efae0d7967410d23a95c99 Mon Sep 17 00:00:00 2001 From: Priyank Gupta Date: Thu, 2 Jun 2016 14:09:50 +0530 Subject: [PATCH] change hash syntax for ruby >= 1.9 --- api/Gemfile | 2 +- .../spree/api/v1/addresses_controller.rb | 2 +- .../api/v1/inventory_units_controller.rb | 6 +- .../spree/api/v1/option_types_controller.rb | 4 +- .../spree/api/v1/option_values_controller.rb | 6 +- .../spree/api/v1/products_controller.rb | 10 +- .../spree/api/v1/stock_items_controller.rb | 2 +- .../api/v1/stock_locations_controller.rb | 2 +- .../spree/api/v1/taxonomies_controller.rb | 8 +- .../spree/api/v1/users_controller.rb | 6 +- .../spree/api/v1/zones_controller.rb | 6 +- api/app/models/spree/api_configuration.rb | 2 +- .../spree/api/errors/invalid_api_key.v1.rabl | 2 +- .../spree/api/errors/invalid_resource.v1.rabl | 2 +- .../api/errors/must_specify_api_key.v1.rabl | 2 +- .../views/spree/api/errors/not_found.v1.rabl | 2 +- .../spree/api/errors/unauthorized.v1.rabl | 2 +- .../views/spree/api/v1/countries/show.v1.rabl | 2 +- .../spree/api/v1/line_items/show.v1.rabl | 4 +- .../spree/api/v1/option_types/show.v1.rabl | 2 +- .../v1/orders/invalid_shipping_method.v1.rabl | 2 +- .../views/spree/api/v1/orders/payment.v1.rabl | 2 +- .../views/spree/api/v1/orders/show.v1.rabl | 18 +- .../api/v1/payments/credit_over_limit.v1.rabl | 2 +- .../api/v1/payments/update_forbidden.v1.rabl | 2 +- .../views/spree/api/v1/products/show.v1.rabl | 10 +- .../shipments/cannot_ready_shipment.v1.rabl | 2 +- .../views/spree/api/v1/shipments/show.v1.rabl | 14 +- .../spree/api/v1/shipments/small.v1.rabl | 16 +- .../views/spree/api/v1/taxonomies/jstree.rabl | 4 +- .../spree/api/v1/taxonomies/nested.v1.rabl | 4 +- api/app/views/spree/api/v1/taxons/jstree.rabl | 6 +- .../views/spree/api/v1/taxons/show.v1.rabl | 2 +- .../views/spree/api/v1/taxons/taxons.v1.rabl | 2 +- api/app/views/spree/api/v1/users/show.v1.rabl | 4 +- .../views/spree/api/v1/variants/big.v1.rabl | 6 +- .../views/spree/api/v1/variants/small.v1.rabl | 4 +- api/app/views/spree/api/v1/zones/show.v1.rabl | 2 +- ...100107141738_add_api_key_to_spree_users.rb | 2 +- .../20120411123334_resize_api_key_field.rb | 2 +- api/lib/spree/api/engine.rb | 2 +- api/lib/spree/api/responders/rabl_template.rb | 2 +- api/lib/spree/api/testing_support/caching.rb | 4 +- .../spree/api/base_controller_spec.rb | 14 +- .../spree/api/v1/addresses_controller_spec.rb | 20 +- .../spree/api/v1/checkouts_controller_spec.rb | 6 +- .../spree/api/v1/countries_controller_spec.rb | 10 +- .../api/v1/credit_cards_controller_spec.rb | 10 +- .../spree/api/v1/images_controller_spec.rb | 30 +-- .../api/v1/inventory_units_controller_spec.rb | 22 +- .../api/v1/line_items_controller_spec.rb | 36 ++-- .../api/v1/option_types_controller_spec.rb | 42 ++-- .../api/v1/option_values_controller_spec.rb | 54 ++--- .../spree/api/v1/orders_controller_spec.rb | 122 +++++------ .../spree/api/v1/payments_controller_spec.rb | 44 ++-- .../v1/product_properties_controller_spec.rb | 30 +-- .../spree/api/v1/products_controller_spec.rb | 82 ++++---- .../api/v1/promotion_application_spec.rb | 8 +- .../api/v1/promotions_controller_spec.rb | 2 +- .../api/v1/properties_controller_spec.rb | 30 +-- .../return_authorizations_controller_spec.rb | 60 +++--- .../spree/api/v1/shipments_controller_spec.rb | 10 +- .../spree/api/v1/states_controller_spec.rb | 20 +- .../api/v1/stock_items_controller_spec.rb | 2 +- .../api/v1/stock_locations_controller_spec.rb | 8 +- .../api/v1/stock_movements_controller_spec.rb | 2 +- .../api/v1/taxonomies_controller_spec.rb | 32 +-- .../spree/api/v1/taxons_controller_spec.rb | 42 ++-- ...nauthenticated_products_controller_spec.rb | 2 +- .../spree/api/v1/users_controller_spec.rb | 26 +-- .../spree/api/v1/variants_controller_spec.rb | 34 +-- .../spree/api/v1/zones_controller_spec.rb | 28 +-- api/spec/models/spree/legacy_user_spec.rb | 2 +- api/spec/requests/rabl_cache_spec.rb | 6 +- .../protect_product_actions.rb | 6 +- api/spec/spec_helper.rb | 6 +- api/spec/support/controller_hacks.rb | 2 +- .../admin/product_properties_controller.rb | 2 +- .../admin/promotion_actions_controller.rb | 10 +- .../spree/admin/promotion_rules_controller.rb | 10 +- .../spree/admin/prototypes_controller.rb | 4 +- .../spree/admin/reports_controller.rb | 2 +- .../spree/admin/resource_controller.rb | 12 +- .../admin/return_authorizations_controller.rb | 2 +- .../admin/shipping_methods_controller.rb | 4 +- .../spree/admin/states_controller.rb | 2 +- .../spree/admin/stock_movements_controller.rb | 2 +- .../spree/admin/users_controller.rb | 6 +- .../spree/admin/variants_controller.rb | 2 +- .../app/views/kaminari/_first_page.html.erb | 2 +- .../app/views/kaminari/_last_page.html.erb | 2 +- .../app/views/kaminari/_next_page.html.erb | 2 +- backend/app/views/kaminari/_page.html.erb | 2 +- .../app/views/kaminari/_prev_page.html.erb | 2 +- .../spree/admin/adjustments/_form.html.erb | 8 +- .../spree/admin/countries/_form.html.erb | 4 +- .../views/spree/admin/countries/edit.html.erb | 6 +- .../spree/admin/countries/index.html.erb | 6 +- .../views/spree/admin/countries/new.html.erb | 6 +- .../views/spree/admin/images/_form.html.erb | 4 +- .../spree/admin/option_types/_form.html.erb | 4 +- .../spree/admin/option_types/edit.html.erb | 10 +- .../spree/admin/option_types/new.html.erb | 6 +- .../spree/admin/orders/_shipment.html.erb | 4 +- .../views/spree/admin/orders/index.html.erb | 40 ++-- .../admin/payment_methods/_form.html.erb | 10 +- .../admin/payment_methods/index.html.erb | 6 +- .../views/spree/admin/payments/_form.html.erb | 12 +- .../payments/source_forms/_gateway.html.erb | 12 +- .../spree/admin/products/_properties_form.erb | 2 +- .../views/spree/admin/products/index.html.erb | 12 +- .../views/spree/admin/products/new.html.erb | 32 +-- .../admin/promotion_categories/_form.html.erb | 6 +- .../admin/promotion_categories/edit.html.erb | 6 +- .../admin/promotion_categories/index.html.erb | 6 +- .../admin/promotion_categories/new.html.erb | 6 +- .../spree/admin/promotions/_actions.html.erb | 8 +- .../spree/admin/promotions/_form.html.erb | 20 +- .../spree/admin/promotions/_rules.html.erb | 8 +- .../actions/_create_adjustment.html.erb | 2 +- .../actions/_create_item_adjustments.html.erb | 4 +- .../spree/admin/promotions/edit.html.erb | 12 +- .../spree/admin/promotions/index.html.erb | 10 +- .../views/spree/admin/promotions/new.html.erb | 6 +- .../promotions/rules/_landing_page.html.erb | 2 +- .../admin/promotions/rules/_product.html.erb | 4 +- .../admin/promotions/rules/_taxon.html.erb | 4 +- .../spree/admin/properties/_form.html.erb | 4 +- .../spree/admin/properties/edit.html.erb | 6 +- .../spree/admin/properties/index.html.erb | 12 +- .../admin/prototypes/_prototypes.html.erb | 2 +- .../spree/admin/prototypes/available.js.erb | 2 +- .../spree/admin/prototypes/edit.html.erb | 6 +- .../spree/admin/prototypes/index.html.erb | 6 +- .../views/spree/admin/prototypes/new.html.erb | 6 +- .../spree/admin/prototypes/show.html.erb | 2 +- .../spree/admin/reports/sales_total.html.erb | 2 +- .../return_authorizations/_form.html.erb | 2 +- .../app/views/spree/admin/roles/edit.html.erb | 2 +- .../app/views/spree/admin/roles/new.html.erb | 2 +- .../app/views/spree/admin/search/users.rabl | 4 +- .../admin/shared/_calculator_fields.html.erb | 4 +- .../views/spree/admin/shared/_destroy.js.erb | 2 +- .../shared/_edit_resource_links.html.erb | 2 +- .../views/spree/admin/shared/_head.html.erb | 2 +- .../admin/shared/_new_resource_links.html.erb | 2 +- .../admin/shared/_order_summary.html.erb | 6 +- .../spree/admin/shared/_refunds.html.erb | 2 +- .../shared/_report_order_criteria.html.erb | 6 +- .../spree/admin/shared/_translations.html.erb | 73 +++---- .../spree/admin/shared/_update_order_state.js | 6 +- .../admin/shared/named_types/_index.html.erb | 2 +- .../admin/shared/sub_menu/_product.html.erb | 2 +- .../admin/shipping_categories/edit.html.erb | 6 +- .../admin/shipping_categories/index.html.erb | 6 +- .../admin/shipping_categories/new.html.erb | 6 +- .../admin/shipping_methods/_form.html.erb | 28 +-- .../admin/shipping_methods/edit.html.erb | 6 +- .../admin/shipping_methods/index.html.erb | 6 +- .../spree/admin/shipping_methods/new.html.erb | 6 +- .../views/spree/admin/states/_form.html.erb | 4 +- .../spree/admin/states/_state_list.html.erb | 4 +- .../views/spree/admin/states/edit.html.erb | 6 +- .../views/spree/admin/states/index.html.erb | 6 +- .../app/views/spree/admin/states/new.html.erb | 6 +- .../_transfer_stock_form.html.erb | 2 +- .../spree/admin/stock_locations/edit.html.erb | 6 +- .../admin/stock_locations/index.html.erb | 6 +- .../spree/admin/stock_locations/new.html.erb | 6 +- .../admin/stock_transfers/index.html.erb | 6 +- .../spree/admin/stock_transfers/new.html.erb | 2 +- .../spree/admin/stock_transfers/show.html.erb | 6 +- .../spree/admin/tax_categories/_form.html.erb | 14 +- .../spree/admin/tax_categories/edit.html.erb | 6 +- .../spree/admin/tax_categories/new.html.erb | 6 +- .../spree/admin/tax_rates/_form.html.erb | 10 +- .../views/spree/admin/tax_rates/edit.html.erb | 6 +- .../views/spree/admin/tax_rates/new.html.erb | 6 +- .../spree/admin/taxonomies/_form.html.erb | 4 +- .../views/spree/admin/taxonomies/new.html.erb | 2 +- .../views/spree/admin/taxons/_form.html.erb | 14 +- .../spree/admin/taxons/_taxon_table.html.erb | 2 +- .../views/spree/admin/taxons/index.html.erb | 2 +- .../views/spree/admin/trackers/_form.html.erb | 2 +- .../views/spree/admin/trackers/edit.html.erb | 6 +- .../views/spree/admin/trackers/index.html.erb | 6 +- .../views/spree/admin/trackers/new.html.erb | 6 +- .../admin/users/_addresses_form.html.erb | 4 +- .../views/spree/admin/users/_form.html.erb | 6 +- .../views/spree/admin/users/index.html.erb | 14 +- .../app/views/spree/admin/users/new.html.erb | 6 +- .../views/spree/admin/variants/_form.html.erb | 14 +- .../views/spree/admin/variants/new.html.erb | 6 +- .../admin/zones/_country_members.html.erb | 2 +- .../views/spree/admin/zones/_form.html.erb | 12 +- .../spree/admin/zones/_state_members.html.erb | 2 +- .../app/views/spree/admin/zones/edit.html.erb | 6 +- .../views/spree/admin/zones/index.html.erb | 10 +- .../app/views/spree/admin/zones/new.html.erb | 6 +- backend/lib/spree/backend/engine.rb | 4 +- .../admin/customer_returns_controller_spec.rb | 2 +- .../admin/general_settings_controller_spec.rb | 2 +- .../admin/missing_products_controller_spec.rb | 4 +- .../admin/payment_methods_controller_spec.rb | 14 +- .../spree/admin/payments_controller_spec.rb | 10 +- .../spree/admin/products_controller_spec.rb | 10 +- .../promotion_actions_controller_spec.rb | 6 +- .../admin/promotion_rules_controller_spec.rb | 6 +- .../spree/admin/promotions_controller_spec.rb | 2 +- .../admin/reimbursements_controller_spec.rb | 2 +- .../spree/admin/reports_controller_spec.rb | 2 +- .../spree/admin/resource_controller_spec.rb | 2 +- .../return_authorizations_controller_spec.rb | 2 +- .../admin/return_items_controller_spec.rb | 2 +- .../spree/admin/search_controller_spec.rb | 20 +- .../admin/shipping_methods_controller_spec.rb | 6 +- .../admin/stock_items_controller_spec.rb | 2 +- .../admin/stock_locations_controller_spec.rb | 2 +- .../admin/stock_transfers_controller_spec.rb | 6 +- .../admin/tax_categories_controller_spec.rb | 2 +- .../spree/admin/users_controller_spec.rb | 22 +- .../spree/admin/variants_controller_spec.rb | 2 +- .../admin/configuration/states_spec.rb | 4 +- .../admin/configuration/zones_spec.rb | 8 +- backend/spec/features/admin/homepage_spec.rb | 2 +- backend/spec/features/admin/locale_spec.rb | 14 +- .../orders/adjustments_promotions_spec.rb | 12 +- .../features/admin/orders/adjustments_spec.rb | 10 +- .../orders/cancelling_and_resuming_spec.rb | 2 +- .../features/admin/orders/line_items_spec.rb | 6 +- .../features/admin/orders/log_entries_spec.rb | 14 +- .../features/admin/orders/new_order_spec.rb | 2 +- .../admin/orders/risk_analysis_spec.rb | 2 +- .../admin/products/edit/products_spec.rb | 4 +- .../admin/products/option_types_spec.rb | 2 +- .../features/admin/products/products_spec.rb | 26 +-- .../admin/products/stock_management_spec.rb | 2 +- .../admin/promotions/adjustments_spec.rb | 4 +- backend/spec/features/admin/reports_spec.rb | 16 +- backend/spec/features/admin/users_spec.rb | 6 +- .../spec/helpers/admin/base_helper_spec.rb | 2 +- .../admin/stock_movements_helper_spec.rb | 2 +- backend/spec/spec_helper.rb | 2 +- .../install/install_generator.rb.tt | 6 +- core/app/models/spree/gateway/bogus.rb | 20 +- core/app/models/spree/gateway/bogus_simple.rb | 8 +- core/app/models/spree/image.rb | 4 +- core/app/models/spree/order_updater.rb | 2 +- core/app/models/spree/payment/processing.rb | 2 +- core/app/models/spree/preferences/store.rb | 4 +- core/app/models/spree/product/scopes.rb | 18 +- .../promotion/actions/create_line_items.rb | 2 +- .../models/spree/promotion_handler/coupon.rb | 2 +- .../models/spree/promotion_handler/page.rb | 4 +- core/app/models/spree/return_item.rb | 2 +- core/db/default/spree/roles.rb | 4 +- .../migrate/20120831092320_spree_one_two.rb | 198 +++++++++--------- .../20120831092359_spree_promo_one_two.rb | 24 +-- ...20905151823_add_toggle_tax_rate_display.rb | 2 +- ...21009142519_add_lock_version_to_variant.rb | 2 +- ...142909_add_states_required_to_countries.rb | 2 +- ...49_add_on_demand_to_product_and_variant.rb | 4 +- ...t_null_constraint_from_products_on_hand.rb | 8 +- ...121031162139_split_prices_from_variants.rb | 14 +- ...emove_not_null_from_spree_prices_amount.rb | 4 +- ...109173623_add_cost_currency_to_variants.rb | 2 +- ...121124203911_add_position_to_taxonomies.rb | 2 +- ...dd_position_to_product_properties.spree.rb | 2 +- ...20130211190146_create_spree_stock_items.rb | 2 +- ...a_description_on_spree_products_to_text.rb | 2 +- ...227143905_add_pending_to_inventory_unit.rb | 4 +- ...30228210442_create_shipping_method_zone.rb | 2 +- ...62924_create_shipping_method_categories.rb | 4 +- ...30304162240_create_spree_shipping_rates.rb | 8 +- ...01_add_address_fields_to_stock_location.rb | 4 +- ...917_add_active_field_to_stock_locations.rb | 2 +- ...6195650_add_backorderable_to_stock_item.rb | 2 +- ..._add_default_quantity_to_stock_movement.rb | 2 +- ...319062004_change_orders_total_precision.rb | 8 +- ..._change_spree_payments_amount_precision.rb | 2 +- ...e_return_authorization_amount_precision.rb | 2 +- ...943_change_adjustments_amount_precision.rb | 2 +- ...rce_and_destination_from_stock_movement.rb | 4 +- ..._migrate_inventory_unit_sold_to_on_hand.rb | 4 +- ...20130417120035_update_adjustment_states.rb | 4 +- ...7123427_add_shipping_rates_to_shipments.rb | 6 +- ...ue_index_to_permalink_on_spree_products.rb | 2 +- ...to_orders_shipments_and_stock_transfers.rb | 6 +- ...30718042445_add_cost_price_to_line_item.rb | 2 +- ...5_set_backorderable_to_default_to_false.rb | 4 +- .../20130807024301_upgrade_adjustments.rb | 6 +- ...4002_add_shipment_total_to_spree_orders.rb | 2 +- ...20130813140619_expand_order_number_size.rb | 4 +- ...0406_add_adjustment_total_to_line_items.rb | 2 +- ...24413_add_adjustment_total_to_shipments.rb | 2 +- ...tegory_to_shipping_methods_and_products.rb | 2 +- ...26154747_add_track_inventory_to_variant.rb | 2 +- ...31118043959_add_included_to_adjustments.rb | 2 +- ...11112807_create_spree_orders_promotions.rb | 2 +- ...18054603_add_item_count_to_spree_orders.rb | 2 +- ...19060952_add_considered_risky_to_orders.rb | 2 +- ...342_change_spree_price_amount_precision.rb | 8 +- ...e_order_token_from_tokenized_permission.rb | 2 +- ...20140718195325_create_friendly_id_slugs.rb | 8 +- .../custom_user/templates/migration.rb.tt | 2 +- .../generators/spree/dummy/dummy_generator.rb | 22 +- .../dummy/templates/rails/application.rb | 2 +- .../spree/install/install_generator.rb | 20 +- .../spree/core/controller_helpers/common.rb | 4 +- .../core/controller_helpers/respond_with.rb | 2 +- core/lib/spree/core/delegate_belongs_to.rb | 2 +- core/lib/spree/core/product_duplicator.rb | 2 +- core/lib/spree/testing_support/caching.rb | 6 +- .../testing_support/controller_requests.rb | 4 +- .../testing_support/order_walkthrough.rb | 8 +- core/lib/tasks/core.rake | 4 +- core/spec/helpers/base_helper_spec.rb | 20 +- core/spec/helpers/products_helper_spec.rb | 10 +- core/spec/lib/i18n_spec.rb | 22 +- core/spec/lib/search/base_spec.rb | 22 +- core/spec/lib/spree/localized_number_spec.rb | 2 +- core/spec/lib/spree/money_spec.rb | 12 +- .../spec/mailers/reimbursement_mailer_spec.rb | 4 +- core/spec/mailers/test_mailer_spec.rb | 2 +- core/spec/models/spree/ability_spec.rb | 4 +- core/spec/models/spree/address_spec.rb | 56 ++--- core/spec/models/spree/adjustment_spec.rb | 2 +- .../models/spree/app_configuration_spec.rb | 2 +- core/spec/models/spree/asset_spec.rb | 2 +- .../flat_percent_item_total_spec.rb | 2 +- .../spree/calculator/flexi_rate_spec.rb | 12 +- .../calculator/percent_on_line_item_spec.rb | 2 +- .../spree/calculator/price_sack_spec.rb | 4 +- .../refunds/default_refund_amount_spec.rb | 2 +- .../shipping/flat_percent_item_total_spec.rb | 8 +- .../calculator/shipping/flat_rate_spec.rb | 4 +- .../calculator/shipping/flexi_rate_spec.rb | 12 +- .../calculator/shipping/per_item_spec.rb | 4 +- .../spree/calculator/tiered_flat_rate_spec.rb | 2 +- .../spree/calculator/tiered_percent_spec.rb | 2 +- core/spec/models/spree/calculator_spec.rb | 6 +- core/spec/models/spree/classification_spec.rb | 2 +- core/spec/models/spree/credit_card_spec.rb | 2 +- core/spec/models/spree/exchange_spec.rb | 2 +- .../spec/models/spree/gateway/bogus_simple.rb | 2 +- core/spec/models/spree/gateway/bogus_spec.rb | 2 +- core/spec/models/spree/gateway_spec.rb | 2 +- core/spec/models/spree/image_spec.rb | 2 +- core/spec/models/spree/inventory_unit_spec.rb | 2 +- core/spec/models/spree/option_type_spec.rb | 2 +- core/spec/models/spree/order/address_spec.rb | 2 +- .../models/spree/order/adjustments_spec.rb | 2 +- .../spec/models/spree/order/callbacks_spec.rb | 6 +- core/spec/models/spree/order/checkout_spec.rb | 78 +++---- .../spree/order/currency_updater_spec.rb | 2 +- .../models/spree/order/finalizing_spec.rb | 10 +- core/spec/models/spree/order/helpers_spec.rb | 2 +- core/spec/models/spree/order/payment_spec.rb | 40 ++-- .../spree/order/risk_assessment_spec.rb | 2 +- core/spec/models/spree/order/tax_spec.rb | 26 +-- core/spec/models/spree/order/totals_spec.rb | 4 +- core/spec/models/spree/order/updating_spec.rb | 4 +- .../models/spree/order/validations_spec.rb | 4 +- core/spec/models/spree/order_contents_spec.rb | 6 +- core/spec/models/spree/order_spec.rb | 82 ++++---- core/spec/models/spree/payment_spec.rb | 82 ++++---- core/spec/models/spree/preference_spec.rb | 2 +- .../spree/preferences/configuration_spec.rb | 4 +- .../spree/preferences/preferable_spec.rb | 24 +-- .../spree/preferences/scoped_store_spec.rb | 2 +- .../models/spree/preferences/store_spec.rb | 6 +- core/spec/models/spree/price_spec.rb | 2 +- core/spec/models/spree/product/scopes_spec.rb | 8 +- .../models/spree/product_duplicator_spec.rb | 4 +- core/spec/models/spree/product_filter_spec.rb | 4 +- .../models/spree/product_property_spec.rb | 2 +- core/spec/models/spree/product_spec.rb | 26 +-- .../actions/create_item_adjustments_spec.rb | 10 +- .../promotion/actions/free_shipping_spec.rb | 2 +- .../spree/promotion/rules/first_order_spec.rb | 20 +- .../spree/promotion/rules/item_total_spec.rb | 2 +- .../promotion/rules/one_use_per_user_spec.rb | 2 +- .../spree/promotion/rules/product_spec.rb | 16 +- .../spree/promotion/rules/taxon_spec.rb | 2 +- .../promotion/rules/user_logged_in_spec.rb | 6 +- .../models/spree/promotion/rules/user_spec.rb | 14 +- .../models/spree/promotion_action_spec.rb | 2 +- .../models/spree/promotion_category_spec.rb | 2 +- .../spree/promotion_handler/cart_spec.rb | 2 +- .../spree/promotion_handler/coupon_spec.rb | 56 ++--- .../spree/promotion_handler/page_spec.rb | 12 +- core/spec/models/spree/promotion_rule_spec.rb | 2 +- core/spec/models/spree/promotion_spec.rb | 58 ++--- core/spec/models/spree/property_spec.rb | 2 +- core/spec/models/spree/prototype_spec.rb | 2 +- core/spec/models/spree/refund_spec.rb | 2 +- .../models/spree/reimbursement/credit_spec.rb | 2 +- .../reimbursement_type_engine_spec.rb | 2 +- .../reimbursement_type_validator_spec.rb | 2 +- .../spree/reimbursement_performer_spec.rb | 2 +- .../reimbursement_tax_calculator_spec.rb | 2 +- .../spree/reimbursement_type/credit_spec.rb | 2 +- .../spree/reimbursement_type/exchange_spec.rb | 2 +- .../original_payment_spec.rb | 2 +- .../models/spree/return_authorization_spec.rb | 2 +- .../eligibility_validator/default_spec.rb | 2 +- .../rma_required_spec.rb | 2 +- .../time_since_purchase_spec.rb | 2 +- .../same_option_value_spec.rb | 2 +- .../same_product_spec.rb | 2 +- core/spec/models/spree/return_item_spec.rb | 2 +- .../models/spree/returns_calculator_spec.rb | 2 +- core/spec/models/spree/shipment_spec.rb | 4 +- .../models/spree/shipping_calculator_spec.rb | 6 +- .../models/spree/shipping_category_spec.rb | 2 +- .../spec/models/spree/shipping_method_spec.rb | 4 +- core/spec/models/spree/state_spec.rb | 2 +- .../stock/availability_validator_spec.rb | 2 +- .../models/spree/stock/coordinator_spec.rb | 2 +- .../models/spree/stock/differentiator_spec.rb | 2 +- .../spec/models/spree/stock/estimator_spec.rb | 8 +- .../stock/inventory_unit_builder_spec.rb | 2 +- core/spec/models/spree/stock/package_spec.rb | 2 +- core/spec/models/spree/stock/packer_spec.rb | 2 +- .../models/spree/stock/prioritizer_spec.rb | 2 +- .../spree/stock/splitter/backordered_spec.rb | 2 +- .../models/spree/stock/splitter/base_spec.rb | 2 +- .../stock/splitter/shipping_category_spec.rb | 2 +- core/spec/models/spree/stock_item_spec.rb | 8 +- core/spec/models/spree/stock_location_spec.rb | 10 +- core/spec/models/spree/stock_movement_spec.rb | 2 +- core/spec/models/spree/stock_transfer_spec.rb | 2 +- core/spec/models/spree/store_spec.rb | 2 +- core/spec/models/spree/tax_category_spec.rb | 2 +- core/spec/models/spree/tax_rate_spec.rb | 130 ++++++------ core/spec/models/spree/taxon_spec.rb | 8 +- core/spec/models/spree/taxonomy_spec.rb | 4 +- core/spec/models/spree/tracker_spec.rb | 2 +- core/spec/models/spree/variant_spec.rb | 12 +- core/spec/models/spree/zone_spec.rb | 2 +- .../controllers/spree/content_controller.rb | 6 +- .../controllers/spree/orders_controller.rb | 4 +- .../controllers/spree/products_controller.rb | 2 +- frontend/app/helpers/spree/frontend_helper.rb | 2 +- .../twitter-bootstrap-3/_first_page.html.erb | 2 +- .../twitter-bootstrap-3/_last_page.html.erb | 2 +- .../twitter-bootstrap-3/_next_page.html.erb | 2 +- .../twitter-bootstrap-3/_page.html.erb | 2 +- .../twitter-bootstrap-3/_prev_page.html.erb | 2 +- .../app/views/spree/address/_form.html.erb | 32 +-- .../views/spree/checkout/_address.html.erb | 8 +- .../views/spree/checkout/_confirm.html.erb | 4 +- .../views/spree/checkout/_delivery.html.erb | 4 +- .../views/spree/checkout/_payment.html.erb | 6 +- .../spree/checkout/payment/_gateway.html.erb | 16 +- frontend/app/views/spree/home/index.html.erb | 4 +- .../spree/orders/_adjustment_row.html.erb | 2 +- .../views/spree/orders/_adjustments.html.erb | 6 +- .../views/spree/products/_properties.html.erb | 2 +- .../app/views/spree/products/index.html.erb | 8 +- .../app/views/spree/products/show.html.erb | 12 +- .../spree/shared/_error_messages.html.erb | 2 +- .../app/views/spree/shared/_filters.html.erb | 4 +- .../app/views/spree/shared/_header.html.erb | 4 +- .../app/views/spree/shared/_login.html.erb | 8 +- .../app/views/spree/shared/_nav_bar.html.erb | 2 +- .../app/views/spree/shared/_search.html.erb | 6 +- .../views/spree/shared/_taxonomies.html.erb | 2 +- frontend/lib/tasks/taxon.rake | 4 +- .../controllers/controller_extension_spec.rb | 22 +- .../controllers/controller_helpers_spec.rb | 2 +- .../spree/content_controller_spec.rb | 4 +- .../spree/current_order_tracking_spec.rb | 12 +- .../controllers/spree/home_controller_spec.rb | 6 +- .../spree/orders_controller_spec.rb | 14 +- .../orders_controller_transitions_spec.rb | 8 +- .../spree/products_controller_spec.rb | 20 +- .../spree/taxons_controller_spec.rb | 10 +- frontend/spec/features/address_spec.rb | 28 +-- .../automatic_promotion_adjustments_spec.rb | 14 +- .../spec/features/caching/products_spec.rb | 4 +- frontend/spec/features/caching/taxons_spec.rb | 4 +- frontend/spec/features/cart_spec.rb | 2 +- .../features/checkout_unshippable_spec.rb | 8 +- frontend/spec/features/currency_spec.rb | 4 +- .../features/free_shipping_promotions_spec.rb | 32 +-- frontend/spec/features/order_spec.rb | 8 +- .../spec/features/page_promotions_spec.rb | 14 +- frontend/spec/features/products_spec.rb | 8 +- frontend/spec/helpers/order_helper_spec.rb | 4 +- frontend/spec/helpers/taxons_helper_spec.rb | 2 +- frontend/spec/spec_helper.rb | 4 +- .../shared_contexts/custom_products.rb | 34 +-- .../shared_contexts/product_prototypes.rb | 6 +- .../views/spree/checkout/_summary_spec.rb | 4 +- guides/README.md | 4 +- guides/Rules | 22 +- .../2012-10-24-1-2-1-and-1-3-0-api-changes.md | 10 +- guides/content/api/changes/index.html | 2 +- guides/content/api/checkouts.md | 58 ++--- guides/content/api/countries.md | 16 +- guides/content/api/orders.md | 26 +-- guides/content/api/payments.md | 32 +-- guides/content/api/product_properties.md | 16 +- guides/content/api/products.md | 40 ++-- guides/content/api/return_authorizations.md | 16 +- guides/content/api/shipments.md | 6 +- guides/content/api/states.md | 8 +- guides/content/api/stock_items.md | 42 ++-- guides/content/api/stock_locations.md | 28 +-- guides/content/api/stock_movements.md | 36 ++-- guides/content/api/summary.md | 2 +- guides/content/api/taxonomies.md | 16 +- guides/content/api/users.md | 12 +- guides/content/api/variants.md | 28 +-- guides/content/api/zones.md | 38 ++-- guides/content/developer/core/preferences.md | 12 +- guides/content/developer/core/products.md | 10 +- guides/content/developer/core/shipments.md | 12 +- .../customization/authentication.markdown | 22 +- .../developer/customization/checkout.md | 18 +- .../developer/customization/i18n.markdown | 2 +- .../developer/customization/logic.markdown | 18 +- .../developer/customization/view.markdown | 38 ++-- .../developer/deployment/manual-ubuntu.md | 10 +- guides/content/developer/source/navigating.md | 8 +- .../tutorials/deface_overrides_tutorial.md | 18 +- .../tutorials/extensions_tutorial.md | 16 +- .../developer/tutorials/migration.markdown | 26 +-- .../content/developer/tutorials/security.md | 6 +- guides/content/developer/tutorials/testing.md | 12 +- .../upgrades/one-dot-oh-to-one-dot-one.md | 2 +- .../upgrades/one-dot-one-to-one-dot-two.md | 4 +- .../upgrades/one-dot-three-to-two-dot-oh.md | 2 +- .../upgrades/one-dot-two-to-one-dot-three.md | 2 +- .../upgrades/point-seventy-to-one-dot-oh.md | 4 +- .../upgrades/point-sixty-to-point-seventy.md | 2 +- .../upgrades/two-dot-oh-to-two-dot-one.md | 2 +- .../upgrades/two-dot-one-to-two-dot-two.md | 2 +- .../upgrades/two-dot-two-to-two-dot-three.md | 2 +- guides/content/feed.atom | 2 +- guides/content/release_notes/0_10_0.md | 10 +- guides/content/release_notes/0_70_0.md | 2 +- guides/content/release_notes/1_0_0.md | 10 +- guides/content/release_notes/1_1_0.md | 2 +- guides/content/release_notes/1_2_0.md | 8 +- guides/content/release_notes/2_0_0.md | 4 +- guides/content/release_notes/2_3_0.md | 20 +- guides/layouts/_changes.html | 2 +- guides/layouts/changes.html | 2 +- guides/lib/filters/add_toc.rb | 4 +- guides/lib/resources.rb | 16 +- guides/lib/static.rb | 6 +- sample/Gemfile | 2 +- sample/lib/tasks/sample.rake | 2 +- 555 files changed, 2533 insertions(+), 2538 deletions(-) diff --git a/api/Gemfile b/api/Gemfile index af51fbf0c11..f0bccbfd978 100644 --- a/api/Gemfile +++ b/api/Gemfile @@ -1,5 +1,5 @@ eval(File.read(File.dirname(__FILE__) + '/../common_spree_dependencies.rb')) -gem 'spree_core', :path => '../core' +gem 'spree_core', path: '../core' gemspec diff --git a/api/app/controllers/spree/api/v1/addresses_controller.rb b/api/app/controllers/spree/api/v1/addresses_controller.rb index 32f4b189b93..459384ec464 100644 --- a/api/app/controllers/spree/api/v1/addresses_controller.rb +++ b/api/app/controllers/spree/api/v1/addresses_controller.rb @@ -15,7 +15,7 @@ def update @address = find_address if @address.update_attributes(address_params) - respond_with(@address, :default_template => :show) + respond_with(@address, default_template: :show) else invalid_resource!(@address) end diff --git a/api/app/controllers/spree/api/v1/inventory_units_controller.rb b/api/app/controllers/spree/api/v1/inventory_units_controller.rb index 97bb79168e8..5f098382ef7 100644 --- a/api/app/controllers/spree/api/v1/inventory_units_controller.rb +++ b/api/app/controllers/spree/api/v1/inventory_units_controller.rb @@ -15,7 +15,7 @@ def update inventory_unit.transaction do if inventory_unit.update_attributes(inventory_unit_params) fire - render :show, :status => 200 + render :show, status: 200 else invalid_resource!(inventory_unit) end @@ -35,8 +35,8 @@ def prepare_event unless inventory_unit.respond_to?(can_event) && inventory_unit.send(can_event) - render :text => { :exception => "cannot transition to #{@event}" }.to_json, - :status => 200 + render text: { exception: "cannot transition to #{@event}" }.to_json, + status: 200 false end end diff --git a/api/app/controllers/spree/api/v1/option_types_controller.rb b/api/app/controllers/spree/api/v1/option_types_controller.rb index 63eb370e048..c8338d41a78 100644 --- a/api/app/controllers/spree/api/v1/option_types_controller.rb +++ b/api/app/controllers/spree/api/v1/option_types_controller.rb @@ -23,7 +23,7 @@ def create authorize! :create, Spree::OptionType @option_type = Spree::OptionType.new(option_type_params) if @option_type.save - render :show, :status => 201 + render :show, status: 201 else invalid_resource!(@option_type) end @@ -41,7 +41,7 @@ def update def destroy @option_type = Spree::OptionType.accessible_by(current_ability, :destroy).find(params[:id]) @option_type.destroy - render :text => nil, :status => 204 + render text: nil, status: 204 end private diff --git a/api/app/controllers/spree/api/v1/option_values_controller.rb b/api/app/controllers/spree/api/v1/option_values_controller.rb index c876c0b94d9..510a73a0f57 100644 --- a/api/app/controllers/spree/api/v1/option_values_controller.rb +++ b/api/app/controllers/spree/api/v1/option_values_controller.rb @@ -4,7 +4,7 @@ module V1 class OptionValuesController < Spree::Api::BaseController def index if params[:ids] - @option_values = scope.where(:id => params[:ids]) + @option_values = scope.where(id: params[:ids]) else @option_values = scope.ransack(params[:q]).result.distinct end @@ -23,7 +23,7 @@ def create authorize! :create, Spree::OptionValue @option_value = scope.new(option_value_params) if @option_value.save - render :show, :status => 201 + render :show, status: 201 else invalid_resource!(@option_value) end @@ -41,7 +41,7 @@ def update def destroy @option_value = scope.accessible_by(current_ability, :destroy).find(params[:id]) @option_value.destroy - render :text => nil, :status => 204 + render text: nil, status: 204 end private diff --git a/api/app/controllers/spree/api/v1/products_controller.rb b/api/app/controllers/spree/api/v1/products_controller.rb index bdb34617291..d88a7202049 100644 --- a/api/app/controllers/spree/api/v1/products_controller.rb +++ b/api/app/controllers/spree/api/v1/products_controller.rb @@ -11,14 +11,14 @@ def index end @products = @products.distinct.page(params[:page]).per(params[:per_page]) - expires_in 15.minutes, :public => true + expires_in 15.minutes, public: true headers['Surrogate-Control'] = "max-age=#{15.minutes}" respond_with(@products) end def show @product = find_product(params[:id]) - expires_in 15.minutes, :public => true + expires_in 15.minutes, public: true headers['Surrogate-Control'] = "max-age=#{15.minutes}" headers['Surrogate-Key'] = "product_id=1" respond_with(@product) @@ -69,7 +69,7 @@ def create @product = Core::Importer::Product.new(nil, product_params, options).create if @product.persisted? - respond_with(@product, :status => 201, :default_template => :show) + respond_with(@product, status: 201, default_template: :show) else invalid_resource!(@product) end @@ -83,7 +83,7 @@ def update @product = Core::Importer::Product.new(@product, product_params, options).update if @product.errors.empty? - respond_with(@product.reload, :status => 200, :default_template => :show) + respond_with(@product.reload, status: 200, default_template: :show) else invalid_resource!(@product) end @@ -93,7 +93,7 @@ def destroy @product = find_product(params[:id]) authorize! :destroy, @product @product.destroy - respond_with(@product, :status => 204) + respond_with(@product, status: 204) end private diff --git a/api/app/controllers/spree/api/v1/stock_items_controller.rb b/api/app/controllers/spree/api/v1/stock_items_controller.rb index 39d82bc04d1..e3028a3e4c1 100644 --- a/api/app/controllers/spree/api/v1/stock_items_controller.rb +++ b/api/app/controllers/spree/api/v1/stock_items_controller.rb @@ -64,7 +64,7 @@ def stock_location end def scope - includes = {:variant => [{ :option_values => :option_type }, :product] } + includes = { variant: [{ option_values: :option_type }, :product] } @stock_location.stock_items.accessible_by(current_ability, :read).includes(includes) end diff --git a/api/app/controllers/spree/api/v1/stock_locations_controller.rb b/api/app/controllers/spree/api/v1/stock_locations_controller.rb index 7e3f0f6cbd2..18481955d88 100644 --- a/api/app/controllers/spree/api/v1/stock_locations_controller.rb +++ b/api/app/controllers/spree/api/v1/stock_locations_controller.rb @@ -34,7 +34,7 @@ def update def destroy authorize! :destroy, stock_location stock_location.destroy - respond_with(stock_location, :status => 204) + respond_with(stock_location, status: 204) end private diff --git a/api/app/controllers/spree/api/v1/taxonomies_controller.rb b/api/app/controllers/spree/api/v1/taxonomies_controller.rb index 9cf682e6c49..a06e3bacaf7 100644 --- a/api/app/controllers/spree/api/v1/taxonomies_controller.rb +++ b/api/app/controllers/spree/api/v1/taxonomies_controller.rb @@ -23,7 +23,7 @@ def create authorize! :create, Taxonomy @taxonomy = Taxonomy.new(taxonomy_params) if @taxonomy.save - respond_with(@taxonomy, :status => 201, :default_template => :show) + respond_with(@taxonomy, status: 201, default_template: :show) else invalid_resource!(@taxonomy) end @@ -32,7 +32,7 @@ def create def update authorize! :update, taxonomy if taxonomy.update_attributes(taxonomy_params) - respond_with(taxonomy, :status => 200, :default_template => :show) + respond_with(taxonomy, status: 200, default_template: :show) else invalid_resource!(taxonomy) end @@ -41,13 +41,13 @@ def update def destroy authorize! :destroy, taxonomy taxonomy.destroy - respond_with(taxonomy, :status => 204) + respond_with(taxonomy, status: 204) end private def taxonomies - @taxonomies = Taxonomy.accessible_by(current_ability, :read).order('name').includes(:root => :children). + @taxonomies = Taxonomy.accessible_by(current_ability, :read).order('name').includes(root: :children). ransack(params[:q]).result. page(params[:page]).per(params[:per_page]) end diff --git a/api/app/controllers/spree/api/v1/users_controller.rb b/api/app/controllers/spree/api/v1/users_controller.rb index 620562e6d19..72f95adc29c 100644 --- a/api/app/controllers/spree/api/v1/users_controller.rb +++ b/api/app/controllers/spree/api/v1/users_controller.rb @@ -21,7 +21,7 @@ def create authorize! :create, Spree.user_class @user = Spree.user_class.new(user_params) if @user.save - respond_with(@user, :status => 201, :default_template => :show) + respond_with(@user, status: 201, default_template: :show) else invalid_resource!(@user) end @@ -30,7 +30,7 @@ def create def update authorize! :update, user if user.update_attributes(user_params) - respond_with(user, :status => 200, :default_template => :show) + respond_with(user, status: 200, default_template: :show) else invalid_resource!(user) end @@ -39,7 +39,7 @@ def update def destroy authorize! :destroy, user user.destroy - respond_with(user, :status => 204) + respond_with(user, status: 204) end private diff --git a/api/app/controllers/spree/api/v1/zones_controller.rb b/api/app/controllers/spree/api/v1/zones_controller.rb index 9e1eb5edf2f..81d09d0deb9 100644 --- a/api/app/controllers/spree/api/v1/zones_controller.rb +++ b/api/app/controllers/spree/api/v1/zones_controller.rb @@ -7,7 +7,7 @@ def create authorize! :create, Zone @zone = Zone.new(map_nested_attributes_keys(Spree::Zone, zone_params)) if @zone.save - respond_with(@zone, :status => 201, :default_template => :show) + respond_with(@zone, status: 201, default_template: :show) else invalid_resource!(@zone) end @@ -16,7 +16,7 @@ def create def destroy authorize! :destroy, zone zone.destroy - respond_with(zone, :status => 204) + respond_with(zone, status: 204) end def index @@ -31,7 +31,7 @@ def show def update authorize! :update, zone if zone.update_attributes(map_nested_attributes_keys(Spree::Zone, zone_params)) - respond_with(zone, :status => 200, :default_template => :show) + respond_with(zone, status: 200, default_template: :show) else invalid_resource!(zone) end diff --git a/api/app/models/spree/api_configuration.rb b/api/app/models/spree/api_configuration.rb index a9d5d733ef4..28bc94d2219 100644 --- a/api/app/models/spree/api_configuration.rb +++ b/api/app/models/spree/api_configuration.rb @@ -1,5 +1,5 @@ module Spree class ApiConfiguration < Preferences::Configuration - preference :requires_authentication, :boolean, :default => true + preference :requires_authentication, :boolean, default: true end end diff --git a/api/app/views/spree/api/errors/invalid_api_key.v1.rabl b/api/app/views/spree/api/errors/invalid_api_key.v1.rabl index 9bd5e8a7e6c..2bc1f1e4e1c 100644 --- a/api/app/views/spree/api/errors/invalid_api_key.v1.rabl +++ b/api/app/views/spree/api/errors/invalid_api_key.v1.rabl @@ -1,2 +1,2 @@ object false -node(:error) { I18n.t(:invalid_api_key, :key => api_key, :scope => "spree.api") } +node(:error) { I18n.t(:invalid_api_key, key: api_key, scope: "spree.api") } diff --git a/api/app/views/spree/api/errors/invalid_resource.v1.rabl b/api/app/views/spree/api/errors/invalid_resource.v1.rabl index c7a0a8f92ad..ed8e7ac3f01 100644 --- a/api/app/views/spree/api/errors/invalid_resource.v1.rabl +++ b/api/app/views/spree/api/errors/invalid_resource.v1.rabl @@ -1,3 +1,3 @@ object false -node(:error) { I18n.t(:invalid_resource, :scope => "spree.api") } +node(:error) { I18n.t(:invalid_resource, scope: "spree.api") } node(:errors) { @resource.errors.to_hash } diff --git a/api/app/views/spree/api/errors/must_specify_api_key.v1.rabl b/api/app/views/spree/api/errors/must_specify_api_key.v1.rabl index ec85c24be5b..ffdcd761956 100644 --- a/api/app/views/spree/api/errors/must_specify_api_key.v1.rabl +++ b/api/app/views/spree/api/errors/must_specify_api_key.v1.rabl @@ -1,2 +1,2 @@ object false -node(:error) { I18n.t(:must_specify_api_key, :scope => "spree.api") } +node(:error) { I18n.t(:must_specify_api_key, scope: "spree.api") } diff --git a/api/app/views/spree/api/errors/not_found.v1.rabl b/api/app/views/spree/api/errors/not_found.v1.rabl index 0ea0bb4c19d..258a0b1f25b 100644 --- a/api/app/views/spree/api/errors/not_found.v1.rabl +++ b/api/app/views/spree/api/errors/not_found.v1.rabl @@ -1,2 +1,2 @@ object false -node(:error) { I18n.t(:resource_not_found, :scope => "spree.api") } +node(:error) { I18n.t(:resource_not_found, scope: "spree.api") } diff --git a/api/app/views/spree/api/errors/unauthorized.v1.rabl b/api/app/views/spree/api/errors/unauthorized.v1.rabl index 0a692c0933f..dbeb04dce1b 100644 --- a/api/app/views/spree/api/errors/unauthorized.v1.rabl +++ b/api/app/views/spree/api/errors/unauthorized.v1.rabl @@ -1,2 +1,2 @@ object false -node(:error) { I18n.t(:unauthorized, :scope => "spree.api") } +node(:error) { I18n.t(:unauthorized, scope: "spree.api") } diff --git a/api/app/views/spree/api/v1/countries/show.v1.rabl b/api/app/views/spree/api/v1/countries/show.v1.rabl index 19d4322a9c3..b485c3c11fd 100644 --- a/api/app/views/spree/api/v1/countries/show.v1.rabl +++ b/api/app/views/spree/api/v1/countries/show.v1.rabl @@ -1,5 +1,5 @@ object @country attributes *country_attributes -child :states => :states do +child states: :states do attributes :id, :name, :abbr, :country_id end diff --git a/api/app/views/spree/api/v1/line_items/show.v1.rabl b/api/app/views/spree/api/v1/line_items/show.v1.rabl index d2038d411c3..ffa642f3053 100644 --- a/api/app/views/spree/api/v1/line_items/show.v1.rabl +++ b/api/app/views/spree/api/v1/line_items/show.v1.rabl @@ -7,9 +7,9 @@ node(:total) { |li| li.total } child :variant do extends "spree/api/v1/variants/small" attributes :product_id - child(:images => :images) { extends "spree/api/v1/images/show" } + child(images: :images) { extends "spree/api/v1/images/show" } end -child :adjustments => :adjustments do +child adjustments: :adjustments do extends "spree/api/v1/adjustments/show" end diff --git a/api/app/views/spree/api/v1/option_types/show.v1.rabl b/api/app/views/spree/api/v1/option_types/show.v1.rabl index e3c71a255aa..4deb535926c 100644 --- a/api/app/views/spree/api/v1/option_types/show.v1.rabl +++ b/api/app/views/spree/api/v1/option_types/show.v1.rabl @@ -1,5 +1,5 @@ object @option_type attributes *option_type_attributes -child :option_values => :option_values do +child option_values: :option_values do attributes *option_value_attributes end \ No newline at end of file diff --git a/api/app/views/spree/api/v1/orders/invalid_shipping_method.v1.rabl b/api/app/views/spree/api/v1/orders/invalid_shipping_method.v1.rabl index 3bd499fb843..71675458281 100644 --- a/api/app/views/spree/api/v1/orders/invalid_shipping_method.v1.rabl +++ b/api/app/views/spree/api/v1/orders/invalid_shipping_method.v1.rabl @@ -1,2 +1,2 @@ object false -node(:errors) { [I18n.t(:invalid_shipping_method, :scope => "spree.api.order")] } +node(:errors) { [I18n.t(:invalid_shipping_method, scope: "spree.api.order")] } diff --git a/api/app/views/spree/api/v1/orders/payment.v1.rabl b/api/app/views/spree/api/v1/orders/payment.v1.rabl index abf0cbba72a..0533ca838a0 100644 --- a/api/app/views/spree/api/v1/orders/payment.v1.rabl +++ b/api/app/views/spree/api/v1/orders/payment.v1.rabl @@ -1,3 +1,3 @@ -child :available_payment_methods => :payment_methods do +child available_payment_methods: :payment_methods do attributes :id, :name, :method_type end diff --git a/api/app/views/spree/api/v1/orders/show.v1.rabl b/api/app/views/spree/api/v1/orders/show.v1.rabl index 708bcb2e694..4db3a403a63 100644 --- a/api/app/views/spree/api/v1/orders/show.v1.rabl +++ b/api/app/views/spree/api/v1/orders/show.v1.rabl @@ -5,26 +5,26 @@ if lookup_context.find_all("spree/api/v1/orders/#{root_object.state}").present? extends "spree/api/v1/orders/#{root_object.state}" end -child :billing_address => :bill_address do +child billing_address: :bill_address do extends "spree/api/v1/addresses/show" end -child :shipping_address => :ship_address do +child shipping_address: :ship_address do extends "spree/api/v1/addresses/show" end -child :line_items => :line_items do +child line_items: :line_items do extends "spree/api/v1/line_items/show" end -child :payments => :payments do +child payments: :payments do attributes *payment_attributes - child :payment_method => :payment_method do + child payment_method: :payment_method do attributes :id, :name end - child :source => :source do + child source: :source do if @current_user_roles.include?('admin') attributes *payment_source_attributes + [:gateway_customer_profile_id, :gateway_payment_profile_id] else @@ -33,11 +33,11 @@ child :payments => :payments do end end -child :shipments => :shipments do +child shipments: :shipments do extends "spree/api/v1/shipments/small" end -child :adjustments => :adjustments do +child adjustments: :adjustments do extends "spree/api/v1/adjustments/show" end @@ -46,6 +46,6 @@ node :permissions do { can_update: current_ability.can?(:update, root_object) } end -child :valid_credit_cards => :credit_cards do +child valid_credit_cards: :credit_cards do extends "spree/api/v1/credit_cards/show" end diff --git a/api/app/views/spree/api/v1/payments/credit_over_limit.v1.rabl b/api/app/views/spree/api/v1/payments/credit_over_limit.v1.rabl index 3cbf95ad4f1..e6ca9336fa9 100644 --- a/api/app/views/spree/api/v1/payments/credit_over_limit.v1.rabl +++ b/api/app/views/spree/api/v1/payments/credit_over_limit.v1.rabl @@ -1,2 +1,2 @@ object false -node(:error) { I18n.t(:credit_over_limit, :limit => @payment.credit_allowed, :scope => 'spree.api.payment') } +node(:error) { I18n.t(:credit_over_limit, limit: @payment.credit_allowed, scope: 'spree.api.payment') } diff --git a/api/app/views/spree/api/v1/payments/update_forbidden.v1.rabl b/api/app/views/spree/api/v1/payments/update_forbidden.v1.rabl index 7f51e9c3a8c..9ce6b061fc6 100644 --- a/api/app/views/spree/api/v1/payments/update_forbidden.v1.rabl +++ b/api/app/views/spree/api/v1/payments/update_forbidden.v1.rabl @@ -1,2 +1,2 @@ object false -node(:error) { I18n.t(:update_forbidden, :state => @payment.state, :scope => 'spree.api.payment') } +node(:error) { I18n.t(:update_forbidden, state: @payment.state, scope: 'spree.api.payment') } diff --git a/api/app/views/spree/api/v1/products/show.v1.rabl b/api/app/views/spree/api/v1/products/show.v1.rabl index 647918ab036..afc19047b64 100644 --- a/api/app/views/spree/api/v1/products/show.v1.rabl +++ b/api/app/views/spree/api/v1/products/show.v1.rabl @@ -7,23 +7,23 @@ node(:display_price) { |p| p.display_price.to_s } node(:has_variants) { |p| p.has_variants? } node(:taxon_ids) { |p| p.taxon_ids } -child :master => :master do +child master: :master do extends "spree/api/v1/variants/small" end -child :variants => :variants do +child variants: :variants do extends "spree/api/v1/variants/small" end -child :option_types => :option_types do +child option_types: :option_types do attributes *option_type_attributes end -child :product_properties => :product_properties do +child product_properties: :product_properties do attributes *product_property_attributes end -child :classifications => :classifications do +child classifications: :classifications do attributes :taxon_id, :position child(:taxon) do diff --git a/api/app/views/spree/api/v1/shipments/cannot_ready_shipment.v1.rabl b/api/app/views/spree/api/v1/shipments/cannot_ready_shipment.v1.rabl index aab55663d03..e4224c3ea4e 100644 --- a/api/app/views/spree/api/v1/shipments/cannot_ready_shipment.v1.rabl +++ b/api/app/views/spree/api/v1/shipments/cannot_ready_shipment.v1.rabl @@ -1,2 +1,2 @@ object false -node(:error) { I18n.t(:cannot_ready, :scope => "spree.api.shipment") } +node(:error) { I18n.t(:cannot_ready, scope: "spree.api.shipment") } diff --git a/api/app/views/spree/api/v1/shipments/show.v1.rabl b/api/app/views/spree/api/v1/shipments/show.v1.rabl index 2a0eff55613..bb5b12d5d2c 100644 --- a/api/app/views/spree/api/v1/shipments/show.v1.rabl +++ b/api/app/views/spree/api/v1/shipments/show.v1.rabl @@ -4,27 +4,27 @@ attributes *shipment_attributes node(:order_id) { |shipment| shipment.order.number } node(:stock_location_name) { |shipment| shipment.stock_location.name } -child :shipping_rates => :shipping_rates do +child shipping_rates: :shipping_rates do extends "spree/api/v1/shipping_rates/show" end -child :selected_shipping_rate => :selected_shipping_rate do +child selected_shipping_rate: :selected_shipping_rate do extends "spree/api/v1/shipping_rates/show" end -child :shipping_methods => :shipping_methods do +child shipping_methods: :shipping_methods do attributes :id, :name - child :zones => :zones do + child zones: :zones do attributes :id, :name, :description end - child :shipping_categories => :shipping_categories do + child shipping_categories: :shipping_categories do attributes :id, :name end end -child :manifest => :manifest do - child :variant => :variant do +child manifest: :manifest do + child variant: :variant do extends "spree/api/v1/variants/small" end node(:quantity) { |m| m.quantity } diff --git a/api/app/views/spree/api/v1/shipments/small.v1.rabl b/api/app/views/spree/api/v1/shipments/small.v1.rabl index efd4ca0bfc4..d7c32e38c86 100644 --- a/api/app/views/spree/api/v1/shipments/small.v1.rabl +++ b/api/app/views/spree/api/v1/shipments/small.v1.rabl @@ -5,33 +5,33 @@ attributes *shipment_attributes node(:order_id) { |shipment| shipment.order.number } node(:stock_location_name) { |shipment| shipment.stock_location.name } -child :shipping_rates => :shipping_rates do +child shipping_rates: :shipping_rates do extends "spree/api/v1/shipping_rates/show" end -child :selected_shipping_rate => :selected_shipping_rate do +child selected_shipping_rate: :selected_shipping_rate do extends "spree/api/v1/shipping_rates/show" end -child :shipping_methods => :shipping_methods do +child shipping_methods: :shipping_methods do attributes :id, :code, :name - child :zones => :zones do + child zones: :zones do attributes :id, :name, :description end - child :shipping_categories => :shipping_categories do + child shipping_categories: :shipping_categories do attributes :id, :name end end -child :manifest => :manifest do +child manifest: :manifest do glue(:variant) do - attribute :id => :variant_id + attribute id: :variant_id end node(:quantity) { |m| m.quantity } node(:states) { |m| m.states } end -child :adjustments => :adjustments do +child adjustments: :adjustments do extends "spree/api/v1/adjustments/show" end diff --git a/api/app/views/spree/api/v1/taxonomies/jstree.rabl b/api/app/views/spree/api/v1/taxonomies/jstree.rabl index 01b25aa4ccd..81fb400d9b6 100644 --- a/api/app/views/spree/api/v1/taxonomies/jstree.rabl +++ b/api/app/views/spree/api/v1/taxonomies/jstree.rabl @@ -1,8 +1,8 @@ object false node(:data) { @taxonomy.root.name } node(:attr) do - { :id => @taxonomy.root.id, - :name => @taxonomy.root.name + { id: @taxonomy.root.id, + name: @taxonomy.root.name } end node(:state) { "closed" } diff --git a/api/app/views/spree/api/v1/taxonomies/nested.v1.rabl b/api/app/views/spree/api/v1/taxonomies/nested.v1.rabl index c65ece48aba..035a65753a6 100644 --- a/api/app/views/spree/api/v1/taxonomies/nested.v1.rabl +++ b/api/app/views/spree/api/v1/taxonomies/nested.v1.rabl @@ -1,9 +1,9 @@ attributes *taxonomy_attributes -child :root => :root do +child root: :root do attributes *taxon_attributes - child :children => :taxons do + child children: :taxons do attributes *taxon_attributes extends "spree/api/v1/taxons/taxons" diff --git a/api/app/views/spree/api/v1/taxons/jstree.rabl b/api/app/views/spree/api/v1/taxons/jstree.rabl index aed500e0f36..4a44d7d5d63 100644 --- a/api/app/views/spree/api/v1/taxons/jstree.rabl +++ b/api/app/views/spree/api/v1/taxons/jstree.rabl @@ -1,8 +1,8 @@ -collection @taxon.children, :object_root => false +collection @taxon.children, object_root: false node(:data) { |taxon| taxon.name } node(:attr) do |taxon| - { :id => taxon.id, - :name => taxon.name + { id: taxon.id, + name: taxon.name } end node(:state) { "closed" } diff --git a/api/app/views/spree/api/v1/taxons/show.v1.rabl b/api/app/views/spree/api/v1/taxons/show.v1.rabl index 37a1c1bd90d..95f485715f7 100644 --- a/api/app/views/spree/api/v1/taxons/show.v1.rabl +++ b/api/app/views/spree/api/v1/taxons/show.v1.rabl @@ -1,6 +1,6 @@ object @taxon attributes *taxon_attributes -child :children => :taxons do +child children: :taxons do attributes *taxon_attributes end diff --git a/api/app/views/spree/api/v1/taxons/taxons.v1.rabl b/api/app/views/spree/api/v1/taxons/taxons.v1.rabl index 9865a18df5f..0bf0076a52c 100644 --- a/api/app/views/spree/api/v1/taxons/taxons.v1.rabl +++ b/api/app/views/spree/api/v1/taxons/taxons.v1.rabl @@ -1,5 +1,5 @@ attributes *taxon_attributes node :taxons do |t| - t.children.map { |c| partial("spree/api/v1/taxons/taxons", :object => c) } + t.children.map { |c| partial("spree/api/v1/taxons/taxons", object: c) } end diff --git a/api/app/views/spree/api/v1/users/show.v1.rabl b/api/app/views/spree/api/v1/users/show.v1.rabl index 8b6af84531a..b366fcd077e 100644 --- a/api/app/views/spree/api/v1/users/show.v1.rabl +++ b/api/app/views/spree/api/v1/users/show.v1.rabl @@ -1,10 +1,10 @@ object @user attributes *user_attributes -child(:bill_address => :bill_address) do +child(bill_address: :bill_address) do extends "spree/api/v1/addresses/show" end -child(:ship_address => :ship_address) do +child(ship_address: :ship_address) do extends "spree/api/v1/addresses/show" end \ No newline at end of file diff --git a/api/app/views/spree/api/v1/variants/big.v1.rabl b/api/app/views/spree/api/v1/variants/big.v1.rabl index 8128a6fe0fa..912b478d969 100644 --- a/api/app/views/spree/api/v1/variants/big.v1.rabl +++ b/api/app/views/spree/api/v1/variants/big.v1.rabl @@ -4,11 +4,11 @@ cache [I18n.locale, @current_user_roles.include?('admin'), 'big_variant', root_o extends "spree/api/v1/variants/small" -child(:stock_items => :stock_items) do +child(stock_items: :stock_items) do attributes :id, :count_on_hand, :stock_location_id, :backorderable - attribute :available? => :available + attribute available?: :available glue(:stock_location) do - attribute :name => :stock_location_name + attribute name: :stock_location_name end end diff --git a/api/app/views/spree/api/v1/variants/small.v1.rabl b/api/app/views/spree/api/v1/variants/small.v1.rabl index a5373637c59..6952edbf725 100644 --- a/api/app/views/spree/api/v1/variants/small.v1.rabl +++ b/api/app/views/spree/api/v1/variants/small.v1.rabl @@ -10,8 +10,8 @@ node(:is_backorderable) { |v| v.is_backorderable? } node(:total_on_hand) { |v| v.total_on_hand } node(:is_destroyed) { |v| v.destroyed? } -child :option_values => :option_values do +child option_values: :option_values do attributes *option_value_attributes end -child(:images => :images) { extends "spree/api/v1/images/show" } +child(images: :images) { extends "spree/api/v1/images/show" } diff --git a/api/app/views/spree/api/v1/zones/show.v1.rabl b/api/app/views/spree/api/v1/zones/show.v1.rabl index c8c58d469c7..eb66574ed4a 100644 --- a/api/app/views/spree/api/v1/zones/show.v1.rabl +++ b/api/app/views/spree/api/v1/zones/show.v1.rabl @@ -1,6 +1,6 @@ object @zone attributes :id, :name, :description -child :zone_members => :zone_members do +child zone_members: :zone_members do attributes :id, :name, :zoneable_type, :zoneable_id end diff --git a/api/db/migrate/20100107141738_add_api_key_to_spree_users.rb b/api/db/migrate/20100107141738_add_api_key_to_spree_users.rb index a6645c7be9b..6e0a3d6430c 100644 --- a/api/db/migrate/20100107141738_add_api_key_to_spree_users.rb +++ b/api/db/migrate/20100107141738_add_api_key_to_spree_users.rb @@ -1,7 +1,7 @@ class AddApiKeyToSpreeUsers < ActiveRecord::Migration def change unless defined?(User) - add_column :spree_users, :api_key, :string, :limit => 40 + add_column :spree_users, :api_key, :string, limit: 40 end end end diff --git a/api/db/migrate/20120411123334_resize_api_key_field.rb b/api/db/migrate/20120411123334_resize_api_key_field.rb index 50b492f8f8c..638644696f8 100644 --- a/api/db/migrate/20120411123334_resize_api_key_field.rb +++ b/api/db/migrate/20120411123334_resize_api_key_field.rb @@ -1,7 +1,7 @@ class ResizeApiKeyField < ActiveRecord::Migration def change unless defined?(User) - change_column :spree_users, :api_key, :string, :limit => 48 + change_column :spree_users, :api_key, :string, limit: 48 end end end diff --git a/api/lib/spree/api/engine.rb b/api/lib/spree/api/engine.rb index 926dbdca0a2..b27737ff893 100644 --- a/api/lib/spree/api/engine.rb +++ b/api/lib/spree/api/engine.rb @@ -28,7 +28,7 @@ class Engine < Rails::Engine end end - initializer "spree.api.environment", :before => :load_config_initializers do |app| + initializer "spree.api.environment", before: :load_config_initializers do |app| Spree::Api::Config = Spree::ApiConfiguration.new end diff --git a/api/lib/spree/api/responders/rabl_template.rb b/api/lib/spree/api/responders/rabl_template.rb index eb74a609c4b..fd5a3d4e834 100644 --- a/api/lib/spree/api/responders/rabl_template.rb +++ b/api/lib/spree/api/responders/rabl_template.rb @@ -4,7 +4,7 @@ module Responders module RablTemplate def to_format if template - render template, :status => options[:status] || 200 + render template, status: options[:status] || 200 else super end diff --git a/api/lib/spree/api/testing_support/caching.rb b/api/lib/spree/api/testing_support/caching.rb index 7cfa98188f4..c11298686bb 100644 --- a/api/lib/spree/api/testing_support/caching.rb +++ b/api/lib/spree/api/testing_support/caching.rb @@ -1,9 +1,9 @@ RSpec.configure do |config| - config.before(:each, :caching => true) do + config.before(:each, caching: true) do ActionController::Base.perform_caching = true end - config.after(:each, :caching => true) do + config.after(:each, caching: true) do ActionController::Base.perform_caching = false Rails.cache.clear end diff --git a/api/spec/controllers/spree/api/base_controller_spec.rb b/api/spec/controllers/spree/api/base_controller_spec.rb index 9473d38edfb..0426ef75767 100644 --- a/api/spec/controllers/spree/api/base_controller_spec.rb +++ b/api/spec/controllers/spree/api/base_controller_spec.rb @@ -3,11 +3,11 @@ class FakesController < Spree::Api::BaseController end -describe Spree::Api::BaseController, :type => :controller do +describe Spree::Api::BaseController, type: :controller do render_views controller(Spree::Api::BaseController) do def index - render :text => { "products" => [] }.to_json + render text: { "products" => [] }.to_json end end @@ -55,7 +55,7 @@ def index end it "using an invalid token param" do - get :index, :token => "fake_key" + get :index, token: "fake_key" expect(json_response).to eq({ "error" => "Invalid API key (fake_key) specified." }) end end @@ -79,10 +79,10 @@ def index end it "maps semantic keys to nested_attributes keys" do - klass = double(:nested_attributes_options => { :line_items => {}, - :bill_address => {} }) - attributes = { 'line_items' => { :id => 1 }, - 'bill_address' => { :id => 2 }, + klass = double(nested_attributes_options: { line_items: {}, + bill_address: {} }) + attributes = { 'line_items' => { id: 1 }, + 'bill_address' => { id: 2 }, 'name' => 'test order' } mapped = subject.map_nested_attributes_keys(klass, attributes) diff --git a/api/spec/controllers/spree/api/v1/addresses_controller_spec.rb b/api/spec/controllers/spree/api/v1/addresses_controller_spec.rb index d1e364faef0..1425d7713f2 100644 --- a/api/spec/controllers/spree/api/v1/addresses_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/addresses_controller_spec.rb @@ -1,34 +1,34 @@ require 'spec_helper' module Spree - describe Api::V1::AddressesController, :type => :controller do + describe Api::V1::AddressesController, type: :controller do render_views before do stub_authentication! @address = create(:address) - @order = create(:order, :bill_address => @address) + @order = create(:order, bill_address: @address) end context "with their own address" do before do - allow_any_instance_of(Order).to receive_messages :user => current_api_user + allow_any_instance_of(Order).to receive_messages user: current_api_user end it "gets an address" do - api_get :show, :id => @address.id, :order_id => @order.number + api_get :show, id: @address.id, order_id: @order.number expect(json_response['address1']).to eq @address.address1 end it "updates an address" do - api_put :update, :id => @address.id, :order_id => @order.number, - :address => { :address1 => "123 Test Lane" } + api_put :update, id: @address.id, order_id: @order.number, + address: { address1: "123 Test Lane" } expect(json_response['address1']).to eq '123 Test Lane' end it "receives the errors object if address is invalid" do - api_put :update, :id => @address.id, :order_id => @order.number, - :address => { :address1 => "" } + api_put :update, id: @address.id, order_id: @order.number, + address: { address1: "" } expect(json_response['error']).not_to be_nil expect(json_response['errors']).not_to be_nil @@ -43,12 +43,12 @@ module Spree end it "cannot retrieve address information" do - api_get :show, :id => @address.id, :order_id => @order.number + api_get :show, id: @address.id, order_id: @order.number assert_unauthorized! end it "cannot update address information" do - api_get :update, :id => @address.id, :order_id => @order.number + api_get :update, id: @address.id, order_id: @order.number assert_unauthorized! end end diff --git a/api/spec/controllers/spree/api/v1/checkouts_controller_spec.rb b/api/spec/controllers/spree/api/v1/checkouts_controller_spec.rb index 47ba4ef329c..c302fde07e0 100644 --- a/api/spec/controllers/spree/api/v1/checkouts_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/checkouts_controller_spec.rb @@ -76,7 +76,7 @@ def controller.load_order(*) expect(order.state).to eq "cart" expect(order.email).not_to be_nil request.headers["X-Spree-Order-Token"] = order.guest_token - api_put :update, :id => order.to_param + api_put :update, id: order.to_param expect(order.reload.state).to eq "address" end @@ -288,7 +288,7 @@ def controller.load_order(*) order.update_column(:state, "payment") expect(PromotionHandler::Coupon).to receive(:new).with(order).and_call_original expect_any_instance_of(PromotionHandler::Coupon).to receive(:apply).and_return({ coupon_applied?: true }) - api_put :update, :id => order.to_param, order_token: order.guest_token, order: { coupon_code: "foobar" } + api_put :update, id: order.to_param, order_token: order.guest_token, order: { coupon_code: "foobar" } end def send_request @@ -322,7 +322,7 @@ def send_request email: nil ) - api_put :next, :id => order.to_param, :order_token => order.guest_token + api_put :next, id: order.to_param, order_token: order.guest_token expect(response.status).to eq(422) expect(json_response['error']).to match(/could not be transitioned/) end diff --git a/api/spec/controllers/spree/api/v1/countries_controller_spec.rb b/api/spec/controllers/spree/api/v1/countries_controller_spec.rb index 01310d704f9..ae1d5af5a90 100644 --- a/api/spec/controllers/spree/api/v1/countries_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/countries_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::CountriesController, :type => :controller do + describe Api::V1::CountriesController, type: :controller do render_views before do @@ -16,7 +16,7 @@ module Spree end context "with two countries" do - before { @zambia = create(:country, :name => "Zambia") } + before { @zambia = create(:country, name: "Zambia") } it "can view all countries" do api_get :index @@ -26,13 +26,13 @@ module Spree end it 'can query the results through a paramter' do - api_get :index, :q => { :name_cont => 'zam' } + api_get :index, q: { name_cont: 'zam' } expect(json_response['count']).to eq(1) expect(json_response['countries'].first['name']).to eq @zambia.name end it 'can control the page size through a parameter' do - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response['count']).to eq(1) expect(json_response['current_page']).to eq(1) expect(json_response['pages']).to eq(2) @@ -40,7 +40,7 @@ module Spree end it "includes states" do - api_get :show, :id => @country.id + api_get :show, id: @country.id states = json_response['states'] expect(states.first['name']).to eq @state.name end diff --git a/api/spec/controllers/spree/api/v1/credit_cards_controller_spec.rb b/api/spec/controllers/spree/api/v1/credit_cards_controller_spec.rb index ccc2fba105e..89b1edaa1db 100644 --- a/api/spec/controllers/spree/api/v1/credit_cards_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/credit_cards_controller_spec.rb @@ -1,23 +1,23 @@ require 'spec_helper' module Spree - describe Api::V1::CreditCardsController, :type => :controller do + describe Api::V1::CreditCardsController, type: :controller do render_views let!(:admin_user) do - user = Spree.user_class.new(:email => "spree@example.com", :id => 1) + user = Spree.user_class.new(email: "spree@example.com", id: 1) user.generate_spree_api_key! allow(user).to receive(:has_spree_role?).with('admin').and_return(true) user end let!(:normal_user) do - user = Spree.user_class.new(:email => "spree2@example.com", :id => 2) + user = Spree.user_class.new(email: "spree2@example.com", id: 2) user.generate_spree_api_key! user end - let!(:card) { create(:credit_card, :user_id => admin_user.id, gateway_customer_profile_id: "random") } + let!(:card) { create(:credit_card, user_id: admin_user.id, gateway_customer_profile_id: "random") } before do stub_authentication! @@ -58,7 +58,7 @@ module Spree user end - let!(:card) { create(:credit_card, :user_id => normal_user.id, gateway_customer_profile_id: "random") } + let!(:card) { create(:credit_card, user_id: normal_user.id, gateway_customer_profile_id: "random") } it "can not view user" do api_get :index, user_id: admin_user.id diff --git a/api/spec/controllers/spree/api/v1/images_controller_spec.rb b/api/spec/controllers/spree/api/v1/images_controller_spec.rb index 540ed8f54ac..0edaf14b864 100644 --- a/api/spec/controllers/spree/api/v1/images_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/images_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::ImagesController, :type => :controller do + describe Api::V1::ImagesController, type: :controller do render_views let!(:product) { create(:product) } @@ -25,10 +25,10 @@ module Spree it "can upload a new image for a variant" do expect do api_post :create, - :image => { :attachment => upload_image('thinking-cat.jpg'), - :viewable_type => 'Spree::Variant', - :viewable_id => product.master.to_param }, - :product_id => product.id + image: { attachment: upload_image('thinking-cat.jpg'), + viewable_type: 'Spree::Variant', + viewable_id: product.master.to_param }, + product_id: product.id expect(response.status).to eq(201) expect(json_response).to have_attributes(attributes) end.to change(Image, :count).by(1) @@ -44,29 +44,29 @@ module Spree end context "working with an existing image" do - let!(:product_image) { product.master.images.create!(:attachment => image('thinking-cat.jpg')) } + let!(:product_image) { product.master.images.create!(attachment: image('thinking-cat.jpg')) } it "can get a single product image" do - api_get :show, :id => product_image.id, :product_id => product.id + api_get :show, id: product_image.id, product_id: product.id expect(response.status).to eq(200) expect(json_response).to have_attributes(attributes) end it "can get a single variant image" do - api_get :show, :id => product_image.id, :variant_id => product.master.id + api_get :show, id: product_image.id, variant_id: product.master.id expect(response.status).to eq(200) expect(json_response).to have_attributes(attributes) end it "can get a list of product images" do - api_get :index, :product_id => product.id + api_get :index, product_id: product.id expect(response.status).to eq(200) expect(json_response).to have_key("images") expect(json_response["images"].first).to have_attributes(attributes) end it "can get a list of variant images" do - api_get :index, :variant_id => product.master.id + api_get :index, variant_id: product.master.id expect(response.status).to eq(200) expect(json_response).to have_key("images") expect(json_response["images"].first).to have_attributes(attributes) @@ -74,7 +74,7 @@ module Spree it "can update image data" do expect(product_image.position).to eq(1) - api_post :update, :image => { :position => 2 }, :id => product_image.id, :product_id => product.id + api_post :update, image: { position: 2 }, id: product_image.id, product_id: product.id expect(response.status).to eq(200) expect(json_response).to have_attributes(attributes) expect(product_image.reload.position).to eq(2) @@ -88,7 +88,7 @@ module Spree end it "can delete an image" do - api_delete :destroy, :id => product_image.id, :product_id => product.id + api_delete :destroy, id: product_image.id, product_id: product.id expect(response.status).to eq(204) expect { product_image.reload }.to raise_error(ActiveRecord::RecordNotFound) end @@ -97,17 +97,17 @@ module Spree context "as a non-admin" do it "cannot create an image" do - api_post :create, :product_id => product.id + api_post :create, product_id: product.id assert_unauthorized! end it "cannot update an image" do - api_put :update, :id => 1, :product_id => product.id + api_put :update, id: 1, product_id: product.id assert_not_found! end it "cannot delete an image" do - api_delete :destroy, :id => 1, :product_id => product.id + api_delete :destroy, id: 1, product_id: product.id assert_not_found! end end diff --git a/api/spec/controllers/spree/api/v1/inventory_units_controller_spec.rb b/api/spec/controllers/spree/api/v1/inventory_units_controller_spec.rb index df3a5152aab..c235cb1d1ae 100644 --- a/api/spec/controllers/spree/api/v1/inventory_units_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/inventory_units_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::InventoryUnitsController, :type => :controller do + describe Api::V1::InventoryUnitsController, type: :controller do render_views before do @@ -13,34 +13,34 @@ module Spree sign_in_as_admin! it "gets an inventory unit" do - api_get :show, :id => @inventory_unit.id + api_get :show, id: @inventory_unit.id expect(json_response['state']).to eq @inventory_unit.state end it "updates an inventory unit (only shipment is accessable by default)" do - api_put :update, :id => @inventory_unit.id, - :inventory_unit => { :shipment => nil } + api_put :update, id: @inventory_unit.id, + inventory_unit: { shipment: nil } expect(json_response['shipment_id']).to be_nil end context 'fires state event' do it 'if supplied with :fire param' do - api_put :update, :id => @inventory_unit.id, - :fire => 'ship', - :inventory_unit => { :shipment => nil } + api_put :update, id: @inventory_unit.id, + fire: 'ship', + inventory_unit: { shipment: nil } expect(json_response['state']).to eq 'shipped' end it 'and returns exception if cannot fire' do - api_put :update, :id => @inventory_unit.id, - :fire => 'return' + api_put :update, id: @inventory_unit.id, + fire: 'return' expect(json_response['exception']).to match /cannot transition to return/ end it 'and returns exception bad state' do - api_put :update, :id => @inventory_unit.id, - :fire => 'bad' + api_put :update, id: @inventory_unit.id, + fire: 'bad' expect(json_response['exception']).to match /cannot transition to bad/ end end diff --git a/api/spec/controllers/spree/api/v1/line_items_controller_spec.rb b/api/spec/controllers/spree/api/v1/line_items_controller_spec.rb index 80f71deb1dc..eccf3e94487 100644 --- a/api/spec/controllers/spree/api/v1/line_items_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/line_items_controller_spec.rb @@ -12,14 +12,14 @@ module Spree # This should go in an initializer Spree::Api::V1::LineItemsController.line_item_options += [:some_option] - describe Api::V1::LineItemsController, :type => :controller do + describe Api::V1::LineItemsController, type: :controller do render_views let!(:order) { create(:order_with_line_items, line_items_count: 1) } let(:product) { create(:product) } let(:attributes) { [:id, :quantity, :price, :variant, :total, :display_amount, :single_display_amount] } - let(:resource_scoping) { { :order_id => order.to_param } } + let(:resource_scoping) { { order_id: order.to_param } } before do stub_authentication! @@ -34,7 +34,7 @@ module Spree context "authenticating with a token" do it "can add a new line item to an existing order" do - api_post :create, :line_item => { :variant_id => product.master.to_param, :quantity => 1 }, :order_token => order.guest_token + api_post :create, line_item: { variant_id: product.master.to_param, quantity: 1 }, order_token: order.guest_token expect(response.status).to eq(201) expect(json_response).to have_attributes(attributes) expect(json_response["variant"]["name"]).not_to be_blank @@ -42,7 +42,7 @@ module Spree it "can add a new line item to an existing order with token in header" do request.headers["X-Spree-Order-Token"] = order.guest_token - api_post :create, :line_item => { :variant_id => product.master.to_param, :quantity => 1 } + api_post :create, line_item: { variant_id: product.master.to_param, quantity: 1 } expect(response.status).to eq(201) expect(json_response).to have_attributes(attributes) expect(json_response["variant"]["name"]).not_to be_blank @@ -51,11 +51,11 @@ module Spree context "as the order owner" do before do - allow_any_instance_of(Order).to receive_messages :user => current_api_user + allow_any_instance_of(Order).to receive_messages user: current_api_user end it "can add a new line item to an existing order" do - api_post :create, :line_item => { :variant_id => product.master.to_param, :quantity => 1 } + api_post :create, line_item: { variant_id: product.master.to_param, quantity: 1 } expect(response.status).to eq(201) expect(json_response).to have_attributes(attributes) expect(json_response["variant"]["name"]).not_to be_blank @@ -73,15 +73,15 @@ module Spree end it "default quantity to 1 if none is given" do - api_post :create, :line_item => { :variant_id => product.master.to_param } + api_post :create, line_item: { variant_id: product.master.to_param } expect(response.status).to eq(201) expect(json_response).to have_attributes(attributes) expect(json_response[:quantity]).to eq 1 end it "increases a line item's quantity if it exists already" do - order.line_items.create(:variant_id => product.master.id, :quantity => 10) - api_post :create, :line_item => { :variant_id => product.master.to_param, :quantity => 1 } + order.line_items.create(variant_id: product.master.id, quantity: 10) + api_post :create, line_item: { variant_id: product.master.to_param, quantity: 1 } expect(response.status).to eq(201) order.reload expect(order.line_items.count).to eq(2) # 1 original due to factory, + 1 in this test @@ -91,7 +91,7 @@ module Spree it "can update a line item on the order" do line_item = order.line_items.first - api_put :update, :id => line_item.id, :line_item => { :quantity => 101 } + api_put :update, id: line_item.id, line_item: { quantity: 101 } expect(response.status).to eq(200) order.reload expect(order.total).to eq(1010) # 10 original due to factory, + 1000 in this test @@ -110,7 +110,7 @@ module Spree it "can delete a line item on the order" do line_item = order.line_items.first - api_delete :destroy, :id => line_item.id + api_delete :destroy, id: line_item.id expect(response.status).to eq(204) order.reload expect(order.line_items.count).to eq(0) # 1 original due to factory, - 1 in this test @@ -125,19 +125,19 @@ module Spree it "clear out shipments on create" do expect(order.reload.shipments).not_to be_empty - api_post :create, :line_item => { :variant_id => product.master.to_param, :quantity => 1 } + api_post :create, line_item: { variant_id: product.master.to_param, quantity: 1 } expect(order.reload.shipments).to be_empty end it "clear out shipments on update" do expect(order.reload.shipments).not_to be_empty - api_put :update, :id => line_item.id, :line_item => { :quantity => 1000 } + api_put :update, id: line_item.id, line_item: { quantity: 1000 } expect(order.reload.shipments).to be_empty end it "clear out shipments on delete" do expect(order.reload.shipments).not_to be_empty - api_delete :destroy, :id => line_item.id + api_delete :destroy, id: line_item.id expect(order.reload.shipments).to be_empty end @@ -149,7 +149,7 @@ module Spree it "doesn't destroy shipments or restart checkout flow" do expect(order.reload.shipments).not_to be_empty - api_post :create, :line_item => { :variant_id => product.master.to_param, :quantity => 1 } + api_post :create, line_item: { variant_id: product.master.to_param, quantity: 1 } expect(order.reload.shipments).not_to be_empty end end @@ -162,20 +162,20 @@ module Spree end it "cannot add a new line item to the order" do - api_post :create, :line_item => { :variant_id => product.master.to_param, :quantity => 1 } + api_post :create, line_item: { variant_id: product.master.to_param, quantity: 1 } assert_unauthorized! end it "cannot update a line item on the order" do line_item = order.line_items.first - api_put :update, :id => line_item.id, :line_item => { :quantity => 1000 } + api_put :update, id: line_item.id, line_item: { quantity: 1000 } assert_unauthorized! expect(line_item.reload.quantity).not_to eq(1000) end it "cannot delete a line item on the order" do line_item = order.line_items.first - api_delete :destroy, :id => line_item.id + api_delete :destroy, id: line_item.id assert_unauthorized! expect { line_item.reload }.not_to raise_error end diff --git a/api/spec/controllers/spree/api/v1/option_types_controller_spec.rb b/api/spec/controllers/spree/api/v1/option_types_controller_spec.rb index ef59804f158..d78b326319c 100644 --- a/api/spec/controllers/spree/api/v1/option_types_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/option_types_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::OptionTypesController, :type => :controller do + describe Api::V1::OptionTypesController, type: :controller do render_views let(:attributes) { [:id, :name, :presentation, :position] } @@ -27,8 +27,8 @@ def check_option_values(option_values) end it "can search for an option type" do - create(:option_type, :name => "buzz") - api_get :index, :q => { :name_cont => option_type.name } + create(:option_type, name: "buzz") + api_get :index, q: { name_cont: option_type.name } expect(json_response.count).to eq(1) expect(json_response.first).to have_attributes(attributes) end @@ -36,14 +36,14 @@ def check_option_values(option_values) it "can retrieve a list of specific option types" do option_type_1 = create(:option_type) option_type_2 = create(:option_type) - api_get :index, :ids => "#{option_type.id},#{option_type_1.id}" + api_get :index, ids: "#{option_type.id},#{option_type_1.id}" expect(json_response.count).to eq(2) check_option_values(json_response.first["option_values"]) end it "can list a single option type" do - api_get :show, :id => option_type.id + api_get :show, id: option_type.id expect(json_response).to have_attributes(attributes) check_option_values(json_response["option_values"]) end @@ -55,25 +55,25 @@ def check_option_values(option_values) end it "cannot create a new option type" do - api_post :create, :option_type => { - :name => "Option Type", - :presentation => "Option Type" + api_post :create, option_type: { + name: "Option Type", + presentation: "Option Type" } assert_unauthorized! end it "cannot alter an option type" do original_name = option_type.name - api_put :update, :id => option_type.id, - :option_type => { - :name => "Option Type" + api_put :update, id: option_type.id, + option_type: { + name: "Option Type" } assert_not_found! expect(option_type.reload.name).to eq(original_name) end it "cannot delete an option type" do - api_delete :destroy, :id => option_type.id + api_delete :destroy, id: option_type.id assert_not_found! expect { option_type.reload }.not_to raise_error end @@ -82,23 +82,23 @@ def check_option_values(option_values) sign_in_as_admin! it "can create an option type" do - api_post :create, :option_type => { - :name => "Option Type", - :presentation => "Option Type" + api_post :create, option_type: { + name: "Option Type", + presentation: "Option Type" } expect(json_response).to have_attributes(attributes) expect(response.status).to eq(201) end it "cannot create an option type with invalid attributes" do - api_post :create, :option_type => {} + api_post :create, option_type: {} expect(response.status).to eq(422) end it "can update an option type" do original_name = option_type.name - api_put :update, :id => option_type.id, :option_type => { - :name => "Option Type", + api_put :update, id: option_type.id, option_type: { + name: "Option Type", } expect(response.status).to eq(200) @@ -107,14 +107,14 @@ def check_option_values(option_values) end it "cannot update an option type with invalid attributes" do - api_put :update, :id => option_type.id, :option_type => { - :name => "" + api_put :update, id: option_type.id, option_type: { + name: "" } expect(response.status).to eq(422) end it "can delete an option type" do - api_delete :destroy, :id => option_type.id + api_delete :destroy, id: option_type.id expect(response.status).to eq(204) end end diff --git a/api/spec/controllers/spree/api/v1/option_values_controller_spec.rb b/api/spec/controllers/spree/api/v1/option_values_controller_spec.rb index d4104507c3d..aef5f2eb72d 100644 --- a/api/spec/controllers/spree/api/v1/option_values_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/option_values_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::OptionValuesController, :type => :controller do + describe Api::V1::OptionValuesController, type: :controller do render_views let(:attributes) { [:id, :name, :presentation, :option_type_name, :option_type_id, :option_type_presentation] } @@ -21,7 +21,7 @@ def check_option_values(option_values) context "without any option type scoping" do before do # Create another option value with a brand new option type - create(:option_value, :option_type => create(:option_type)) + create(:option_value, option_type: create(:option_type)) end it "can retrieve a list of all option values" do @@ -32,7 +32,7 @@ def check_option_values(option_values) end context "for a particular option type" do - let(:resource_scoping) { { :option_type_id => option_type.id } } + let(:resource_scoping) { { option_type_id: option_type.id } } it "can list all option values" do api_get :index @@ -41,44 +41,44 @@ def check_option_values(option_values) end it "can search for an option type" do - create(:option_value, :name => "buzz") - api_get :index, :q => { :name_cont => option_value.name } + create(:option_value, name: "buzz") + api_get :index, q: { name_cont: option_value.name } expect(json_response.count).to eq(1) expect(json_response.first).to have_attributes(attributes) end it "can retrieve a list of option types" do - option_value_1 = create(:option_value, :option_type => option_type) - option_value_2 = create(:option_value, :option_type => option_type) - api_get :index, :ids => [option_value.id, option_value_1.id] + option_value_1 = create(:option_value, option_type: option_type) + option_value_2 = create(:option_value, option_type: option_type) + api_get :index, ids: [option_value.id, option_value_1.id] expect(json_response.count).to eq(2) end it "can list a single option value" do - api_get :show, :id => option_value.id + api_get :show, id: option_value.id expect(json_response).to have_attributes(attributes) end it "cannot create a new option value" do - api_post :create, :option_value => { - :name => "Option Value", - :presentation => "Option Value" + api_post :create, option_value: { + name: "Option Value", + presentation: "Option Value" } assert_unauthorized! end it "cannot alter an option value" do original_name = option_type.name - api_put :update, :id => option_type.id, - :option_value => { - :name => "Option Value" + api_put :update, id: option_type.id, + option_value: { + name: "Option Value" } assert_not_found! expect(option_type.reload.name).to eq(original_name) end it "cannot delete an option value" do - api_delete :destroy, :id => option_type.id + api_delete :destroy, id: option_type.id assert_not_found! expect { option_type.reload }.not_to raise_error end @@ -93,23 +93,23 @@ def check_option_values(option_values) end it "can create an option value" do - api_post :create, :option_value => { - :name => "Option Value", - :presentation => "Option Value" + api_post :create, option_value: { + name: "Option Value", + presentation: "Option Value" } expect(json_response).to have_attributes(attributes) expect(response.status).to eq(201) end it "cannot create an option type with invalid attributes" do - api_post :create, :option_value => {} + api_post :create, option_value: {} expect(response.status).to eq(422) end it "can update an option value" do original_name = option_value.name - api_put :update, :id => option_value.id, :option_value => { - :name => "Option Value", + api_put :update, id: option_value.id, option_value: { + name: "Option Value", } expect(response.status).to eq(200) @@ -119,20 +119,20 @@ def check_option_values(option_values) it "permits the correct attributes" do expect(controller).to receive(:permitted_option_value_attributes) - api_put :update, :id => option_value.id, :option_value => { - :name => "" + api_put :update, id: option_value.id, option_value: { + name: "" } end it "cannot update an option value with invalid attributes" do - api_put :update, :id => option_value.id, :option_value => { - :name => "" + api_put :update, id: option_value.id, option_value: { + name: "" } expect(response.status).to eq(422) end it "can delete an option value" do - api_delete :destroy, :id => option_value.id + api_delete :destroy, id: option_value.id expect(response.status).to eq(204) end end diff --git a/api/spec/controllers/spree/api/v1/orders_controller_spec.rb b/api/spec/controllers/spree/api/v1/orders_controller_spec.rb index ff90f03da8d..436ea1a777f 100755 --- a/api/spec/controllers/spree/api/v1/orders_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/orders_controller_spec.rb @@ -2,7 +2,7 @@ require 'spree/testing_support/bar_ability' module Spree - describe Api::V1::OrdersController, :type => :controller do + describe Api::V1::OrdersController, type: :controller do render_views let!(:order) { create(:order) } @@ -15,10 +15,10 @@ module Spree :email, :special_instructions, :total_quantity, :display_item_total, :currency, :considered_risky] end - let(:address_params) { { :country_id => Country.first.id, :state_id => State.first.id } } + let(:address_params) { { country_id: Country.first.id, state_id: State.first.id } } let(:current_api_user) do - user = Spree.user_class.new(:email => "spree@example.com") + user = Spree.user_class.new(email: "spree@example.com") user.generate_spree_api_key! user end @@ -129,8 +129,8 @@ module Spree end it "can view their own order" do - allow_any_instance_of(Order).to receive_messages :user => current_api_user - api_get :show, :id => order.to_param + allow_any_instance_of(Order).to receive_messages user: current_api_user + api_get :show, id: order.to_param expect(response.status).to eq(200) expect(json_response).to have_attributes(attributes) expect(json_response["adjustments"]).to be_empty @@ -143,7 +143,7 @@ module Spree subject { api_get :show, id: order.to_param } before do - allow_any_instance_of(Order).to receive_messages :user => current_api_user + allow_any_instance_of(Order).to receive_messages user: current_api_user end context 'when inventory information is present' do @@ -176,33 +176,33 @@ module Spree end it "orders contain the basic checkout steps" do - allow_any_instance_of(Order).to receive_messages :user => current_api_user - api_get :show, :id => order.to_param + allow_any_instance_of(Order).to receive_messages user: current_api_user + api_get :show, id: order.to_param expect(response.status).to eq(200) expect(json_response["checkout_steps"]).to eq(["address", "delivery", "complete"]) end # Regression test for #1992 it "can view an order not in a standard state" do - allow_any_instance_of(Order).to receive_messages :user => current_api_user + allow_any_instance_of(Order).to receive_messages user: current_api_user order.update_column(:state, 'shipped') - api_get :show, :id => order.to_param + api_get :show, id: order.to_param end it "can not view someone else's order" do - allow_any_instance_of(Order).to receive_messages :user => stub_model(Spree::LegacyUser) - api_get :show, :id => order.to_param + allow_any_instance_of(Order).to receive_messages user: stub_model(Spree::LegacyUser) + api_get :show, id: order.to_param assert_unauthorized! end it "can view an order if the token is known" do - api_get :show, :id => order.to_param, :order_token => order.guest_token + api_get :show, id: order.to_param, order_token: order.guest_token expect(response.status).to eq(200) end it "can view an order if the token is passed in header" do request.headers["X-Spree-Order-Token"] = order.guest_token - api_get :show, :id => order.to_param + api_get :show, id: order.to_param expect(response.status).to eq(200) end @@ -216,7 +216,7 @@ module Spree allow(user).to receive(:has_spree_role?).with('bar').and_return(true) allow(user).to receive(:has_spree_role?).with('admin').and_return(false) allow(Spree.user_class).to receive_messages find_by: user - api_get :show, :id => order.to_param + api_get :show, id: order.to_param expect(response.status).to eq(200) end end @@ -224,7 +224,7 @@ module Spree it "cannot cancel an order that doesn't belong to them" do order.update_attribute(:completed_at, Time.current) order.update_attribute(:shipment_state, "ready") - api_put :cancel, :id => order.to_param + api_put :cancel, id: order.to_param assert_unauthorized! end @@ -246,7 +246,7 @@ module Spree end it "assigns email when creating a new order" do - api_post :create, :order => { :email => "guest@spreecommerce.com" } + api_post :create, order: { email: "guest@spreecommerce.com" } expect(json_response['email']).not_to eq controller.current_api_user expect(json_response['email']).to eq "guest@spreecommerce.com" end @@ -281,7 +281,7 @@ module Spree end it "is able to set any default unpermitted attribute" do - api_post :create, :order => { number: "WOW" } + api_post :create, order: { number: "WOW" } expect(response.status).to eq 201 expect(json_response['number']).to eq "WOW" end @@ -311,13 +311,13 @@ module Spree let!(:line_item) { order.contents.add(variant, 1) } let!(:payment_method) { create(:check_payment_method) } - let(:address_params) { { :country_id => country.id } } - let(:billing_address) { { :firstname => "Tiago", :lastname => "Motta", :address1 => "Av Paulista", - :city => "Sao Paulo", :zipcode => "01310-300", :phone => "12345678", - :country_id => country.id} } - let(:shipping_address) { { :firstname => "Tiago", :lastname => "Motta", :address1 => "Av Paulista", - :city => "Sao Paulo", :zipcode => "01310-300", :phone => "12345678", - :country_id => country.id} } + let(:address_params) { { country_id: country.id } } + let(:billing_address) { { firstname: "Tiago", lastname: "Motta", address1: "Av Paulista", + city: "Sao Paulo", zipcode: "01310-300", phone: "12345678", + country_id: country.id} } + let(:shipping_address) { { firstname: "Tiago", lastname: "Motta", address1: "Av Paulista", + city: "Sao Paulo", zipcode: "01310-300", phone: "12345678", + country_id: country.id} } let(:country) { create(:country, {name: "Brazil", iso_name: "BRAZIL", iso: "BR", iso3: "BRA", numcode: 76 })} before do @@ -337,8 +337,8 @@ def clean_address(address) context "line_items hash not present in request" do it "responds successfully" do - api_put :update, :id => order.to_param, :order => { - :email => "hublock@spreecommerce.com" + api_put :update, id: order.to_param, order: { + email: "hublock@spreecommerce.com" } expect(response).to be_success @@ -346,9 +346,9 @@ def clean_address(address) end it "updates quantities of existing line items" do - api_put :update, :id => order.to_param, :order => { - :line_items => { - "0" => { :id => line_item.id, :quantity => 10 } + api_put :update, id: order.to_param, order: { + line_items: { + "0" => { id: line_item.id, quantity: 10 } } } @@ -359,10 +359,10 @@ def clean_address(address) it "adds an extra line item" do variant2 = create(:variant) - api_put :update, :id => order.to_param, :order => { - :line_items => { - "0" => { :id => line_item.id, :quantity => 10 }, - "1" => { :variant_id => variant2.id, :quantity => 1} + api_put :update, id: order.to_param, order: { + line_items: { + "0" => { id: line_item.id, quantity: 10 }, + "1" => { variant_id: variant2.id, quantity: 1} } } @@ -374,9 +374,9 @@ def clean_address(address) end it "cannot change the price of an existing line item" do - api_put :update, :id => order.to_param, :order => { - :line_items => { - 0 => { :id => line_item.id, :price => 0 } + api_put :update, id: order.to_param, order: { + line_items: { + 0 => { id: line_item.id, price: 0 } } } @@ -387,7 +387,7 @@ def clean_address(address) end it "can add billing address" do - api_put :update, :id => order.to_param, :order => { :bill_address_attributes => billing_address } + api_put :update, id: order.to_param, order: { bill_address_attributes: billing_address } expect(order.reload.bill_address).to_not be_nil end @@ -395,7 +395,7 @@ def clean_address(address) it "receives error message if trying to add billing address with errors" do billing_address[:firstname] = "" - api_put :update, :id => order.to_param, :order => { :bill_address_attributes => billing_address } + api_put :update, id: order.to_param, order: { bill_address_attributes: billing_address } expect(json_response['error']).not_to be_nil expect(json_response['errors']).not_to be_nil @@ -405,7 +405,7 @@ def clean_address(address) it "can add shipping address" do expect(order.ship_address).to be_nil - api_put :update, :id => order.to_param, :order => { :ship_address_attributes => shipping_address } + api_put :update, id: order.to_param, order: { ship_address_attributes: shipping_address } expect(order.reload.ship_address).not_to be_nil end @@ -414,7 +414,7 @@ def clean_address(address) expect(order.ship_address).to be_nil shipping_address[:firstname] = "" - api_put :update, :id => order.to_param, :order => { :ship_address_attributes => shipping_address } + api_put :update, id: order.to_param, order: { ship_address_attributes: shipping_address } expect(json_response['error']).not_to be_nil expect(json_response['errors']).not_to be_nil @@ -424,7 +424,7 @@ def clean_address(address) it "cannot set the user_id for the order" do user = Spree.user_class.create original_id = order.user_id - api_post :update, :id => order.to_param, :order => { user_id: user.id } + api_post :update, id: order.to_param, order: { user_id: user.id } expect(response.status).to eq 200 expect(json_response["user_id"]).to eq(original_id) end @@ -434,9 +434,9 @@ def clean_address(address) it "clears out all existing shipments on line item udpate" do previous_shipments = order.shipments - api_put :update, :id => order.to_param, :order => { - :line_items => { - 0 => { :id => line_item.id, :quantity => 10 } + api_put :update, id: order.to_param, order: { + line_items: { + 0 => { id: line_item.id, quantity: 10 } } } expect(order.reload.shipments).to be_empty @@ -452,7 +452,7 @@ def clean_address(address) it "can empty an order" do expect(order_with_line_items.adjustments.count).to eq(1) - api_put :empty, :id => order_with_line_items.to_param + api_put :empty, id: order_with_line_items.to_param expect(response.status).to eq(204) order_with_line_items.reload expect(order_with_line_items.line_items).to be_empty @@ -460,21 +460,21 @@ def clean_address(address) end it "can list its line items with images" do - order.line_items.first.variant.images.create!(:attachment => image("thinking-cat.jpg")) + order.line_items.first.variant.images.create!(attachment: image("thinking-cat.jpg")) - api_get :show, :id => order.to_param + api_get :show, id: order.to_param expect(json_response['line_items'].first['variant']).to have_attributes([:images]) end it "lists variants product id" do - api_get :show, :id => order.to_param + api_get :show, id: order.to_param expect(json_response['line_items'].first['variant']).to have_attributes([:product_id]) end it "includes the tax_total in the response" do - api_get :show, :id => order.to_param + api_get :show, id: order.to_param expect(json_response['included_tax_total']).to eq('0.0') expect(json_response['additional_tax_total']).to eq('0.0') @@ -484,11 +484,11 @@ def clean_address(address) it "lists line item adjustments" do adjustment = create(:adjustment, - :label => "10% off!", - :order => order, - :adjustable => order.line_items.first) + label: "10% off!", + order: order, + adjustable: order.line_items.first) adjustment.update_column(:amount, 5) - api_get :show, :id => order.to_param + api_get :show, id: order.to_param adjustment = json_response['line_items'].first['adjustments'].first expect(adjustment['label']).to eq("10% off!") @@ -497,7 +497,7 @@ def clean_address(address) it "lists payments source without gateway info" do order.payments.push payment = create(:payment) - api_get :show, :id => order.to_param + api_get :show, id: order.to_param source = json_response[:payments].first[:source] expect(source[:name]).to eq payment.source.name @@ -532,7 +532,7 @@ def clean_address(address) end it "returns available shipments for an order" do - api_get :show, :id => order.to_param + api_get :show, id: order.to_param expect(response.status).to eq(200) expect(json_response["shipments"]).not_to be_empty shipment = json_response["shipments"][0] @@ -608,7 +608,7 @@ def clean_address(address) it "lists payments source with gateway info" do order.payments.push payment = create(:payment) - api_get :show, :id => order.to_param + api_get :show, id: order.to_param source = json_response[:payments].first[:source] expect(source[:name]).to eq payment.source.name @@ -633,7 +633,7 @@ def clean_address(address) # Test for #1763 it "can control the page size through a parameter" do - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response["orders"].count).to eq(1) expect(json_response["orders"].first).to have_attributes(attributes) expect(json_response["count"]).to eq(1) @@ -651,7 +651,7 @@ def clean_address(address) let(:expected_result) { Spree::Order.last } it "can query the results through a parameter" do - api_get :index, :q => { :email_cont => 'spree' } + api_get :index, q: { email_cont: 'spree' } expect(json_response["orders"].count).to eq(1) expect(json_response["orders"].first).to have_attributes(attributes) expect(json_response["orders"].first["email"]).to eq(expected_result.email) @@ -679,7 +679,7 @@ def clean_address(address) it "can set the user_id for the order" do user = Spree.user_class.create - api_post :create, :order => { user_id: user.id } + api_post :create, order: { user_id: user.id } expect(response.status).to eq 201 expect(json_response["user_id"]).to eq(user.id) end @@ -688,7 +688,7 @@ def clean_address(address) context "updating" do it "can set the user_id for the order" do user = Spree.user_class.create - api_post :update, :id => order.number, :order => { user_id: user.id } + api_post :update, id: order.number, order: { user_id: user.id } expect(response.status).to eq 200 expect(json_response["user_id"]).to eq(user.id) end diff --git a/api/spec/controllers/spree/api/v1/payments_controller_spec.rb b/api/spec/controllers/spree/api/v1/payments_controller_spec.rb index 8ac8210520d..986a18abee6 100644 --- a/api/spec/controllers/spree/api/v1/payments_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/payments_controller_spec.rb @@ -1,15 +1,15 @@ require 'spec_helper' module Spree - describe Api::V1::PaymentsController, :type => :controller do + describe Api::V1::PaymentsController, type: :controller do render_views let!(:order) { create(:order) } - let!(:payment) { create(:payment, :order => order) } + let!(:payment) { create(:payment, order: order) } let!(:attributes) { [:id, :source_type, :source_id, :amount, :display_amount, :payment_method_id, :state, :avs_response, :created_at, :updated_at, :number] } - let(:resource_scoping) { { :order_id => order.to_param } } + let(:resource_scoping) { { order_id: order.to_param } } before do stub_authentication! @@ -18,7 +18,7 @@ module Spree context "as a user" do context "when the order belongs to the user" do before do - allow_any_instance_of(Order).to receive_messages :user => current_api_user + allow_any_instance_of(Order).to receive_messages user: current_api_user end it "can view the payments for their order" do @@ -34,39 +34,39 @@ module Spree end it "can create a new payment" do - api_post :create, :payment => { :payment_method_id => PaymentMethod.first.id, :amount => 50 } + api_post :create, payment: { payment_method_id: PaymentMethod.first.id, amount: 50 } expect(response.status).to eq(201) expect(json_response).to have_attributes(attributes) end it "can view a pre-existing payment's details" do - api_get :show, :id => payment.to_param + api_get :show, id: payment.to_param expect(json_response).to have_attributes(attributes) end it "cannot update a payment" do - api_put :update, :id => payment.to_param, :payment => { :amount => 2.01 } + api_put :update, id: payment.to_param, payment: { amount: 2.01 } assert_unauthorized! end it "cannot authorize a payment" do - api_put :authorize, :id => payment.to_param + api_put :authorize, id: payment.to_param assert_unauthorized! end end context "when the order does not belong to the user" do before do - allow_any_instance_of(Order).to receive_messages :user => stub_model(LegacyUser) + allow_any_instance_of(Order).to receive_messages user: stub_model(LegacyUser) end it "cannot view payments for somebody else's order" do - api_get :index, :order_id => order.to_param + api_get :index, order_id: order.to_param assert_unauthorized! end it "can view the payments for an order given the order token" do - api_get :index, :order_id => order.to_param, :order_token => order.guest_token + api_get :index, order_id: order.to_param, order_token: order.guest_token expect(json_response["payments"].first).to have_attributes(attributes) end end @@ -82,7 +82,7 @@ module Spree end context "multiple payments" do - before { @payment = create(:payment, :order => order) } + before { @payment = create(:payment, order: order) } it "can view all payments on an order" do api_get :index @@ -90,7 +90,7 @@ module Spree end it 'can control the page size through a parameter' do - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response['count']).to eq(1) expect(json_response['current_page']).to eq(1) expect(json_response['pages']).to eq(2) @@ -136,16 +136,16 @@ module Spree context "authorizing" do it "can authorize" do - api_put :authorize, :id => payment.to_param + api_put :authorize, id: payment.to_param expect(response.status).to eq(200) expect(payment.reload.state).to eq("pending") end context "authorization fails" do before do - fake_response = double(:success? => false, :to_s => "Could not authorize card") + fake_response = double(success?: false, to_s: "Could not authorize card") expect_any_instance_of(Spree::Gateway::Bogus).to receive(:authorize).and_return(fake_response) - api_put :authorize, :id => payment.to_param + api_put :authorize, id: payment.to_param end it "returns a 422 status" do @@ -163,19 +163,19 @@ module Spree context "capturing" do it "can capture" do - api_put :capture, :id => payment.to_param + api_put :capture, id: payment.to_param expect(response.status).to eq(200) expect(payment.reload.state).to eq("completed") end context "capturing fails" do before do - fake_response = double(:success? => false, :to_s => "Insufficient funds") + fake_response = double(success?: false, to_s: "Insufficient funds") expect_any_instance_of(Spree::Gateway::Bogus).to receive(:capture).and_return(fake_response) end it "returns a 422 status" do - api_put :capture, :id => payment.to_param + api_put :capture, id: payment.to_param expect(response.status).to eq(422) expect(json_response["error"]).to eq "Invalid resource. Please fix errors and try again." expect(json_response["errors"]["base"][0]).to eq "Insufficient funds" @@ -185,19 +185,19 @@ module Spree context "purchasing" do it "can purchase" do - api_put :purchase, :id => payment.to_param + api_put :purchase, id: payment.to_param expect(response.status).to eq(200) expect(payment.reload.state).to eq("completed") end context "purchasing fails" do before do - fake_response = double(:success? => false, :to_s => "Insufficient funds") + fake_response = double(success?: false, to_s: "Insufficient funds") expect_any_instance_of(Spree::Gateway::Bogus).to receive(:purchase).and_return(fake_response) end it "returns a 422 status" do - api_put :purchase, :id => payment.to_param + api_put :purchase, id: payment.to_param expect(response.status).to eq(422) expect(json_response["error"]).to eq "Invalid resource. Please fix errors and try again." expect(json_response["errors"]["base"][0]).to eq "Insufficient funds" diff --git a/api/spec/controllers/spree/api/v1/product_properties_controller_spec.rb b/api/spec/controllers/spree/api/v1/product_properties_controller_spec.rb index 2a941480f8e..5505a1e1c03 100644 --- a/api/spec/controllers/spree/api/v1/product_properties_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/product_properties_controller_spec.rb @@ -2,15 +2,15 @@ require 'shared_examples/protect_product_actions' module Spree - describe Api::V1::ProductPropertiesController, :type => :controller do + describe Api::V1::ProductPropertiesController, type: :controller do render_views let!(:product) { create(:product) } - let!(:property_1) {product.product_properties.create(:property_name => "My Property 1", :value => "my value 1", :position => 0)} - let!(:property_2) {product.product_properties.create(:property_name => "My Property 2", :value => "my value 2", :position => 1)} + let!(:property_1) {product.product_properties.create(property_name: "My Property 1", value: "my value 1", position: 0)} + let!(:property_2) {product.product_properties.create(property_name: "My Property 2", value: "my value 2", position: 1)} let(:attributes) { [:id, :product_id, :property_id, :value, :property_name] } - let(:resource_scoping) { { :product_id => product.to_param } } + let(:resource_scoping) { { product_id: product.to_param } } before do stub_authentication! @@ -34,7 +34,7 @@ module Spree end it "can control the page size through a parameter" do - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response['product_properties'].count).to eq(1) expect(json_response['current_page']).to eq(1) expect(json_response['pages']).to eq(2) @@ -43,13 +43,13 @@ module Spree it 'can query the results through a parameter' do Spree::ProductProperty.last.update_attribute(:value, 'loose') property = Spree::ProductProperty.last - api_get :index, :q => { :value_cont => 'loose' } + api_get :index, q: { value_cont: 'loose' } expect(json_response['count']).to eq(1) expect(json_response['product_properties'].first['value']).to eq property.value end it "can see a single product_property" do - api_get :show, :id => property_1.property_name + api_get :show, id: property_1.property_name expect(json_response).to have_attributes(attributes) end @@ -60,17 +60,17 @@ module Spree end it "cannot create a new product property if not an admin" do - api_post :create, :product_property => { :property_name => "My Property 3" } + api_post :create, product_property: { property_name: "My Property 3" } assert_unauthorized! end it "cannot update a product property" do - api_put :update, :id => property_1.property_name, :product_property => { :value => "my value 456" } + api_put :update, id: property_1.property_name, product_property: { value: "my value 456" } assert_unauthorized! end it "cannot delete a product property" do - api_delete :destroy, id: property_1.to_param, :property_name => property_1.property_name + api_delete :destroy, id: property_1.to_param, property_name: property_1.property_name assert_unauthorized! expect { property_1.reload }.not_to raise_error end @@ -80,26 +80,26 @@ module Spree it "can create a new product property" do expect do - api_post :create, :product_property => { :property_name => "My Property 3", :value => "my value 3" } + api_post :create, product_property: { property_name: "My Property 3", value: "my value 3" } end.to change(product.product_properties, :count).by(1) expect(json_response).to have_attributes(attributes) expect(response.status).to eq(201) end it "can update a product property" do - api_put :update, :id => property_1.property_name, :product_property => { :value => "my value 456" } + api_put :update, id: property_1.property_name, product_property: { value: "my value 456" } expect(response.status).to eq(200) end it "can delete a product property" do - api_delete :destroy, :id => property_1.property_name + api_delete :destroy, id: property_1.property_name expect(response.status).to eq(204) expect { property_1.reload }.to raise_error(ActiveRecord::RecordNotFound) end end context "with product identified by id" do - let(:resource_scoping) { { :product_id => product.id } } + let(:resource_scoping) { { product_id: product.id } } it "can see a list of all product properties" do api_get :index expect(json_response["product_properties"].count).to eq 2 @@ -107,7 +107,7 @@ module Spree end it "can see a single product_property by id" do - api_get :show, :id => property_1.id + api_get :show, id: property_1.id expect(json_response).to have_attributes(attributes) end end diff --git a/api/spec/controllers/spree/api/v1/products_controller_spec.rb b/api/spec/controllers/spree/api/v1/products_controller_spec.rb index 333d5b584fc..ff527f262de 100644 --- a/api/spec/controllers/spree/api/v1/products_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/products_controller_spec.rb @@ -2,7 +2,7 @@ require 'shared_examples/protect_product_actions' module Spree - describe Api::V1::ProductsController, :type => :controller do + describe Api::V1::ProductsController, type: :controller do render_views let!(:product) { create(:product) } @@ -59,7 +59,7 @@ module Spree end it "retrieves a list of products by id" do - api_get :index, :ids => [product.id] + api_get :index, ids: [product.id] expect(json_response["products"].first).to have_attributes(show_attributes) expect(json_response["total_count"]).to eq(1) expect(json_response["current_page"]).to eq(1) @@ -78,7 +78,7 @@ module Spree it "retrieves a list of products by ids string" do second_product = create(:product) - api_get :index, :ids => [product.id, second_product.id].join(",") + api_get :index, ids: [product.id, second_product.id].join(",") expect(json_response["products"].first).to have_attributes(show_attributes) expect(json_response["products"][1]).to have_attributes(show_attributes) expect(json_response["total_count"]).to eq(2) @@ -88,7 +88,7 @@ module Spree end it "does not return inactive products when queried by ids" do - api_get :index, :ids => [inactive_product.id] + api_get :index, ids: [inactive_product.id] expect(json_response["count"]).to eq(0) end @@ -100,7 +100,7 @@ module Spree context "pagination" do it "can select the next page of products" do second_product = create(:product) - api_get :index, :page => 2, :per_page => 1 + api_get :index, page: 2, per_page: 1 expect(json_response["products"].first).to have_attributes(show_attributes) expect(json_response["total_count"]).to eq(2) expect(json_response["current_page"]).to eq(2) @@ -109,7 +109,7 @@ module Spree it 'can control the page size through a parameter' do create(:product) - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response['count']).to eq(1) expect(json_response['total_count']).to eq(2) expect(json_response['current_page']).to eq(1) @@ -118,20 +118,20 @@ module Spree end it "can search for products" do - create(:product, :name => "The best product in the world") - api_get :index, :q => { :name_cont => "best" } + create(:product, name: "The best product in the world") + api_get :index, q: { name_cont: "best" } expect(json_response["products"].first).to have_attributes(show_attributes) expect(json_response["count"]).to eq(1) end it "gets a single product" do - product.master.images.create!(:attachment => image("thinking-cat.jpg")) + product.master.images.create!(attachment: image("thinking-cat.jpg")) create(:variant, product: product) - product.variants.first.images.create!(:attachment => image("thinking-cat.jpg")) + product.variants.first.images.create!(attachment: image("thinking-cat.jpg")) product.set_property("spree", "rocks") product.taxons << create(:taxon) - api_get :show, :id => product.to_param + api_get :show, id: product.to_param expect(json_response).to have_attributes(show_attributes) expect(json_response['variants'].first).to have_attributes([:name, @@ -161,7 +161,7 @@ module Spree before { Config.track_inventory_levels = false } it "still displays valid json with total_on_hand Float::INFINITY" do - api_get :show, :id => product.to_param + api_get :show, id: product.to_param expect(response).to be_ok expect(json_response[:total_on_hand]).to eq nil end @@ -170,29 +170,29 @@ module Spree end context "finds a product by slug first then by id" do - let!(:other_product) { create(:product, :slug => "these-are-not-the-droids-you-are-looking-for") } + let!(:other_product) { create(:product, slug: "these-are-not-the-droids-you-are-looking-for") } before do product.update_column(:slug, "#{other_product.id}-and-1-ways") end specify do - api_get :show, :id => product.to_param + api_get :show, id: product.to_param expect(json_response["slug"]).to match(/and-1-ways/) product.destroy - api_get :show, :id => other_product.id + api_get :show, id: other_product.id expect(json_response["slug"]).to match(/droids/) end end it "cannot see inactive products" do - api_get :show, :id => inactive_product.to_param + api_get :show, id: inactive_product.to_param assert_not_found! end it "returns a 404 error when it cannot find a product" do - api_get :show, :id => "non-existant" + api_get :show, id: "non-existant" assert_not_found! end @@ -225,7 +225,7 @@ module Spree # Regression test for #1626 context "deleted products" do before do - create(:product, :deleted_at => 1.day.ago) + create(:product, deleted_at: 1.day.ago) end it "does not include deleted products" do @@ -234,16 +234,16 @@ module Spree end it "can include deleted products" do - api_get :index, :show_deleted => 1 + api_get :index, show_deleted: 1 expect(json_response["products"].count).to eq(3) end end describe "creating a product" do it "can create a new product" do - api_post :create, :product => { :name => "The Other Product", - :price => 19.99, - :shipping_category_id => create(:shipping_category).id } + api_post :create, product: { name: "The Other Product", + price: 19.99, + shipping_category_id: create(:shipping_category).id } expect(json_response).to have_attributes(base_attributes) expect(response.status).to eq(201) end @@ -253,7 +253,7 @@ module Spree variants: [attributes_for_variant, attributes_for_variant] }) - api_post :create, :product => product_data + api_post :create, product: product_data expect(response.status).to eq 201 variants = json_response['variants'] @@ -272,7 +272,7 @@ module Spree }] }) - api_post :create, :product => product_data + api_post :create, product: product_data expect(json_response['product_properties'][0]['property_name']).to eq('fabric') expect(json_response['product_properties'][0]['value']).to eq('cotton') @@ -283,7 +283,7 @@ module Spree option_types: ['size', 'color'] }) - api_post :create, :product => product_data + api_post :create, product: product_data expect(json_response['option_types'].count).to eq(2) end @@ -295,11 +295,11 @@ module Spree end it "creates with shipping categories" do - hash = { :name => "The Other Product", - :price => 19.99, - :shipping_category => "Free Ships" } + hash = { name: "The Other Product", + price: 19.99, + shipping_category: "Free Ships" } - api_post :create, :product => hash + api_post :create, product: hash expect(response.status).to eq 201 shipping_id = ShippingCategory.find_by_name("Free Ships").id @@ -323,7 +323,7 @@ module Spree end it "can still create a product" do - api_post :create, :product => product_data, :token => "fake" + api_post :create, product: product_data, token: "fake" expect(json_response).to have_attributes(show_attributes) expect(response.status).to eq(201) end @@ -341,17 +341,17 @@ module Spree context 'updating a product' do it "can update a product" do - api_put :update, :id => product.to_param, :product => { :name => "New and Improved Product!" } + api_put :update, id: product.to_param, product: { name: "New and Improved Product!" } expect(response.status).to eq(200) end it "can create new option types on a product" do - api_put :update, :id => product.to_param, :product => { :option_types => ['shape', 'color'] } + api_put :update, id: product.to_param, product: { option_types: ['shape', 'color'] } expect(json_response['option_types'].count).to eq(2) end it "can create new variants on a product" do - api_put :update, :id => product.to_param, :product => { :variants => [attributes_for_variant, attributes_for_variant.merge(sku: "ABC-#{Kernel.rand(9999)}")] } + api_put :update, id: product.to_param, product: { variants: [attributes_for_variant, attributes_for_variant.merge(sku: "ABC-#{Kernel.rand(9999)}")] } expect(response.status).to eq 200 expect(json_response['variants'].count).to eq(2) # 2 variants @@ -364,16 +364,16 @@ module Spree it "can update an existing variant on a product" do variant_hash = { - :sku => '123', :price => 19.99, :options => [{:name => "size", :value => "small"}] + sku: '123', price: 19.99, options: [{name: "size", value: "small"}] } variant_id = product.variants.create!({ product: product }.merge(variant_hash)).id - api_put :update, :id => product.to_param, :product => { - :variants => [ + api_put :update, id: product.to_param, product: { + variants: [ variant_hash.merge( - :id => variant_id.to_s, - :sku => '456', - :options => [{:name => "size", :value => "large" }] + id: variant_id.to_s, + sku: '456', + options: [{name: "size", value: "large" }] ) ] } @@ -386,7 +386,7 @@ module Spree end it "cannot update a product with an invalid attribute" do - api_put :update, :id => product.to_param, :product => { :name => "" } + api_put :update, id: product.to_param, product: { name: "" } expect(response.status).to eq(422) expect(json_response["error"]).to eq("Invalid resource. Please fix errors and try again.") expect(json_response["errors"]["name"]).to eq(["can't be blank"]) @@ -400,7 +400,7 @@ module Spree it "can delete a product" do expect(product.deleted_at).to be_nil - api_delete :destroy, :id => product.to_param + api_delete :destroy, id: product.to_param expect(response.status).to eq(204) expect(product.reload.deleted_at).not_to be_nil end diff --git a/api/spec/controllers/spree/api/v1/promotion_application_spec.rb b/api/spec/controllers/spree/api/v1/promotion_application_spec.rb index 4b36cd52321..f717bc0248d 100644 --- a/api/spec/controllers/spree/api/v1/promotion_application_spec.rb +++ b/api/spec/controllers/spree/api/v1/promotion_application_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::OrdersController, :type => :controller do + describe Api::V1::OrdersController, type: :controller do render_views before do @@ -9,7 +9,7 @@ module Spree end context "with an available promotion" do - let!(:order) { create(:order_with_line_items, :line_items_count => 1) } + let!(:order) { create(:order_with_line_items, line_items_count: 1) } let!(:promotion) do promotion = Spree::Promotion.create(name: "10% off", code: "10off") calculator = Spree::Calculator::FlatPercentItemTotal.create(preferred_flat_percent: "10") @@ -20,7 +20,7 @@ module Spree it "can apply a coupon code to the order" do expect(order.total).to eq(110.00) - api_put :apply_coupon_code, :id => order.to_param, :coupon_code => "10off", :order_token => order.guest_token + api_put :apply_coupon_code, id: order.to_param, coupon_code: "10off", order_token: order.guest_token expect(response.status).to eq(200) expect(order.reload.total).to eq(109.00) expect(json_response["success"]).to eq("The coupon code was successfully applied to your order.") @@ -37,7 +37,7 @@ module Spree end it "fails to apply" do - api_put :apply_coupon_code, :id => order.to_param, :coupon_code => "10off", :order_token => order.guest_token + api_put :apply_coupon_code, id: order.to_param, coupon_code: "10off", order_token: order.guest_token expect(response.status).to eq(422) expect(json_response["success"]).to be_blank expect(json_response["error"]).to eq("The coupon code is expired") diff --git a/api/spec/controllers/spree/api/v1/promotions_controller_spec.rb b/api/spec/controllers/spree/api/v1/promotions_controller_spec.rb index 4fba173c02b..3caa84b1c5c 100644 --- a/api/spec/controllers/spree/api/v1/promotions_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/promotions_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::PromotionsController, :type => :controller do + describe Api::V1::PromotionsController, type: :controller do render_views shared_examples "a JSON response" do diff --git a/api/spec/controllers/spree/api/v1/properties_controller_spec.rb b/api/spec/controllers/spree/api/v1/properties_controller_spec.rb index 1fb70ef81cd..6d345535c54 100644 --- a/api/spec/controllers/spree/api/v1/properties_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/properties_controller_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' module Spree - describe Api::V1::PropertiesController, :type => :controller do + describe Api::V1::PropertiesController, type: :controller do render_views - let!(:property_1) { Property.create!(:name => "foo", :presentation => "Foo") } - let!(:property_2) { Property.create!(:name => "bar", :presentation => "Bar") } + let!(:property_1) { Property.create!(name: "foo", presentation: "Foo") } + let!(:property_2) { Property.create!(name: "bar", presentation: "Bar") } let(:attributes) { [:id, :name, :presentation] } @@ -19,38 +19,38 @@ module Spree end it "can control the page size through a parameter" do - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response['properties'].count).to eq(1) expect(json_response['current_page']).to eq(1) expect(json_response['pages']).to eq(2) end it 'can query the results through a parameter' do - api_get :index, :q => { :name_cont => 'ba' } + api_get :index, q: { name_cont: 'ba' } expect(json_response['count']).to eq(1) expect(json_response['properties'].first['presentation']).to eq property_2.presentation end it "retrieves a list of properties by id" do - api_get :index, :ids => [property_1.id] + api_get :index, ids: [property_1.id] expect(json_response["properties"].first).to have_attributes(attributes) expect(json_response["count"]).to eq(1) end it "retrieves a list of properties by ids string" do - api_get :index, :ids => [property_1.id, property_2.id].join(",") + api_get :index, ids: [property_1.id, property_2.id].join(",") expect(json_response["properties"].first).to have_attributes(attributes) expect(json_response["properties"][1]).to have_attributes(attributes) expect(json_response["count"]).to eq(2) end it "can see a single property" do - api_get :show, :id => property_1.id + api_get :show, id: property_1.id expect(json_response).to have_attributes(attributes) end it "can see a property by name" do - api_get :show, :id => property_1.name + api_get :show, id: property_1.name expect(json_response).to have_attributes(attributes) end @@ -61,17 +61,17 @@ module Spree end it "cannot create a new property if not an admin" do - api_post :create, :property => { :name => "My Property 3" } + api_post :create, property: { name: "My Property 3" } assert_unauthorized! end it "cannot update a property" do - api_put :update, :id => property_1.name, :property => { :presentation => "my value 456" } + api_put :update, id: property_1.name, property: { presentation: "my value 456" } assert_unauthorized! end it "cannot delete a property" do - api_delete :destroy, :id => property_1.id + api_delete :destroy, id: property_1.id assert_unauthorized! expect { property_1.reload }.not_to raise_error end @@ -81,19 +81,19 @@ module Spree it "can create a new property" do expect(Spree::Property.count).to eq(2) - api_post :create, :property => { :name => "My Property 3", :presentation => "my value 3" } + api_post :create, property: { name: "My Property 3", presentation: "my value 3" } expect(json_response).to have_attributes(attributes) expect(response.status).to eq(201) expect(Spree::Property.count).to eq(3) end it "can update a property" do - api_put :update, :id => property_1.name, :property => { :presentation => "my value 456" } + api_put :update, id: property_1.name, property: { presentation: "my value 456" } expect(response.status).to eq(200) end it "can delete a property" do - api_delete :destroy, :id => property_1.name + api_delete :destroy, id: property_1.name expect(response.status).to eq(204) expect { property_1.reload }.to raise_error(ActiveRecord::RecordNotFound) end diff --git a/api/spec/controllers/spree/api/v1/return_authorizations_controller_spec.rb b/api/spec/controllers/spree/api/v1/return_authorizations_controller_spec.rb index 67b810670f2..0988ab842be 100644 --- a/api/spec/controllers/spree/api/v1/return_authorizations_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/return_authorizations_controller_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' module Spree - describe Api::V1::ReturnAuthorizationsController, :type => :controller do + describe Api::V1::ReturnAuthorizationsController, type: :controller do render_views let!(:order) { create(:shipped_order) } let(:product) { create(:product) } let(:attributes) { [:id, :memo, :state] } - let(:resource_scoping) { { :order_id => order.to_param } } + let(:resource_scoping) { { order_id: order.to_param } } before do stub_authentication! @@ -16,7 +16,7 @@ module Spree context "as the order owner" do before do - allow_any_instance_of(Order).to receive_messages :user => current_api_user + allow_any_instance_of(Order).to receive_messages user: current_api_user end it "cannot see any return authorizations" do @@ -25,7 +25,7 @@ module Spree end it "cannot see a single return authorization" do - api_get :show, :id => 1 + api_get :show, id: 1 assert_unauthorized! end @@ -54,18 +54,18 @@ module Spree sign_in_as_admin! it "can show return authorization" do - FactoryGirl.create(:return_authorization, :order => order) + FactoryGirl.create(:return_authorization, order: order) return_authorization = order.return_authorizations.first - api_get :show, :order_id => order.number, :id => return_authorization.id + api_get :show, order_id: order.number, id: return_authorization.id expect(response.status).to eq(200) expect(json_response).to have_attributes(attributes) expect(json_response["state"]).not_to be_blank end it "can get a list of return authorizations" do - FactoryGirl.create(:return_authorization, :order => order) - FactoryGirl.create(:return_authorization, :order => order) - api_get :index, { :order_id => order.number } + FactoryGirl.create(:return_authorization, order: order) + FactoryGirl.create(:return_authorization, order: order) + api_get :index, { order_id: order.number } expect(response.status).to eq(200) return_authorizations = json_response["return_authorizations"] expect(return_authorizations.first).to have_attributes(attributes) @@ -73,19 +73,19 @@ module Spree end it 'can control the page size through a parameter' do - FactoryGirl.create(:return_authorization, :order => order) - FactoryGirl.create(:return_authorization, :order => order) - api_get :index, :order_id => order.number, :per_page => 1 + FactoryGirl.create(:return_authorization, order: order) + FactoryGirl.create(:return_authorization, order: order) + api_get :index, order_id: order.number, per_page: 1 expect(json_response['count']).to eq(1) expect(json_response['current_page']).to eq(1) expect(json_response['pages']).to eq(2) end it 'can query the results through a paramter' do - FactoryGirl.create(:return_authorization, :order => order) - expected_result = create(:return_authorization, :memo => 'damaged') + FactoryGirl.create(:return_authorization, order: order) + expected_result = create(:return_authorization, memo: 'damaged') order.return_authorizations << expected_result - api_get :index, :q => { :memo_cont => 'damaged' } + api_get :index, q: { memo_cont: 'damaged' } expect(json_response['count']).to eq(1) expect(json_response['return_authorizations'].first['memo']).to eq expected_result.memo end @@ -98,26 +98,26 @@ module Spree end it "can update a return authorization on the order" do - FactoryGirl.create(:return_authorization, :order => order) + FactoryGirl.create(:return_authorization, order: order) return_authorization = order.return_authorizations.first - api_put :update, :id => return_authorization.id, :return_authorization => { :memo => "ABC" } + api_put :update, id: return_authorization.id, return_authorization: { memo: "ABC" } expect(response.status).to eq(200) expect(json_response).to have_attributes(attributes) end it "can cancel a return authorization on the order" do - FactoryGirl.create(:new_return_authorization, :order => order) + FactoryGirl.create(:new_return_authorization, order: order) return_authorization = order.return_authorizations.first expect(return_authorization.state).to eq("authorized") - api_delete :cancel, :id => return_authorization.id + api_delete :cancel, id: return_authorization.id expect(response.status).to eq(200) expect(return_authorization.reload.state).to eq("canceled") end it "can delete a return authorization on the order" do - FactoryGirl.create(:return_authorization, :order => order) + FactoryGirl.create(:return_authorization, order: order) return_authorization = order.return_authorizations.first - api_delete :destroy, :id => return_authorization.id + api_delete :destroy, id: return_authorization.id expect(response.status).to eq(204) expect { return_authorization.reload }.to raise_error(ActiveRecord::RecordNotFound) end @@ -125,10 +125,10 @@ module Spree it "can add a new return authorization to an existing order" do stock_location = FactoryGirl.create(:stock_location) reason = FactoryGirl.create(:return_authorization_reason) - rma_params = { :stock_location_id => stock_location.id, - :return_authorization_reason_id => reason.id, - :memo => "Defective" } - api_post :create, :order_id => order.number, :return_authorization => rma_params + rma_params = { stock_location_id: stock_location.id, + return_authorization_reason_id: reason.id, + memo: "Defective" } + api_post :create, order_id: order.number, return_authorization: rma_params expect(response.status).to eq(201) expect(json_response).to have_attributes(attributes) expect(json_response["state"]).not_to be_blank @@ -137,22 +137,22 @@ module Spree context "as just another user" do it "cannot add a return authorization to the order" do - api_post :create, :return_autorization => { :order_id => order.number, :memo => "Defective" } + api_post :create, return_autorization: { order_id: order.number, memo: "Defective" } assert_unauthorized! end it "cannot update a return authorization on the order" do - FactoryGirl.create(:return_authorization, :order => order) + FactoryGirl.create(:return_authorization, order: order) return_authorization = order.return_authorizations.first - api_put :update, :id => return_authorization.id, :return_authorization => { :memo => "ABC" } + api_put :update, id: return_authorization.id, return_authorization: { memo: "ABC" } assert_unauthorized! expect(return_authorization.reload.memo).not_to eq("ABC") end it "cannot delete a return authorization on the order" do - FactoryGirl.create(:return_authorization, :order => order) + FactoryGirl.create(:return_authorization, order: order) return_authorization = order.return_authorizations.first - api_delete :destroy, :id => return_authorization.id + api_delete :destroy, id: return_authorization.id assert_unauthorized! expect { return_authorization.reload }.not_to raise_error end diff --git a/api/spec/controllers/spree/api/v1/shipments_controller_spec.rb b/api/spec/controllers/spree/api/v1/shipments_controller_spec.rb index b1e5756806f..51ebb83696c 100644 --- a/api/spec/controllers/spree/api/v1/shipments_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/shipments_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Api::V1::ShipmentsController, :type => :controller do +describe Spree::Api::V1::ShipmentsController, type: :controller do render_views let!(:shipment) { create(:shipment) } let!(:attributes) { [:id, :tracking, :number, :cost, :shipped_at, :stock_location_name, :order_id, :shipping_rates, :shipping_methods] } @@ -77,7 +77,7 @@ end it "can make a shipment ready" do - allow_any_instance_of(Spree::Order).to receive_messages(:paid? => true, :complete? => true) + allow_any_instance_of(Spree::Order).to receive_messages(paid?: true, complete?: true) api_put :ready expect(json_response).to have_attributes(attributes) expect(json_response["state"]).to eq("ready") @@ -85,7 +85,7 @@ end it "cannot make a shipment ready if the order is unpaid" do - allow_any_instance_of(Spree::Order).to receive_messages(:paid? => false) + allow_any_instance_of(Spree::Order).to receive_messages(paid?: false) api_put :ready expect(json_response["error"]).to eq("Cannot ready shipment.") expect(response.status).to eq(422) @@ -121,10 +121,10 @@ context "can transition a shipment from ready to ship" do before do - allow_any_instance_of(Spree::Order).to receive_messages(:paid? => true, :complete? => true) + allow_any_instance_of(Spree::Order).to receive_messages(paid?: true, complete?: true) shipment.update!(shipment.order) expect(shipment.state).to eq("ready") - allow_any_instance_of(Spree::ShippingRate).to receive_messages(:cost => 5) + allow_any_instance_of(Spree::ShippingRate).to receive_messages(cost: 5) end it "can transition a shipment from ready to ship" do diff --git a/api/spec/controllers/spree/api/v1/states_controller_spec.rb b/api/spec/controllers/spree/api/v1/states_controller_spec.rb index cb9c44a3c2a..c1d62ae7299 100644 --- a/api/spec/controllers/spree/api/v1/states_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/states_controller_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' module Spree - describe Api::V1::StatesController, :type => :controller do + describe Api::V1::StatesController, type: :controller do render_views - let!(:state) { create(:state, :name => "Victoria") } + let!(:state) { create(:state, name: "Victoria") } let(:attributes) { [:id, :name, :abbr, :country_id] } before do @@ -18,7 +18,7 @@ module Spree end it "gets all the states for a particular country" do - api_get :index, :country_id => state.country.id + api_get :index, country_id: state.country.id expect(json_response["states"].first).to have_attributes(attributes) expect(json_response['states'].first['name']).to eq(state.name) end @@ -42,26 +42,26 @@ module Spree it "paginates when page parameter is passed through" do expect(scope).to receive(:page).with(1).and_return(scope) expect(scope).to receive(:per).with(nil).and_return(scope) - api_get :index, :page => 1 + api_get :index, page: 1 end it "paginates when per_page parameter is passed through" do expect(scope).to receive(:page).with(nil).and_return(scope) expect(scope).to receive(:per).with(25).and_return(scope) - api_get :index, :per_page => 25 + api_get :index, per_page: 25 end end context "with two states" do - before { create(:state, :name => "New South Wales") } + before { create(:state, name: "New South Wales") } it "gets all states for a country" do - country = create(:country, :states_required => true) + country = create(:country, states_required: true) state.country = country state.save - api_get :index, :country_id => country.id + api_get :index, country_id: country.id expect(json_response["states"].first).to have_attributes(attributes) expect(json_response["states"].count).to eq(1) json_response["states_required"] = true @@ -73,13 +73,13 @@ module Spree end it 'can query the results through a paramter' do - api_get :index, :q => { :name_cont => 'Vic' } + api_get :index, q: { name_cont: 'Vic' } expect(json_response['states'].first['name']).to eq("Victoria") end end it "can view a state" do - api_get :show, :id => state.id + api_get :show, id: state.id expect(json_response).to have_attributes(attributes) end end diff --git a/api/spec/controllers/spree/api/v1/stock_items_controller_spec.rb b/api/spec/controllers/spree/api/v1/stock_items_controller_spec.rb index a9565ab3784..ef3e3a61347 100644 --- a/api/spec/controllers/spree/api/v1/stock_items_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/stock_items_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::StockItemsController, :type => :controller do + describe Api::V1::StockItemsController, type: :controller do render_views let!(:stock_location) { create(:stock_location_with_items) } diff --git a/api/spec/controllers/spree/api/v1/stock_locations_controller_spec.rb b/api/spec/controllers/spree/api/v1/stock_locations_controller_spec.rb index 5b1b7393d3e..3796166946c 100644 --- a/api/spec/controllers/spree/api/v1/stock_locations_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/stock_locations_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::StockLocationsController, :type => :controller do + describe Api::V1::StockLocationsController, type: :controller do render_views let!(:stock_location) { create(:stock_location) } @@ -18,7 +18,7 @@ module Spree end it "cannot see a single stock location" do - api_get :show, :id => stock_location.id + api_get :show, id: stock_location.id expect(response.status).to eq(404) end @@ -35,12 +35,12 @@ module Spree end it "cannot update a stock location" do - api_put :update, :stock_location => { :name => "South Pole" }, :id => stock_location.to_param + api_put :update, stock_location: { name: "South Pole" }, id: stock_location.to_param expect(response.status).to eq(404) end it "cannot delete a stock location" do - api_put :destroy, :id => stock_location.to_param + api_put :destroy, id: stock_location.to_param expect(response.status).to eq(404) end end diff --git a/api/spec/controllers/spree/api/v1/stock_movements_controller_spec.rb b/api/spec/controllers/spree/api/v1/stock_movements_controller_spec.rb index 9f62fe9be2e..da21bb907e7 100644 --- a/api/spec/controllers/spree/api/v1/stock_movements_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/stock_movements_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::StockMovementsController, :type => :controller do + describe Api::V1::StockMovementsController, type: :controller do render_views let!(:stock_location) { create(:stock_location_with_items) } diff --git a/api/spec/controllers/spree/api/v1/taxonomies_controller_spec.rb b/api/spec/controllers/spree/api/v1/taxonomies_controller_spec.rb index d442216eb42..e3c2b573a4d 100644 --- a/api/spec/controllers/spree/api/v1/taxonomies_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/taxonomies_controller_spec.rb @@ -1,17 +1,17 @@ require 'spec_helper' module Spree - describe Api::V1::TaxonomiesController, :type => :controller do + describe Api::V1::TaxonomiesController, type: :controller do render_views let(:taxonomy) { create(:taxonomy) } - let(:taxon) { create(:taxon, :name => "Ruby", :taxonomy => taxonomy) } - let(:taxon2) { create(:taxon, :name => "Rails", :taxonomy => taxonomy) } + let(:taxon) { create(:taxon, name: "Ruby", taxonomy: taxonomy) } + let(:taxon2) { create(:taxon, name: "Rails", taxonomy: taxonomy) } let(:attributes) { [:id, :name] } before do stub_authentication! - taxon2.children << create(:taxon, :name => "3.2.2", :taxonomy => taxonomy) + taxon2.children << create(:taxon, name: "3.2.2", taxonomy: taxonomy) taxon.children << taxon2 taxonomy.root.children << taxon end @@ -26,21 +26,21 @@ module Spree it 'can control the page size through a parameter' do create(:taxonomy) - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response['count']).to eq(1) expect(json_response['current_page']).to eq(1) expect(json_response['pages']).to eq(2) end it 'can query the results through a paramter' do - expected_result = create(:taxonomy, :name => 'Style') - api_get :index, :q => { :name_cont => 'style' } + expected_result = create(:taxonomy, name: 'Style') + api_get :index, q: { name_cont: 'style' } expect(json_response['count']).to eq(1) expect(json_response['taxonomies'].first['name']).to eq expected_result.name end it "gets a single taxonomy" do - api_get :show, :id => taxonomy.id + api_get :show, id: taxonomy.id expect(json_response['name']).to eq taxonomy.name @@ -51,7 +51,7 @@ module Spree end it "gets a single taxonomy with set=nested" do - api_get :show, :id => taxonomy.id, :set => 'nested' + api_get :show, id: taxonomy.id, set: 'nested' expect(json_response['name']).to eq taxonomy.name @@ -60,7 +60,7 @@ module Spree end it "gets the jstree-friendly version of a taxonomy" do - api_get :jstree, :id => taxonomy.id + api_get :jstree, id: taxonomy.id expect(json_response["data"]).to eq(taxonomy.root.name) expect(json_response["attr"]).to eq({ "id" => taxonomy.root.id, "name" => taxonomy.root.name}) expect(json_response["state"]).to eq("closed") @@ -74,17 +74,17 @@ module Spree end it "cannot create a new taxonomy if not an admin" do - api_post :create, :taxonomy => { :name => "Location" } + api_post :create, taxonomy: { name: "Location" } assert_unauthorized! end it "cannot update a taxonomy" do - api_put :update, :id => taxonomy.id, :taxonomy => { :name => "I hacked your store!" } + api_put :update, id: taxonomy.id, taxonomy: { name: "I hacked your store!" } assert_unauthorized! end it "cannot delete a taxonomy" do - api_delete :destroy, :id => taxonomy.id + api_delete :destroy, id: taxonomy.id assert_unauthorized! end end @@ -93,20 +93,20 @@ module Spree sign_in_as_admin! it "can create" do - api_post :create, :taxonomy => { :name => "Colors"} + api_post :create, taxonomy: { name: "Colors"} expect(json_response).to have_attributes(attributes) expect(response.status).to eq(201) end it "cannot create a new taxonomy with invalid attributes" do - api_post :create, :taxonomy => {} + api_post :create, taxonomy: {} expect(response.status).to eq(422) expect(json_response["error"]).to eq("Invalid resource. Please fix errors and try again.") errors = json_response["errors"] end it "can destroy" do - api_delete :destroy, :id => taxonomy.id + api_delete :destroy, id: taxonomy.id expect(response.status).to eq(204) end end diff --git a/api/spec/controllers/spree/api/v1/taxons_controller_spec.rb b/api/spec/controllers/spree/api/v1/taxons_controller_spec.rb index 7ee25560b24..9345f262970 100644 --- a/api/spec/controllers/spree/api/v1/taxons_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/taxons_controller_spec.rb @@ -1,24 +1,24 @@ require 'spec_helper' module Spree - describe Api::V1::TaxonsController, :type => :controller do + describe Api::V1::TaxonsController, type: :controller do render_views let(:taxonomy) { create(:taxonomy) } - let(:taxon) { create(:taxon, :name => "Ruby", :taxonomy => taxonomy) } - let(:taxon2) { create(:taxon, :name => "Rails", :taxonomy => taxonomy) } + let(:taxon) { create(:taxon, name: "Ruby", taxonomy: taxonomy) } + let(:taxon2) { create(:taxon, name: "Rails", taxonomy: taxonomy) } let(:attributes) { ["id", "name", "pretty_name", "permalink", "parent_id", "taxonomy_id"] } before do stub_authentication! - taxon2.children << create(:taxon, :name => "3.2.2", :taxonomy => taxonomy) + taxon2.children << create(:taxon, name: "3.2.2", taxonomy: taxonomy) taxon.children << taxon2 taxonomy.root.children << taxon end context "as a normal user" do it "gets all taxons for a taxonomy" do - api_get :index, :taxonomy_id => taxonomy.id + api_get :index, taxonomy_id: taxonomy.id expect(json_response['taxons'].first['name']).to eq taxon.name children = json_response['taxons'].first['taxons'] @@ -29,17 +29,17 @@ module Spree # Regression test for #4112 it "does not include children when asked not to" do - api_get :index, :taxonomy_id => taxonomy.id, :without_children => 1 + api_get :index, taxonomy_id: taxonomy.id, without_children: 1 expect(json_response['taxons'].first['name']).to eq(taxon.name) expect(json_response['taxons'].first['taxons']).to be_nil end it "paginates through taxons" do - new_taxon = create(:taxon, :name => "Go", :taxonomy => taxonomy) + new_taxon = create(:taxon, name: "Go", taxonomy: taxonomy) taxonomy.root.children << new_taxon expect(taxonomy.root.children.count).to eql(2) - api_get :index, :taxonomy_id => taxonomy.id, :page => 1, :per_page => 1 + api_get :index, taxonomy_id: taxonomy.id, page: 1, per_page: 1 expect(json_response["count"]).to eql(1) expect(json_response["total_count"]).to eql(2) expect(json_response["current_page"]).to eql(1) @@ -50,7 +50,7 @@ module Spree describe 'searching' do context 'with a name' do before do - api_get :index, :q => { :name_cont => name } + api_get :index, q: { name_cont: name } end context 'with one result' do @@ -86,14 +86,14 @@ module Spree end it "gets a single taxon" do - api_get :show, :id => taxon.id, :taxonomy_id => taxonomy.id + api_get :show, id: taxon.id, taxonomy_id: taxonomy.id expect(json_response['name']).to eq taxon.name expect(json_response['taxons'].count).to eq 1 end it "gets all taxons in JSTree form" do - api_get :jstree, :taxonomy_id => taxonomy.id, :id => taxon.id + api_get :jstree, taxonomy_id: taxonomy.id, id: taxon.id response = json_response.first expect(response["data"]).to eq(taxon2.name) expect(response["attr"]).to eq({ "name" => taxon2.name, "id" => taxon2.id}) @@ -101,24 +101,24 @@ module Spree end it "can learn how to create a new taxon" do - api_get :new, :taxonomy_id => taxonomy.id + api_get :new, taxonomy_id: taxonomy.id expect(json_response["attributes"]).to eq(attributes.map(&:to_s)) required_attributes = json_response["required_attributes"] expect(required_attributes).to include("name") end it "cannot create a new taxon if not an admin" do - api_post :create, :taxonomy_id => taxonomy.id, :taxon => { :name => "Location" } + api_post :create, taxonomy_id: taxonomy.id, taxon: { name: "Location" } assert_unauthorized! end it "cannot update a taxon" do - api_put :update, :taxonomy_id => taxonomy.id, :id => taxon.id, :taxon => { :name => "I hacked your store!" } + api_put :update, taxonomy_id: taxonomy.id, id: taxon.id, taxon: { name: "I hacked your store!" } assert_unauthorized! end it "cannot delete a taxon" do - api_delete :destroy, :taxonomy_id => taxonomy.id, :id => taxon.id + api_delete :destroy, taxonomy_id: taxonomy.id, id: taxon.id assert_unauthorized! end end @@ -127,12 +127,12 @@ module Spree sign_in_as_admin! it "can create" do - api_post :create, :taxonomy_id => taxonomy.id, :taxon => { :name => "Colors" } + api_post :create, taxonomy_id: taxonomy.id, taxon: { name: "Colors" } expect(json_response).to have_attributes(attributes) expect(response.status).to eq(201) expect(taxonomy.reload.root.children.count).to eq 2 - taxon = Spree::Taxon.where(:name => 'Colors').first + taxon = Spree::Taxon.where(name: 'Colors').first expect(taxon.parent_id).to eq taxonomy.root.id expect(taxon.taxonomy_id).to eq taxonomy.id @@ -140,14 +140,14 @@ module Spree it "can update the position in the list" do taxonomy.root.children << taxon2 - api_put :update, :taxonomy_id => taxonomy.id, :id => taxon.id, :taxon => {:parent_id => taxon.parent_id, :child_index => 2 } + api_put :update, taxonomy_id: taxonomy.id, id: taxon.id, taxon: {parent_id: taxon.parent_id, child_index: 2 } expect(response.status).to eq(200) expect(taxonomy.reload.root.children[0]).to eql taxon2 expect(taxonomy.reload.root.children[1]).to eql taxon end it "cannot create a new taxon with invalid attributes" do - api_post :create, :taxonomy_id => taxonomy.id, :taxon => {} + api_post :create, taxonomy_id: taxonomy.id, taxon: {} expect(response.status).to eq(422) expect(json_response["error"]).to eq("Invalid resource. Please fix errors and try again.") errors = json_response["errors"] @@ -156,7 +156,7 @@ module Spree end it "cannot create a new taxon with invalid taxonomy_id" do - api_post :create, :taxonomy_id => 1000, :taxon => { :name => "Colors" } + api_post :create, taxonomy_id: 1000, taxon: { name: "Colors" } expect(response.status).to eq(422) expect(json_response["error"]).to eq("Invalid resource. Please fix errors and try again.") @@ -168,7 +168,7 @@ module Spree end it "can destroy" do - api_delete :destroy, :taxonomy_id => taxonomy.id, :id => taxon.id + api_delete :destroy, taxonomy_id: taxonomy.id, id: taxon.id expect(response.status).to eq(204) end end diff --git a/api/spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb b/api/spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb index a10beb3bafe..90218de8e17 100644 --- a/api/spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/unauthenticated_products_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' module Spree - describe Api::V1::ProductsController, :type => :controller do + describe Api::V1::ProductsController, type: :controller do render_views let!(:product) { create(:product) } diff --git a/api/spec/controllers/spree/api/v1/users_controller_spec.rb b/api/spec/controllers/spree/api/v1/users_controller_spec.rb index bb5ad42b0c1..69051afa710 100644 --- a/api/spec/controllers/spree/api/v1/users_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/users_controller_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' module Spree - describe Api::V1::UsersController, :type => :controller do + describe Api::V1::UsersController, type: :controller do render_views let(:user) { create(:user, spree_api_key: rand.to_s) } - let(:stranger) { create(:user, :email => 'stranger@example.com') } + let(:stranger) { create(:user, email: 'stranger@example.com') } let(:attributes) { [:id, :email, :created_at, :updated_at] } context "as a normal user" do @@ -28,16 +28,16 @@ module Spree it "can create a new user" do user_params = { - :email => 'new@example.com', :password => 'spree123', :password_confirmation => 'spree123' + email: 'new@example.com', password: 'spree123', password_confirmation: 'spree123' } - api_post :create, :user => user_params, token: user.spree_api_key + api_post :create, user: user_params, token: user.spree_api_key expect(json_response['email']).to eq 'new@example.com' end # there's no validations on LegacyUser? xit "cannot create a new user with invalid attributes" do - api_post :create, :user => {}, token: user.spree_api_key + api_post :create, user: {}, token: user.spree_api_key expect(response.status).to eq(422) expect(json_response["error"]).to eq("Invalid resource. Please fix errors and try again.") errors = json_response["errors"] @@ -74,7 +74,7 @@ module Spree end it "cannot update other users details" do - api_put :update, id: stranger.id, token: user.spree_api_key, user: { :email => "mine@example.com" } + api_put :update, id: stranger.id, token: user.spree_api_key, user: { email: "mine@example.com" } assert_not_found! end @@ -116,34 +116,34 @@ module Spree it 'can control the page size through a parameter' do 2.times { create(:user) } - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response['count']).to eq(1) expect(json_response['current_page']).to eq(1) expect(json_response['pages']).to eq(2) end it 'can query the results through a paramter' do - expected_result = create(:user, :email => 'brian@spreecommerce.com') - api_get :index, :q => { :email_cont => 'brian' } + expected_result = create(:user, email: 'brian@spreecommerce.com') + api_get :index, q: { email_cont: 'brian' } expect(json_response['count']).to eq(1) expect(json_response['users'].first['email']).to eq expected_result.email end it "can create" do - api_post :create, :user => { :email => "new@example.com", :password => 'spree123', :password_confirmation => 'spree123' } + api_post :create, user: { email: "new@example.com", password: 'spree123', password_confirmation: 'spree123' } expect(json_response).to have_attributes(attributes) expect(response.status).to eq(201) end it "can destroy user without orders" do user.orders.destroy_all - api_delete :destroy, :id => user.id + api_delete :destroy, id: user.id expect(response.status).to eq(204) end it "cannot destroy user with orders" do - create(:completed_order_with_totals, :user => user) - api_delete :destroy, :id => user.id + create(:completed_order_with_totals, user: user) + api_delete :destroy, id: user.id expect(json_response["exception"]).to eq "Spree::Core::DestroyWithOrdersError" expect(response.status).to eq(422) end diff --git a/api/spec/controllers/spree/api/v1/variants_controller_spec.rb b/api/spec/controllers/spree/api/v1/variants_controller_spec.rb index 2f935e088d9..f62c05e4ae9 100644 --- a/api/spec/controllers/spree/api/v1/variants_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/variants_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Api::V1::VariantsController, :type => :controller do + describe Api::V1::VariantsController, type: :controller do render_views let(:option_value) { create(:option_value) } @@ -32,15 +32,15 @@ module Spree it 'can control the page size through a parameter' do create(:variant) - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response['count']).to eq(1) expect(json_response['current_page']).to eq(1) expect(json_response['pages']).to eq(3) end it 'can query the results through a parameter' do - expected_result = create(:variant, :sku => 'FOOBAR') - api_get :index, :q => { :sku_cont => 'FOO' } + expected_result = create(:variant, sku: 'FOOBAR') + api_get :index, q: { sku_cont: 'FOO' } expect(json_response['count']).to eq(1) expect(json_response['variants'].first['sku']).to eq expected_result.sku end @@ -55,7 +55,7 @@ module Spree end it "variants returned contain images data" do - variant.images.create!(:attachment => image("thinking-cat.jpg")) + variant.images.create!(attachment: image("thinking-cat.jpg")) api_get :index @@ -88,7 +88,7 @@ module Spree end it "is not returned even when show_deleted is passed" do - api_get :index, :show_deleted => true + api_get :index, show_deleted: true expect(json_response["variants"].count).to eq(0) end end @@ -96,7 +96,7 @@ module Spree context "pagination" do it "can select the next page of variants" do second_variant = create(:variant) - api_get :index, :page => 2, :per_page => 1 + api_get :index, page: 2, per_page: 1 expect(json_response["variants"].first).to have_attributes(show_attributes) expect(json_response["total_count"]).to eq(3) expect(json_response["current_page"]).to eq(2) @@ -105,7 +105,7 @@ module Spree end it "can see a single variant" do - api_get :show, :id => variant.to_param + api_get :show, id: variant.to_param expect(json_response).to have_attributes(show_attributes) expect(json_response["stock_items"]).to be_present option_values = json_response["option_values"] @@ -116,9 +116,9 @@ module Spree end it "can see a single variant with images" do - variant.images.create!(:attachment => image("thinking-cat.jpg")) + variant.images.create!(attachment: image("thinking-cat.jpg")) - api_get :show, :id => variant.to_param + api_get :show, id: variant.to_param expect(json_response).to have_attributes(show_attributes + [:images]) option_values = json_response["option_values"] @@ -135,24 +135,24 @@ module Spree end it "cannot create a new variant if not an admin" do - api_post :create, :variant => { :sku => "12345" } + api_post :create, variant: { sku: "12345" } assert_unauthorized! end it "cannot update a variant" do - api_put :update, :id => variant.to_param, :variant => { :sku => "12345" } + api_put :update, id: variant.to_param, variant: { sku: "12345" } assert_not_found! end it "cannot delete a variant" do - api_delete :destroy, :id => variant.to_param + api_delete :destroy, id: variant.to_param assert_not_found! expect { variant.reload }.not_to raise_error end context "as an admin" do sign_in_as_admin! - let(:resource_scoping) { { :product_id => variant.product.to_param } } + let(:resource_scoping) { { product_id: variant.product.to_param } } # Test for #2141 context "deleted variants" do @@ -161,7 +161,7 @@ module Spree end it "are visible by admin" do - api_get :index, :show_deleted => 1 + api_get :index, show_deleted: 1 expect(json_response["variants"].count).to eq(1) end end @@ -186,12 +186,12 @@ module Spree end it "can update a variant" do - api_put :update, :id => variant.to_param, :variant => { :sku => "12345" } + api_put :update, id: variant.to_param, variant: { sku: "12345" } expect(response.status).to eq(200) end it "can delete a variant" do - api_delete :destroy, :id => variant.to_param + api_delete :destroy, id: variant.to_param expect(response.status).to eq(204) expect { Spree::Variant.find(variant.id) }.to raise_error(ActiveRecord::RecordNotFound) end diff --git a/api/spec/controllers/spree/api/v1/zones_controller_spec.rb b/api/spec/controllers/spree/api/v1/zones_controller_spec.rb index e31ae2a3a2d..fb8805a7e2c 100644 --- a/api/spec/controllers/spree/api/v1/zones_controller_spec.rb +++ b/api/spec/controllers/spree/api/v1/zones_controller_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' module Spree - describe Api::V1::ZonesController, :type => :controller do + describe Api::V1::ZonesController, type: :controller do render_views let!(:attributes) { [:id, :name, :zone_members] } before do stub_authentication! - @zone = create(:zone, :name => 'Europe') + @zone = create(:zone, name: 'Europe') end it "gets list of zones" do @@ -18,21 +18,21 @@ module Spree it 'can control the page size through a parameter' do create(:zone) - api_get :index, :per_page => 1 + api_get :index, per_page: 1 expect(json_response['count']).to eq(1) expect(json_response['current_page']).to eq(1) expect(json_response['pages']).to eq(2) end it 'can query the results through a paramter' do - expected_result = create(:zone, :name => 'South America') - api_get :index, :q => { :name_cont => 'south' } + expected_result = create(:zone, name: 'South America') + api_get :index, q: { name_cont: 'south' } expect(json_response['count']).to eq(1) expect(json_response['zones'].first['name']).to eq expected_result.name end it "gets a zone" do - api_get :show, :id => @zone.id + api_get :show, id: @zone.id expect(json_response).to have_attributes(attributes) expect(json_response['name']).to eq @zone.name expect(json_response['zone_members'].size).to eq @zone.zone_members.count @@ -45,9 +45,9 @@ module Spree it "can create a new zone" do params = { - :zone => { - :name => "North Pole", - :zone_members => [ + zone: { + name: "North Pole", + zone_members: [ { zoneable_type: "Spree::Country", zoneable_id: country.id @@ -63,10 +63,10 @@ module Spree end it "updates a zone" do - params = { :id => @zone.id, - :zone => { - :name => "North Pole", - :zone_members => [ + params = { id: @zone.id, + zone: { + name: "North Pole", + zone_members: [ { zoneable_type: "Spree::Country", zoneable_id: country.id @@ -82,7 +82,7 @@ module Spree end it "can delete a zone" do - api_delete :destroy, :id => @zone.id + api_delete :destroy, id: @zone.id expect(response.status).to eq(204) expect { @zone.reload }.to raise_error(ActiveRecord::RecordNotFound) end diff --git a/api/spec/models/spree/legacy_user_spec.rb b/api/spec/models/spree/legacy_user_spec.rb index 9084ca7ba78..22daa8dd7fa 100644 --- a/api/spec/models/spree/legacy_user_spec.rb +++ b/api/spec/models/spree/legacy_user_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe LegacyUser, :type => :model do + describe LegacyUser, type: :model do let(:user) { LegacyUser.new } it "can generate an API key" do diff --git a/api/spec/requests/rabl_cache_spec.rb b/api/spec/requests/rabl_cache_spec.rb index d0904f712b0..3ecdc223b80 100644 --- a/api/spec/requests/rabl_cache_spec.rb +++ b/api/spec/requests/rabl_cache_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Rabl Cache", :type => :request, :caching => true do +describe "Rabl Cache", type: :request, caching: true do let!(:user) { create(:admin_user) } before do @@ -10,7 +10,7 @@ end it "doesn't create a cache key collision for models with different rabl templates" do - get "/api/v1/variants", :token => user.spree_api_key + get "/api/v1/variants", token: user.spree_api_key expect(response.status).to eq(200) # Make sure we get a non master variant @@ -21,7 +21,7 @@ expect(variant_a['is_master']).to be false expect(variant_a['stock_items']).not_to be_nil - get "/api/v1/products/#{Spree::Product.first.id}", :token => user.spree_api_key + get "/api/v1/products/#{Spree::Product.first.id}", token: user.spree_api_key expect(response.status).to eq(200) variant_b = JSON.parse(response.body)['variants'].last expect(variant_b['is_master']).to be false diff --git a/api/spec/shared_examples/protect_product_actions.rb b/api/spec/shared_examples/protect_product_actions.rb index 0dc3c2607d8..73f6c830fcb 100644 --- a/api/spec/shared_examples/protect_product_actions.rb +++ b/api/spec/shared_examples/protect_product_actions.rb @@ -1,16 +1,16 @@ shared_examples "modifying product actions are restricted" do it "cannot create a new product if not an admin" do - api_post :create, :product => { :name => "Brand new product!" } + api_post :create, product: { name: "Brand new product!" } assert_unauthorized! end it "cannot update a product" do - api_put :update, :id => product.to_param, :product => { :name => "I hacked your store!" } + api_put :update, id: product.to_param, product: { name: "I hacked your store!" } assert_unauthorized! end it "cannot delete a product" do - api_delete :destroy, :id => product.to_param + api_delete :destroy, id: product.to_param assert_unauthorized! end end diff --git a/api/spec/spec_helper.rb b/api/spec/spec_helper.rb index f3e2f6fe192..627e831585d 100644 --- a/api/spec/spec_helper.rb +++ b/api/spec/spec_helper.rb @@ -45,9 +45,9 @@ config.use_transactional_fixtures = true config.include FactoryGirl::Syntax::Methods - config.include Spree::Api::TestingSupport::Helpers, :type => :controller - config.extend Spree::Api::TestingSupport::Setup, :type => :controller - config.include Spree::TestingSupport::Preferences, :type => :controller + config.include Spree::Api::TestingSupport::Helpers, type: :controller + config.extend Spree::Api::TestingSupport::Setup, type: :controller + config.include Spree::TestingSupport::Preferences, type: :controller config.before do Spree::Api::Config[:requires_authentication] = true diff --git a/api/spec/support/controller_hacks.rb b/api/spec/support/controller_hacks.rb index acd05ce5bc2..a8b97a39ab6 100644 --- a/api/spec/support/controller_hacks.rb +++ b/api/spec/support/controller_hacks.rb @@ -24,7 +24,7 @@ def api_delete(action, params={}, session=nil, flash=nil) def api_process(action, params={}, session=nil, flash=nil, method="get") scoping = respond_to?(:resource_scoping) ? resource_scoping : {} - process(action, method, params.merge(scoping).reverse_merge!(:format => :json), session, flash) + process(action, method, params.merge(scoping).reverse_merge!(format: :json), session, flash) end end diff --git a/backend/app/controllers/spree/admin/product_properties_controller.rb b/backend/app/controllers/spree/admin/product_properties_controller.rb index 4f5480f0c1e..789c7c0bbe2 100644 --- a/backend/app/controllers/spree/admin/product_properties_controller.rb +++ b/backend/app/controllers/spree/admin/product_properties_controller.rb @@ -1,7 +1,7 @@ module Spree module Admin class ProductPropertiesController < ResourceController - belongs_to 'spree/product', :find_by => :slug + belongs_to 'spree/product', find_by: :slug before_action :find_properties before_action :setup_property, only: :index diff --git a/backend/app/controllers/spree/admin/promotion_actions_controller.rb b/backend/app/controllers/spree/admin/promotion_actions_controller.rb index ec52c0a2e72..a4007be4f03 100644 --- a/backend/app/controllers/spree/admin/promotion_actions_controller.rb +++ b/backend/app/controllers/spree/admin/promotion_actions_controller.rb @@ -7,22 +7,22 @@ def create @promotion_action = params[:action_type].constantize.new(params[:promotion_action]) @promotion_action.promotion = @promotion if @promotion_action.save - flash[:success] = Spree.t(:successfully_created, :resource => Spree.t(:promotion_action)) + flash[:success] = Spree.t(:successfully_created, resource: Spree.t(:promotion_action)) end respond_to do |format| format.html { redirect_to spree.edit_admin_promotion_path(@promotion)} - format.js { render :layout => false } + format.js { render layout: false } end end def destroy @promotion_action = @promotion.promotion_actions.find(params[:id]) if @promotion_action.destroy - flash[:success] = Spree.t(:successfully_removed, :resource => Spree.t(:promotion_action)) + flash[:success] = Spree.t(:successfully_removed, resource: Spree.t(:promotion_action)) end respond_to do |format| format.html { redirect_to spree.edit_admin_promotion_path(@promotion)} - format.js { render :layout => false } + format.js { render layout: false } end end @@ -38,7 +38,7 @@ def validate_promotion_action_type flash[:error] = Spree.t(:invalid_promotion_action) respond_to do |format| format.html { redirect_to spree.edit_admin_promotion_path(@promotion)} - format.js { render :layout => false } + format.js { render layout: false } end end end diff --git a/backend/app/controllers/spree/admin/promotion_rules_controller.rb b/backend/app/controllers/spree/admin/promotion_rules_controller.rb index 2a06ad4363a..ac2b9459574 100644 --- a/backend/app/controllers/spree/admin/promotion_rules_controller.rb +++ b/backend/app/controllers/spree/admin/promotion_rules_controller.rb @@ -12,22 +12,22 @@ def create @promotion_rule = promotion_rule_type.constantize.new(params[:promotion_rule]) @promotion_rule.promotion = @promotion if @promotion_rule.save - flash[:success] = Spree.t(:successfully_created, :resource => Spree.t(:promotion_rule)) + flash[:success] = Spree.t(:successfully_created, resource: Spree.t(:promotion_rule)) end respond_to do |format| format.html { redirect_to spree.edit_admin_promotion_path(@promotion)} - format.js { render :layout => false } + format.js { render layout: false } end end def destroy @promotion_rule = @promotion.promotion_rules.find(params[:id]) if @promotion_rule.destroy - flash[:success] = Spree.t(:successfully_removed, :resource => Spree.t(:promotion_rule)) + flash[:success] = Spree.t(:successfully_removed, resource: Spree.t(:promotion_rule)) end respond_to do |format| format.html { redirect_to spree.edit_admin_promotion_path(@promotion)} - format.js { render :layout => false } + format.js { render layout: false } end end @@ -43,7 +43,7 @@ def validate_promotion_rule_type flash[:error] = Spree.t(:invalid_promotion_rule) respond_to do |format| format.html { redirect_to spree.edit_admin_promotion_path(@promotion)} - format.js { render :layout => false } + format.js { render layout: false } end end end diff --git a/backend/app/controllers/spree/admin/prototypes_controller.rb b/backend/app/controllers/spree/admin/prototypes_controller.rb index fb657df760c..974ea8778eb 100644 --- a/backend/app/controllers/spree/admin/prototypes_controller.rb +++ b/backend/app/controllers/spree/admin/prototypes_controller.rb @@ -3,7 +3,7 @@ module Admin class PrototypesController < ResourceController def show if request.xhr? - render :layout => false + render layout: false else redirect_to admin_prototypes_path end @@ -12,7 +12,7 @@ def show def available @prototypes = Prototype.order('name asc') respond_with(@prototypes) do |format| - format.html { render :layout => !request.xhr? } + format.html { render layout: !request.xhr? } format.js end end diff --git a/backend/app/controllers/spree/admin/reports_controller.rb b/backend/app/controllers/spree/admin/reports_controller.rb index 1fc312f5c1c..49b39aad4b9 100644 --- a/backend/app/controllers/spree/admin/reports_controller.rb +++ b/backend/app/controllers/spree/admin/reports_controller.rb @@ -45,7 +45,7 @@ def sales_total @totals = {} @orders.each do |order| - @totals[order.currency] = { :item_total => ::Money.new(0, order.currency), :adjustment_total => ::Money.new(0, order.currency), :sales_total => ::Money.new(0, order.currency) } unless @totals[order.currency] + @totals[order.currency] = { item_total: ::Money.new(0, order.currency), adjustment_total: ::Money.new(0, order.currency), sales_total: ::Money.new(0, order.currency) } unless @totals[order.currency] @totals[order.currency][:item_total] += order.display_item_total.money @totals[order.currency][:adjustment_total] += order.display_adjustment_total.money @totals[order.currency][:sales_total] += order.display_total.money diff --git a/backend/app/controllers/spree/admin/resource_controller.rb b/backend/app/controllers/spree/admin/resource_controller.rb index 9df9c747748..195750d00dc 100644 --- a/backend/app/controllers/spree/admin/resource_controller.rb +++ b/backend/app/controllers/spree/admin/resource_controller.rb @@ -3,25 +3,25 @@ class Spree::Admin::ResourceController < Spree::Admin::BaseController helper_method :new_object_url, :edit_object_url, :object_url, :collection_url before_action :load_resource, except: :update_positions - rescue_from ActiveRecord::RecordNotFound, :with => :resource_not_found + rescue_from ActiveRecord::RecordNotFound, with: :resource_not_found respond_to :html def new invoke_callbacks(:new_action, :before) respond_with(@object) do |format| - format.html { render :layout => !request.xhr? } + format.html { render layout: !request.xhr? } if request.xhr? - format.js { render :layout => false } + format.js { render layout: false } end end end def edit respond_with(@object) do |format| - format.html { render :layout => !request.xhr? } + format.html { render layout: !request.xhr? } if request.xhr? - format.js { render :layout => false } + format.js { render layout: false } end end end @@ -54,7 +54,7 @@ def create flash[:success] = flash_message_for(@object, :successfully_created) respond_with(@object) do |format| format.html { redirect_to location_after_save } - format.js { render :layout => false } + format.js { render layout: false } end else invoke_callbacks(:create, :fails) diff --git a/backend/app/controllers/spree/admin/return_authorizations_controller.rb b/backend/app/controllers/spree/admin/return_authorizations_controller.rb index 09c0bd4fc96..dd367b8d8be 100644 --- a/backend/app/controllers/spree/admin/return_authorizations_controller.rb +++ b/backend/app/controllers/spree/admin/return_authorizations_controller.rb @@ -1,7 +1,7 @@ module Spree module Admin class ReturnAuthorizationsController < ResourceController - belongs_to 'spree/order', :find_by => :number + belongs_to 'spree/order', find_by: :number before_action :load_form_data, only: [:new, :edit] create.fails :load_form_data diff --git a/backend/app/controllers/spree/admin/shipping_methods_controller.rb b/backend/app/controllers/spree/admin/shipping_methods_controller.rb index 7e07b6233dc..3c4fbf1e1f2 100644 --- a/backend/app/controllers/spree/admin/shipping_methods_controller.rb +++ b/backend/app/controllers/spree/admin/shipping_methods_controller.rb @@ -20,14 +20,14 @@ def destroy def set_shipping_category return true if params["shipping_method"][:shipping_categories] == "" - @shipping_method.shipping_categories = Spree::ShippingCategory.where(:id => params["shipping_method"][:shipping_categories]) + @shipping_method.shipping_categories = Spree::ShippingCategory.where(id: params["shipping_method"][:shipping_categories]) @shipping_method.save params[:shipping_method].delete(:shipping_categories) end def set_zones return true if params["shipping_method"][:zones] == "" - @shipping_method.zones = Spree::Zone.where(:id => params["shipping_method"][:zones]) + @shipping_method.zones = Spree::Zone.where(id: params["shipping_method"][:zones]) @shipping_method.save params[:shipping_method].delete(:zones) end diff --git a/backend/app/controllers/spree/admin/states_controller.rb b/backend/app/controllers/spree/admin/states_controller.rb index cf82bf52718..446e1b216c6 100644 --- a/backend/app/controllers/spree/admin/states_controller.rb +++ b/backend/app/controllers/spree/admin/states_controller.rb @@ -7,7 +7,7 @@ class StatesController < ResourceController def index respond_with(@collection) do |format| format.html - format.js { render :partial => 'state_list' } + format.js { render partial: 'state_list' } end end diff --git a/backend/app/controllers/spree/admin/stock_movements_controller.rb b/backend/app/controllers/spree/admin/stock_movements_controller.rb index 60f5f4ba0fc..e6ed3176c60 100644 --- a/backend/app/controllers/spree/admin/stock_movements_controller.rb +++ b/backend/app/controllers/spree/admin/stock_movements_controller.rb @@ -6,7 +6,7 @@ class StockMovementsController < Spree::Admin::BaseController def index @stock_movements = stock_location.stock_movements.recent. - includes(:stock_item => { :variant => :product }). + includes(stock_item: { variant: :product }). page(params[:page]) end diff --git a/backend/app/controllers/spree/admin/users_controller.rb b/backend/app/controllers/spree/admin/users_controller.rb index c521067de38..860c5b29d05 100644 --- a/backend/app/controllers/spree/admin/users_controller.rb +++ b/backend/app/controllers/spree/admin/users_controller.rb @@ -1,7 +1,7 @@ module Spree module Admin class UsersController < ResourceController - rescue_from Spree::Core::DestroyWithOrdersError, :with => :user_destroy_with_orders_error + rescue_from Spree::Core::DestroyWithOrdersError, with: :user_destroy_with_orders_error after_action :sign_in_if_change_own_password, only: :update @@ -11,7 +11,7 @@ class UsersController < ResourceController def index respond_with(@collection) do |format| format.html - format.json { render :json => json_data } + format.json { render json: json_data } end end @@ -97,7 +97,7 @@ def collection OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = spree_users.bill_address_id) OR (spree_addresses.firstname #{LIKE} :search AND spree_addresses.id = spree_users.ship_address_id) OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = spree_users.ship_address_id)", - { :search => "#{params[:q].strip}%" }) + { search: "#{params[:q].strip}%" }) .limit(params[:limit] || 100) else @search = @collection.ransack(params[:q]) diff --git a/backend/app/controllers/spree/admin/variants_controller.rb b/backend/app/controllers/spree/admin/variants_controller.rb index 87df1069984..f72e0a7fdb7 100644 --- a/backend/app/controllers/spree/admin/variants_controller.rb +++ b/backend/app/controllers/spree/admin/variants_controller.rb @@ -1,7 +1,7 @@ module Spree module Admin class VariantsController < ResourceController - belongs_to 'spree/product', :find_by => :slug + belongs_to 'spree/product', find_by: :slug new_action.before :new_before before_action :load_data, only: [:new, :create, :edit, :update] diff --git a/backend/app/views/kaminari/_first_page.html.erb b/backend/app/views/kaminari/_first_page.html.erb index 6bd9cdae5aa..7c6f7c1282b 100644 --- a/backend/app/views/kaminari/_first_page.html.erb +++ b/backend/app/views/kaminari/_first_page.html.erb @@ -7,5 +7,5 @@ remote: data-remote -%>
  • - <%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, :remote => remote %> + <%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, remote: remote %>
  • diff --git a/backend/app/views/kaminari/_last_page.html.erb b/backend/app/views/kaminari/_last_page.html.erb index 7188423d69b..d8fc4195fd0 100644 --- a/backend/app/views/kaminari/_last_page.html.erb +++ b/backend/app/views/kaminari/_last_page.html.erb @@ -7,5 +7,5 @@ remote: data-remote -%>
  • - <%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote %> + <%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, remote: remote %>
  • diff --git a/backend/app/views/kaminari/_next_page.html.erb b/backend/app/views/kaminari/_next_page.html.erb index 614e2d82991..cf0e2301155 100644 --- a/backend/app/views/kaminari/_next_page.html.erb +++ b/backend/app/views/kaminari/_next_page.html.erb @@ -10,6 +10,6 @@ <% if current_page.last? %> » <% else %> - <%= link_to_unless current_page.last?, "»".html_safe, url, :rel => 'next', :remote => remote %> + <%= link_to_unless current_page.last?, "»".html_safe, url, rel: 'next', remote: remote %> <% end %> diff --git a/backend/app/views/kaminari/_page.html.erb b/backend/app/views/kaminari/_page.html.erb index ae6ba1c347d..842469ba93f 100644 --- a/backend/app/views/kaminari/_page.html.erb +++ b/backend/app/views/kaminari/_page.html.erb @@ -8,5 +8,5 @@ remote: data-remote -%>
  • - <%= link_to page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> + <%= link_to page, url, {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
  • diff --git a/backend/app/views/kaminari/_prev_page.html.erb b/backend/app/views/kaminari/_prev_page.html.erb index a086aeb5e0d..1e8c0f33eb9 100644 --- a/backend/app/views/kaminari/_prev_page.html.erb +++ b/backend/app/views/kaminari/_prev_page.html.erb @@ -10,6 +10,6 @@ <% if current_page.first? %> « <% else %> - <%= link_to_unless current_page.first?, "«".html_safe, url, :rel => 'prev', :remote => remote %> + <%= link_to_unless current_page.first?, "«".html_safe, url, rel: 'prev', remote: remote %> <% end %> diff --git a/backend/app/views/spree/admin/adjustments/_form.html.erb b/backend/app/views/spree/admin/adjustments/_form.html.erb index 1a8dc0057bf..51347474be5 100644 --- a/backend/app/views/spree/admin/adjustments/_form.html.erb +++ b/backend/app/views/spree/admin/adjustments/_form.html.erb @@ -1,12 +1,12 @@
    <%= f.field_container :amount, class: ['form-group'] do %> - <%= f.label :amount, raw(Spree.t(:amount) + content_tag(:span, " *", :class => "required")) %> - <%= text_field :adjustment, :amount, :class => 'form-control' %> + <%= f.label :amount, raw(Spree.t(:amount) + content_tag(:span, " *", class: "required")) %> + <%= text_field :adjustment, :amount, class: 'form-control' %> <%= f.error_message_on :amount %> <% end %> <%= f.field_container :label, class: ['form-group'] do %> - <%= f.label :label, raw(Spree.t(:description) + content_tag(:span, " *", :class => "required")) %> - <%= text_field :adjustment, :label, :class => 'form-control' %> + <%= f.label :label, raw(Spree.t(:description) + content_tag(:span, " *", class: "required")) %> + <%= text_field :adjustment, :label, class: 'form-control' %> <%= f.error_message_on :label %> <% end %>
    diff --git a/backend/app/views/spree/admin/countries/_form.html.erb b/backend/app/views/spree/admin/countries/_form.html.erb index 7d51a4ec82e..ee9f5cd2cdf 100644 --- a/backend/app/views/spree/admin/countries/_form.html.erb +++ b/backend/app/views/spree/admin/countries/_form.html.erb @@ -1,13 +1,13 @@
    <%= f.field_container :name, class: ['form-group'], 'data-hook' => 'name' do %> <%= f.label :name, Spree.t(:name) %> - <%= f.text_field :name, :class => 'form-control' %> + <%= f.text_field :name, class: 'form-control' %> <%= f.error_message_on :name %> <% end %> <%= f.field_container :iso_name, class: ['form-group'], 'data-hook' => 'iso_name' do %> <%= f.label :iso_name, Spree.t(:iso_name) %> - <%= f.text_field :iso_name, :class => 'form-control' %> + <%= f.text_field :iso_name, class: 'form-control' %> <%= f.error_message_on :iso_name %> <% end %> diff --git a/backend/app/views/spree/admin/countries/edit.html.erb b/backend/app/views/spree/admin/countries/edit.html.erb index a7072cd2fc3..e730a614e28 100644 --- a/backend/app/views/spree/admin/countries/edit.html.erb +++ b/backend/app/views/spree/admin/countries/edit.html.erb @@ -3,12 +3,12 @@ <%= @country.name %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @country } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @country } %> <%= form_for [:admin, @country] do |f| %>
    - <%= render :partial => 'form', :locals => { :f => f } %> + <%= render partial: 'form', locals: { f: f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/countries/index.html.erb b/backend/app/views/spree/admin/countries/index.html.erb index 0f9e9db8824..65b0d9d3bb0 100644 --- a/backend/app/views/spree/admin/countries/index.html.erb +++ b/backend/app/views/spree/admin/countries/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_country), new_object_url, { :class => "btn-success", :icon => 'add', :id => 'admin_new_country' } %> + <%= button_link_to Spree.t(:new_country), new_object_url, { class: "btn-success", icon: 'add', id: 'admin_new_country' } %> <% end if can? :create, Spree::Country %> @@ -22,8 +22,8 @@ <% end %> diff --git a/backend/app/views/spree/admin/countries/new.html.erb b/backend/app/views/spree/admin/countries/new.html.erb index b1806d7f3ad..986c1db11ed 100644 --- a/backend/app/views/spree/admin/countries/new.html.erb +++ b/backend/app/views/spree/admin/countries/new.html.erb @@ -3,11 +3,11 @@ <%= Spree.t(:new_country) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @country } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @country } %> <%= form_for [:admin, @country] do |f| %>
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/images/_form.html.erb b/backend/app/views/spree/admin/images/_form.html.erb index 48cd2ea2ad1..e9702e9f490 100644 --- a/backend/app/views/spree/admin/images/_form.html.erb +++ b/backend/app/views/spree/admin/images/_form.html.erb @@ -6,13 +6,13 @@
    <%= f.label :viewable_id, Spree::Variant.model_name.human %> - <%= f.select :viewable_id, @variants, {}, {:class => 'select2'} %> + <%= f.select :viewable_id, @variants, {}, {class: 'select2'} %>
    <%= f.label :alt, Spree.t(:alt_text) %> - <%= f.text_area :alt, :rows => 4, :class => 'form-control' %> + <%= f.text_area :alt, rows: 4, class: 'form-control' %>
    diff --git a/backend/app/views/spree/admin/option_types/_form.html.erb b/backend/app/views/spree/admin/option_types/_form.html.erb index bbce57a712e..16f87baec1f 100644 --- a/backend/app/views/spree/admin/option_types/_form.html.erb +++ b/backend/app/views/spree/admin/option_types/_form.html.erb @@ -2,7 +2,7 @@
    <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name, Spree.t(:name) %> * - <%= f.text_field :name, :class => "form-control" %> + <%= f.text_field :name, class: "form-control" %> <%= f.error_message_on :name %> <% end %>
    @@ -10,7 +10,7 @@
    <%= f.field_container :presentation, class: ['form-group'] do %> <%= f.label :presentation, Spree.t(:presentation) %> * - <%= f.text_field :presentation, :class => "form-control" %> + <%= f.text_field :presentation, class: "form-control" %> <%= f.error_message_on :presentation %> <% end %>
    diff --git a/backend/app/views/spree/admin/option_types/edit.html.erb b/backend/app/views/spree/admin/option_types/edit.html.erb index 8523a788b5b..0cfb20c9b6b 100644 --- a/backend/app/views/spree/admin/option_types/edit.html.erb +++ b/backend/app/views/spree/admin/option_types/edit.html.erb @@ -5,11 +5,11 @@ <% content_for :page_actions do %> - <%= button_link_to Spree.t(:add_option_value), "javascript:;", { :icon => 'add', :'data-target' => "tbody#option_values", :class => 'btn-success spree_add_fields' } %> + <%= button_link_to Spree.t(:add_option_value), "javascript:;", { icon: 'add', :'data-target' => "tbody#option_values", class: 'btn-success spree_add_fields' } %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @option_type } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @option_type } %> <%= form_for [:admin, @option_type] do |f| %>
    @@ -19,7 +19,7 @@
    - <%= render :partial => 'form', :locals => { :f => f } %> + <%= render partial: 'form', locals: { f: f } %>
    <%= country.iso_name %> <%= country.states_required? ? Spree.t(:say_yes) : Spree.t(:say_no) %> - <%= link_to_edit(country, :no_text => true) if can? :edit, country %> - <%= link_to_delete(country, :no_text => true) if can? :delete, country %> + <%= link_to_edit(country, no_text: true) if can? :edit, country %> + <%= link_to_delete(country, no_text: true) if can? :delete, country %>
    @@ -37,13 +37,13 @@ <% else %> <%= f.fields_for :option_values do |option_value_form| %> - <%= render :partial => 'option_value_fields', :locals => { :f => option_value_form } %> + <%= render partial: 'option_value_fields', locals: { f: option_value_form } %> <% end %> <% end %>
    <% end %> diff --git a/backend/app/views/spree/admin/option_types/new.html.erb b/backend/app/views/spree/admin/option_types/new.html.erb index 1c7cf28f101..993286541aa 100644 --- a/backend/app/views/spree/admin/option_types/new.html.erb +++ b/backend/app/views/spree/admin/option_types/new.html.erb @@ -3,11 +3,11 @@ <%= Spree.t(:new_option_type) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @option_type } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @option_type } %> <%= form_for [:admin, @option_type] do |f| %>
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/orders/_shipment.html.erb b/backend/app/views/spree/admin/orders/_shipment.html.erb index 8e04ae14352..8eacce88b1f 100644 --- a/backend/app/views/spree/admin/orders/_shipment.html.erb +++ b/backend/app/views/spree/admin/orders/_shipment.html.erb @@ -76,8 +76,8 @@ <% if can? :update, shipment %> - <%= link_to_with_icon 'cancel', Spree.t('actions.cancel'), "#", :class => 'cancel-tracking btn btn-primary btn-sm', :data => {:action => 'cancel'}, :title => Spree.t('actions.cancel'), :no_text => true %> - <%= link_to_with_icon 'save', Spree.t('actions.save'), "#", :class => 'save-tracking btn btn-success btn-sm', :data => {'shipment-number' => shipment.number, :action => 'save'}, :title => Spree.t('actions.save'), :no_text => true %> + <%= link_to_with_icon 'cancel', Spree.t('actions.cancel'), "#", class: 'cancel-tracking btn btn-primary btn-sm', data: {action: 'cancel'}, title: Spree.t('actions.cancel'), no_text: true %> + <%= link_to_with_icon 'save', Spree.t('actions.save'), "#", class: 'save-tracking btn btn-success btn-sm', data: {'shipment-number' => shipment.number, action: 'save'}, title: Spree.t('actions.save'), no_text: true %> <% end %> diff --git a/backend/app/views/spree/admin/orders/index.html.erb b/backend/app/views/spree/admin/orders/index.html.erb index d12621ee145..183dd614a44 100644 --- a/backend/app/views/spree/admin/orders/index.html.erb +++ b/backend/app/views/spree/admin/orders/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_order), new_admin_order_url, :class => "btn-success", :icon => 'add', :id => 'admin_new_order' %> + <%= button_link_to Spree.t(:new_order), new_admin_order_url, class: "btn-success", icon: 'add', id: 'admin_new_order' %> <% end if can? :create, Spree::Order %> <% content_for :table_filter do %> @@ -17,7 +17,7 @@
    - <%= f.text_field :created_at_gt, :class => 'datepicker datepicker-from form-control', :value => params[:q][:created_at_gt], :placeholder => Spree.t(:start) %> + <%= f.text_field :created_at_gt, class: 'datepicker datepicker-from form-control', value: params[:q][:created_at_gt], placeholder: Spree.t(:start) %> @@ -26,7 +26,7 @@
    - <%= f.text_field :created_at_lt, :class => 'datepicker datepicker-to form-control', :value => params[:q][:created_at_lt], :placeholder => Spree.t(:stop) %> + <%= f.text_field :created_at_lt, class: 'datepicker datepicker-to form-control', value: params[:q][:created_at_lt], placeholder: Spree.t(:stop) %> @@ -38,7 +38,7 @@
    - <%= label_tag :q_number_cont, Spree.t(:order_number, :number => '') %> + <%= label_tag :q_number_cont, Spree.t(:order_number, number: '') %> <%= f.text_field :number_cont, class: 'form-control js-quick-search-target' %>
    @@ -50,21 +50,21 @@
    <%= label_tag :q_state_eq, Spree.t(:status) %> - <%= f.select :state_eq, Spree::Order.state_machines[:state].states.map {|s| [Spree.t("order_state.#{s.name}"), s.value]}, {:include_blank => true}, :class => 'select2 js-filterable' %> + <%= f.select :state_eq, Spree::Order.state_machines[:state].states.map {|s| [Spree.t("order_state.#{s.name}"), s.value]}, {include_blank: true}, class: 'select2 js-filterable' %>
    <%= label_tag :q_payment_state_eq, Spree.t(:payment_state) %> - <%= f.select :payment_state_eq, Spree::Order::PAYMENT_STATES.map {|s| [Spree.t("payment_states.#{s}"), s]}, {:include_blank => true}, :class => 'select2 js-filterable' %> + <%= f.select :payment_state_eq, Spree::Order::PAYMENT_STATES.map {|s| [Spree.t("payment_states.#{s}"), s]}, {include_blank: true}, class: 'select2 js-filterable' %>
    <%= label_tag :q_shipment_state_eq, Spree.t(:shipment_state) %> - <%= f.select :shipment_state_eq, Spree::Order::SHIPMENT_STATES.map {|s| [Spree.t("shipment_states.#{s}"), s]}, {:include_blank => true}, :class => 'select2 js-filterable' %> + <%= f.select :shipment_state_eq, Spree::Order::SHIPMENT_STATES.map {|s| [Spree.t("shipment_states.#{s}"), s]}, {include_blank: true}, class: 'select2 js-filterable' %>
    @@ -107,7 +107,7 @@
    <%= label_tag :q_promotions_id_in, Spree.t(:promotion) %> - <%= f.select :promotions_id_in, Spree::Promotion.applied.pluck(:name, :id), {:include_blank => true}, :class => 'select2' %> + <%= f.select :promotions_id_in, Spree::Promotion.applied.pluck(:name, :id), {include_blank: true}, class: 'select2' %>
    @@ -117,14 +117,14 @@
    <%= label_tag 'q_completed_at_not_null' do %> - <%= f.check_box :completed_at_not_null, {:checked => @show_only_completed}, '1', '0' %> + <%= f.check_box :completed_at_not_null, {checked: @show_only_completed}, '1', '0' %> <%= Spree.t(:show_only_complete_orders) %> <% end %>
    <%= label_tag 'q_considered_risky_eq' do %> - <%= f.check_box :considered_risky_eq, {:checked => (params[:q][:considered_risky_eq] == '1')}, '1', '' %> + <%= f.check_box :considered_risky_eq, {checked: (params[:q][:considered_risky_eq] == '1')}, '1', '' %> <%= Spree.t(:show_only_considered_risky) %> <% end %>
    @@ -152,19 +152,19 @@ <% if @show_only_completed %> - <%= sort_link @search, :completed_at, I18n.t(:completed_at, :scope => 'activerecord.attributes.spree/order') %> + <%= sort_link @search, :completed_at, I18n.t(:completed_at, scope: 'activerecord.attributes.spree/order') %> <% else %> - <%= sort_link @search, :created_at, I18n.t(:created_at, :scope => 'activerecord.attributes.spree/order') %> + <%= sort_link @search, :created_at, I18n.t(:created_at, scope: 'activerecord.attributes.spree/order') %> <% end %> - <%= sort_link @search, :number, I18n.t(:number, :scope => 'activerecord.attributes.spree/order') %> - <%= sort_link @search, :considered_risky, I18n.t(:considered_risky, :scope => 'activerecord.attributes.spree/order') %> - <%= sort_link @search, :state, I18n.t(:state, :scope => 'activerecord.attributes.spree/order') %> - <%= sort_link @search, :payment_state, I18n.t(:payment_state, :scope => 'activerecord.attributes.spree/order') %> + <%= sort_link @search, :number, I18n.t(:number, scope: 'activerecord.attributes.spree/order') %> + <%= sort_link @search, :considered_risky, I18n.t(:considered_risky, scope: 'activerecord.attributes.spree/order') %> + <%= sort_link @search, :state, I18n.t(:state, scope: 'activerecord.attributes.spree/order') %> + <%= sort_link @search, :payment_state, I18n.t(:payment_state, scope: 'activerecord.attributes.spree/order') %> <% if Spree::Order.checkout_step_names.include?(:delivery) %> - <%= sort_link @search, :shipment_state, I18n.t(:shipment_state, :scope => 'activerecord.attributes.spree/order') %> + <%= sort_link @search, :shipment_state, I18n.t(:shipment_state, scope: 'activerecord.attributes.spree/order') %> <% end %> - <%= sort_link @search, :email, I18n.t(:email, :scope => 'activerecord.attributes.spree/order') %> - <%= sort_link @search, :total, I18n.t(:total, :scope => 'activerecord.attributes.spree/order') %> + <%= sort_link @search, :email, I18n.t(:email, scope: 'activerecord.attributes.spree/order') %> + <%= sort_link @search, :total, I18n.t(:total, scope: 'activerecord.attributes.spree/order') %> @@ -210,7 +210,7 @@ <%= order.display_total.to_html %> - <%= link_to_edit_url edit_admin_order_path(order), :title => "admin_edit_#{dom_id(order)}", :no_text => true %> + <%= link_to_edit_url edit_admin_order_path(order), title: "admin_edit_#{dom_id(order)}", no_text: true %> <% end %> diff --git a/backend/app/views/spree/admin/payment_methods/_form.html.erb b/backend/app/views/spree/admin/payment_methods/_form.html.erb index 8d6ef1472c1..338617804ef 100644 --- a/backend/app/views/spree/admin/payment_methods/_form.html.erb +++ b/backend/app/views/spree/admin/payment_methods/_form.html.erb @@ -5,7 +5,7 @@
    <%= f.label :type, Spree.t(:provider) %> - <%= collection_select(:payment_method, :type, @providers, :to_s, :name, {}, {:id => 'gtwy-type', :class => 'select2'}) %> + <%= collection_select(:payment_method, :type, @providers, :to_s, :name, {}, {id: 'gtwy-type', class: 'select2'}) %> <% unless @object.new_record? %> <%= preference_fields(@object, f) %> @@ -17,11 +17,11 @@
    <%= label_tag :payment_method_display_on, Spree.t(:display) %> - <%= select(:payment_method, :display_on, Spree::PaymentMethod::DISPLAY.collect { |display| [Spree.t(display), display.to_s] }, {}, {:class => 'select2'}) %> + <%= select(:payment_method, :display_on, Spree::PaymentMethod::DISPLAY.collect { |display| [Spree.t(display), display.to_s] }, {}, {class: 'select2'}) %>
    <%= label_tag :payment_method_auto_capture, Spree.t(:auto_capture) %> - <%= select(:payment_method, :auto_capture, [["#{Spree.t(:use_app_default)} (#{Spree::Config[:auto_capture]})", ''], [Spree.t(:say_yes), true], [Spree.t(:say_no), false]], {}, {:class => 'select2'}) %> + <%= select(:payment_method, :auto_capture, [["#{Spree.t(:use_app_default)} (#{Spree::Config[:auto_capture]})", ''], [Spree.t(:say_yes), true], [Spree.t(:say_no), false]], {}, {class: 'select2'}) %>
    <%= Spree.t(:active) %> @@ -44,12 +44,12 @@
    <%= field_container :payment_method, :name, class: ['form-group'], 'data-hook' => 'name' do %> <%= label_tag :payment_method_name, Spree.t(:name) %> - <%= text_field :payment_method, :name, :class => 'form-control' %> + <%= text_field :payment_method, :name, class: 'form-control' %> <%= error_message_on :payment_method, :name %> <% end %> <%= field_container :payment_method, :description, class: ['form-group'], 'data-hook' => 'description' do %> <%= label_tag :payment_method_description, Spree.t(:description) %> - <%= text_area :payment_method, :description, { :cols => 60, :rows => 6, :class => 'form-control' } %> + <%= text_area :payment_method, :description, { cols: 60, rows: 6, class: 'form-control' } %> <% end %>
    diff --git a/backend/app/views/spree/admin/payment_methods/index.html.erb b/backend/app/views/spree/admin/payment_methods/index.html.erb index 29e3836f249..90c58f204dc 100644 --- a/backend/app/views/spree/admin/payment_methods/index.html.erb +++ b/backend/app/views/spree/admin/payment_methods/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_payment_method), new_object_url, :class => "btn-success", :icon => 'add', :id => 'admin_new_payment_methods_link' %> + <%= button_link_to Spree.t(:new_payment_method), new_object_url, class: "btn-success", icon: 'add', id: 'admin_new_payment_methods_link' %> <% end if can? :create, Spree::PaymentMethod %> <% if @payment_methods.any? %> @@ -31,8 +31,8 @@ <%= Spree.t(method.display_on) %> <%= method.active ? Spree.t(:say_yes) : Spree.t(:say_no) %> - <%= link_to_edit(method, :no_text => true) if can? :edit, method %> - <%= link_to_delete(method, :no_text => true) if can? :delete, method %> + <%= link_to_edit(method, no_text: true) if can? :edit, method %> + <%= link_to_delete(method, no_text: true) if can? :delete, method %> <% end %> diff --git a/backend/app/views/spree/admin/payments/_form.html.erb b/backend/app/views/spree/admin/payments/_form.html.erb index 6891842718f..a39d3c691ca 100644 --- a/backend/app/views/spree/admin/payments/_form.html.erb +++ b/backend/app/views/spree/admin/payments/_form.html.erb @@ -1,15 +1,15 @@
    <%= f.label :amount, Spree.t(:amount) %> - <%= f.text_field :amount, :value => @order.display_outstanding_balance.money, :class => 'form-control' %> + <%= f.text_field :amount, value: @order.display_outstanding_balance.money, class: 'form-control' %>
    <%= Spree.t(:payment_method) %> <% @payment_methods.each do |method| %> -
    +
    <% end %> @@ -19,9 +19,9 @@
    <% if method.source_required? %> - <%=render :partial => "spree/admin/payments/source_forms/#{method.method_type}", - :locals => { - :payment_method => method, + <%=render partial: "spree/admin/payments/source_forms/#{method.method_type}", + locals: { + payment_method: method, previous_cards: method.reusable_sources(@order) } %> diff --git a/backend/app/views/spree/admin/payments/source_forms/_gateway.html.erb b/backend/app/views/spree/admin/payments/source_forms/_gateway.html.erb index a68c858b8ba..197f59f531f 100644 --- a/backend/app/views/spree/admin/payments/source_forms/_gateway.html.erb +++ b/backend/app/views/spree/admin/payments/source_forms/_gateway.html.erb @@ -23,8 +23,8 @@
    <%= hidden_field_tag "#{param_prefix}[cc_type]", '', {class: 'ccType'} %> - <%= label_tag "card_number#{payment_method.id}", raw(Spree.t(:card_number) + content_tag(:span, ' *', :class => 'required')) %> - <%= text_field_tag "#{param_prefix}[number]", '', :class => 'required form-control cardNumber', :id => "card_number#{payment_method.id}", :maxlength => 19 %> + <%= label_tag "card_number#{payment_method.id}", raw(Spree.t(:card_number) + content_tag(:span, ' *', class: 'required')) %> + <%= text_field_tag "#{param_prefix}[number]", '', class: 'required form-control cardNumber', id: "card_number#{payment_method.id}", maxlength: 19 %>
    - <%= label_tag "card_name#{payment_method.id}", raw(Spree.t(:name) + content_tag(:span, ' *', :class => 'required')) %> + <%= label_tag "card_name#{payment_method.id}", raw(Spree.t(:name) + content_tag(:span, ' *', class: 'required')) %> <%= text_field_tag "#{param_prefix}[name]", '', id: "card_name#{payment_method.id}", class: 'required form-control', maxlength: 19 %>
    - <%= label_tag "card_expiry#{payment_method.id}", raw(Spree.t(:expiration) + content_tag(:span, ' *', :class => 'required')) %>
    + <%= label_tag "card_expiry#{payment_method.id}", raw(Spree.t(:expiration) + content_tag(:span, ' *', class: 'required')) %>
    <%= text_field_tag "#{param_prefix}[expiry]", '', id: "card_expiry#{payment_method.id}", class: "required cardExpiry form-control", placeholder: "MM / YY" %>
    - <%= label_tag "card_code#{payment_method.id}", raw(Spree.t(:card_code) + content_tag(:span, ' *', :class => "required")) %> + <%= label_tag "card_code#{payment_method.id}", raw(Spree.t(:card_code) + content_tag(:span, ' *', class: "required")) %> <%= text_field_tag "#{param_prefix}[verification_value]", '', id: "card_code#{payment_method.id}", class: 'required form-control cardCode', size: 5 %> (<%= Spree.t(:what_is_this) %>)
    - <%= image_tag 'credit_cards/credit_card.gif', :class => 'credit-card-image' %> + <%= image_tag 'credit_cards/credit_card.gif', class: 'credit-card-image' %>
    diff --git a/backend/app/views/spree/admin/products/_properties_form.erb b/backend/app/views/spree/admin/products/_properties_form.erb index 5c3b211b388..48058763891 100644 --- a/backend/app/views/spree/admin/products/_properties_form.erb +++ b/backend/app/views/spree/admin/products/_properties_form.erb @@ -5,6 +5,6 @@ <% f.fields_for :product_properties do |properties_form| %>
    <%= properties_form.label :value, properties_form.object.property.presentation %> - <%= properties_form.text_field :value, :class => "form-control" %> + <%= properties_form.text_field :value, class: "form-control" %>
    <% end %> diff --git a/backend/app/views/spree/admin/products/index.html.erb b/backend/app/views/spree/admin/products/index.html.erb index f5c699fee64..25a87ed90a9 100644 --- a/backend/app/views/spree/admin/products/index.html.erb +++ b/backend/app/views/spree/admin/products/index.html.erb @@ -3,38 +3,38 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_product), new_object_url, { :class => "btn-success", :icon => 'add', :id => 'admin_new_product' } %> + <%= button_link_to Spree.t(:new_product), new_object_url, { class: "btn-success", icon: 'add', id: 'admin_new_product' } %> <% end if can?(:create, Spree::Product) %> <% content_for :table_filter do %>
    <%= search_form_for [:admin, @search] do |f| %> - <%- locals = {:f => f} %> + <%- locals = {f: f} %>
    <%= f.label :name_cont, Spree.t(:name) %> - <%= f.text_field :name_cont, :size => 15, class: "form-control js-quick-search-target" %> + <%= f.text_field :name_cont, size: 15, class: "form-control js-quick-search-target" %>
    <%= f.label :variants_including_master_sku_cont, Spree.t(:sku) %> - <%= f.text_field :variants_including_master_sku_cont, :size => 15, class: "form-control" %> + <%= f.text_field :variants_including_master_sku_cont, size: 15, class: "form-control" %>
    diff --git a/backend/app/views/spree/admin/products/new.html.erb b/backend/app/views/spree/admin/products/new.html.erb index 022fc779739..7baa1d4c597 100644 --- a/backend/app/views/spree/admin/products/new.html.erb +++ b/backend/app/views/spree/admin/products/new.html.erb @@ -1,56 +1,56 @@ -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @product } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @product } %> <% content_for :page_title do %> <%= link_to Spree.t(:products), spree.admin_products_url %> / <%= Spree.t(:new_product) %> <% end %> -<%= form_for [:admin, @product], :html => { :multipart => true } do |f| %> +<%= form_for [:admin, @product], html: { multipart: true } do |f| %>
    - <%= f.field_container :name, :class => ['form-group'] do %> + <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name, Spree.t(:name) %> * - <%= f.text_field :name, :class => 'form-control title' %> + <%= f.text_field :name, class: 'form-control title' %> <%= f.error_message_on :name %> <% end %>
    <% unless @product.has_variants? %>
    - <%= f.field_container :sku, :class => ['form-group'] do %> + <%= f.field_container :sku, class: ['form-group'] do %> <%= f.label :sku, Spree.t(:sku) %> - <%= f.text_field :sku, :size => 16, :class => 'form-control' %> + <%= f.text_field :sku, size: 16, class: 'form-control' %> <%= f.error_message_on :sku %> <% end %>
    <% end %>
    - <%= f.field_container :prototype, :class => ['form-group'] do %> + <%= f.field_container :prototype, class: ['form-group'] do %> <%= f.label :prototype_id, Spree.t(:prototype) %> - <%= f.collection_select :prototype_id, Spree::Prototype.all, :id, :name, {:include_blank => true}, {:class => 'select2'} %> + <%= f.collection_select :prototype_id, Spree::Prototype.all, :id, :name, {include_blank: true}, {class: 'select2'} %> <% end %>
    - <%= f.field_container :price, :class => ['form-group'] do %> + <%= f.field_container :price, class: ['form-group'] do %> <%= f.label :price, Spree.t(:master_price) %> * - <%= f.text_field :price, :value => number_to_currency(@product.price, :unit => ''), :class => 'form-control' %> + <%= f.text_field :price, value: number_to_currency(@product.price, unit: ''), class: 'form-control' %> <%= f.error_message_on :price %> <% end %>
    - <%= f.field_container :available_on, :class => ['form-group'] do %> + <%= f.field_container :available_on, class: ['form-group'] do %> <%= f.label :available_on, Spree.t(:available_on) %> <%= f.error_message_on :available_on %> - <%= f.text_field :available_on, :class => 'datepicker form-control' %> + <%= f.text_field :available_on, class: 'datepicker form-control' %> <% end %>
    - <%= f.field_container :shipping_category, :class => ['form-group'] do %> + <%= f.field_container :shipping_category, class: ['form-group'] do %> <%= f.label :shipping_category_id, Spree.t(:shipping_categories) %>* - <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { :include_blank => Spree.t('match_choices.none') }, { :class => 'select2' }) %> + <%= f.collection_select(:shipping_category_id, @shipping_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %> <%= f.error_message_on :shipping_category_id %> <% end %>
    @@ -58,10 +58,10 @@
    - <%= render :file => 'spree/admin/prototypes/show' if @prototype %> + <%= render file: 'spree/admin/prototypes/show' if @prototype %>
    - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/promotion_categories/_form.html.erb b/backend/app/views/spree/admin/promotion_categories/_form.html.erb index ad015f0ec1f..4459aba5e97 100644 --- a/backend/app/views/spree/admin/promotion_categories/_form.html.erb +++ b/backend/app/views/spree/admin/promotion_categories/_form.html.erb @@ -1,11 +1,11 @@ -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @promotion_category } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @promotion_category } %> <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name %> - <%= f.text_field :name, :class => 'form-control' %> + <%= f.text_field :name, class: 'form-control' %> <%= f.error_message_on :name %> <% end %> <%= f.field_container :code, class: ['form-group'] do %> <%= f.label :code %> - <%= f.text_field :code, :class => 'form-control' %> + <%= f.text_field :code, class: 'form-control' %> <% end %> diff --git a/backend/app/views/spree/admin/promotion_categories/edit.html.erb b/backend/app/views/spree/admin/promotion_categories/edit.html.erb index a707fb26a03..88ac2065e89 100644 --- a/backend/app/views/spree/admin/promotion_categories/edit.html.erb +++ b/backend/app/views/spree/admin/promotion_categories/edit.html.erb @@ -3,9 +3,9 @@ <%= @promotion_category.name %> <% end %> -<%= form_for @promotion_category, :url => object_url, :method => :put do |f| %> +<%= form_for @promotion_category, url: object_url, method: :put do |f| %>
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/promotion_categories/index.html.erb b/backend/app/views/spree/admin/promotion_categories/index.html.erb index 047cf26f03f..f7a7e91740c 100644 --- a/backend/app/views/spree/admin/promotion_categories/index.html.erb +++ b/backend/app/views/spree/admin/promotion_categories/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_promotion_category), new_object_url, :icon => 'add', :class => 'btn-success' %> + <%= button_link_to Spree.t(:new_promotion_category), new_object_url, icon: 'add', class: 'btn-success' %> <% end %> <% if @promotion_categories.any? %> @@ -19,8 +19,8 @@ <%= promotion_category.name %> <%= promotion_category.code %> - <%= link_to_edit promotion_category, :no_text => true %> - <%= link_to_delete promotion_category, :no_text => true %> + <%= link_to_edit promotion_category, no_text: true %> + <%= link_to_delete promotion_category, no_text: true %> <% end %> diff --git a/backend/app/views/spree/admin/promotion_categories/new.html.erb b/backend/app/views/spree/admin/promotion_categories/new.html.erb index 2b4e5836949..0ec85112726 100644 --- a/backend/app/views/spree/admin/promotion_categories/new.html.erb +++ b/backend/app/views/spree/admin/promotion_categories/new.html.erb @@ -3,9 +3,9 @@ <%= Spree.t(:new_promotion_category) %> <% end %> -<%= form_for :promotion_category, :url => collection_url do |f| %> +<%= form_for :promotion_category, url: collection_url do |f| %>
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/promotions/_actions.html.erb b/backend/app/views/spree/admin/promotions/_actions.html.erb index 64996a83c80..7a86277c24a 100644 --- a/backend/app/views/spree/admin/promotions/_actions.html.erb +++ b/backend/app/views/spree/admin/promotions/_actions.html.erb @@ -4,12 +4,12 @@
    - <%= form_tag spree.admin_promotion_promotion_actions_path(@promotion), :remote => true, :id => 'new_promotion_action_form' do %> + <%= form_tag spree.admin_promotion_promotion_actions_path(@promotion), remote: true, id: 'new_promotion_action_form' do %> <% options = options_for_select( Rails.application.config.spree.promotions.actions.map(&:name).map {|name| [ Spree.t("promotion_action_types.#{name.demodulize.underscore}.name"), name] } ) %>
    <%= label_tag :action_type, Spree.t(:add_action_of_type)%> - <%= select_tag 'action_type', options, :class => 'select2' %> + <%= select_tag 'action_type', options, class: 'select2' %>
    <%= button Spree.t(:add), 'plus', 'submit', class: "btn-success" %> @@ -17,10 +17,10 @@ <% end %> - <%= form_for @promotion, :url => spree.admin_promotion_path(@promotion), :method => :put do |f| %> + <%= form_for @promotion, url: spree.admin_promotion_path(@promotion), method: :put do |f| %>
    <% if @promotion.actions.any? %> - <%= render :partial => 'promotion_action', :collection => @promotion.actions %> + <%= render partial: 'promotion_action', collection: @promotion.actions %> <% else %>
    <%= Spree.t(:no_actions_added) %> diff --git a/backend/app/views/spree/admin/promotions/_form.html.erb b/backend/app/views/spree/admin/promotions/_form.html.erb index 4df3134b741..0296e0a0925 100644 --- a/backend/app/views/spree/admin/promotions/_form.html.erb +++ b/backend/app/views/spree/admin/promotions/_form.html.erb @@ -1,21 +1,21 @@ -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @promotion } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @promotion } %>
    <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name %> - <%= f.text_field :name, :class => 'form-control' %> + <%= f.text_field :name, class: 'form-control' %> <%= f.error_message_on :name %> <% end %> <%= f.field_container :code, class: ['form-group'] do %> <%= f.label :code %> - <%= f.text_field :code, :class => 'form-control' %> + <%= f.text_field :code, class: 'form-control' %> <% end %> <%= f.field_container :path, class: ['form-group'] do %> <%= f.label :path %> - <%= f.text_field :path, :class => 'form-control' %> + <%= f.text_field :path, class: 'form-control' %> <% end %> <%= f.field_container :advertise, class: ['checkbox'] do %> @@ -29,32 +29,32 @@
    <%= f.field_container :description, class: ['form-group'] do %> <%= f.label :description %> - <%= f.text_area :description, :rows => 7, :class => 'form-control' %> + <%= f.text_area :description, rows: 7, class: 'form-control' %> <% end %> <%= f.field_container :category, class: ['form-group'] do %> <%= f.label :promotion_category %> - <%= f.collection_select(:promotion_category_id, @promotion_categories, :id, :name, { :include_blank => Spree.t('match_choices.none') }, { :class => 'select2' }) %> + <%= f.collection_select(:promotion_category_id, @promotion_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %> <% end %>
    <%= f.field_container :usage_limit do %> <%= f.label :usage_limit %> - <%= f.number_field :usage_limit, :min => 0, :class => 'form-control' %> + <%= f.number_field :usage_limit, min: 0, class: 'form-control' %>

    - <%= Spree.t(:current_promotion_usage, :count => @promotion.credits_count) %> + <%= Spree.t(:current_promotion_usage, count: @promotion.credits_count) %>

    <% end %>
    <%= f.label :starts_at %> - <%= f.text_field :starts_at, :value => datepicker_field_value(@promotion.starts_at), :class => 'datepicker datepicker-from form-control' %> + <%= f.text_field :starts_at, value: datepicker_field_value(@promotion.starts_at), class: 'datepicker datepicker-from form-control' %>
    <%= f.label :expires_at %> - <%= f.text_field :expires_at, :value => datepicker_field_value(@promotion.expires_at), :class => 'datepicker datepicker-to form-control' %> + <%= f.text_field :expires_at, value: datepicker_field_value(@promotion.expires_at), class: 'datepicker datepicker-to form-control' %>
    diff --git a/backend/app/views/spree/admin/promotions/_rules.html.erb b/backend/app/views/spree/admin/promotions/_rules.html.erb index aee31383bb8..9752c759b54 100644 --- a/backend/app/views/spree/admin/promotions/_rules.html.erb +++ b/backend/app/views/spree/admin/promotions/_rules.html.erb @@ -5,11 +5,11 @@
    - <%= form_tag spree.admin_promotion_promotion_rules_path(@promotion), :remote => true, :id => 'new_product_rule_form' do %> + <%= form_tag spree.admin_promotion_promotion_rules_path(@promotion), remote: true, id: 'new_product_rule_form' do %>
    <%= label_tag :promotion_rule_type, Spree.t(:add_rule_of_type) %> - <%= select_tag('promotion_rule[type]', options_for_promotion_rule_types(@promotion), :class => 'select2') %> + <%= select_tag('promotion_rule[type]', options_for_promotion_rule_types(@promotion), class: 'select2') %>
    <%= button Spree.t(:add), 'plus', 'submit', class: "btn-success" %> @@ -17,7 +17,7 @@ <% end %> - <%= form_for @promotion, :url => object_url, :method => :put do |f| %> + <%= form_for @promotion, url: object_url, method: :put do |f| %>
    <% Spree::Promotion::MATCH_POLICIES.each do |policy| %>
    @@ -31,7 +31,7 @@
    <% if @promotion.rules.any? %> - <%= render :partial => 'promotion_rule', :collection => @promotion.rules, :locals => {} %> + <%= render partial: 'promotion_rule', collection: @promotion.rules, locals: {} %> <% else %>
    <%= Spree.t(:no_rules_added) %> diff --git a/backend/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb b/backend/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb index 7b5f40b93d7..168cb11fb9a 100644 --- a/backend/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +++ b/backend/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb @@ -5,7 +5,7 @@ <%= label_tag field_name, Spree.t(:calculator) %> <%= select_tag field_name, options_from_collection_for_select(@calculators, :to_s, :description, promotion_action.calculator.type), - :class => 'type-select select2' %> + class: 'type-select select2' %>
    <% unless promotion_action.new_record? %>
    diff --git a/backend/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb b/backend/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb index 09f6692b625..921bdff32e2 100644 --- a/backend/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +++ b/backend/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb @@ -5,7 +5,7 @@ <%= label_tag field_name, Spree.t(:calculator) %> <%= select_tag field_name, options_from_collection_for_select(Spree::Promotion::Actions::CreateItemAdjustments.calculators, :to_s, :description, promotion_action.calculator.type), - :class => 'type-select select2' %> + class: 'type-select select2' %>
    <% unless promotion_action.new_record? %>
    @@ -14,7 +14,7 @@ <%= label_tag field_name, Spree.t(key.to_s) %> <%= preference_field_tag(field_name, promotion_action.calculator.get_preference(key), - :type => promotion_action.calculator.preference_type(key)) %> + type: promotion_action.calculator.preference_type(key)) %> <% end %> <%= hidden_field_tag "#{param_prefix}[calculator_attributes][id]", promotion_action.calculator.id %>
    diff --git a/backend/app/views/spree/admin/promotions/edit.html.erb b/backend/app/views/spree/admin/promotions/edit.html.erb index 8df59316cb4..6c9ba30ccc5 100644 --- a/backend/app/views/spree/admin/promotions/edit.html.erb +++ b/backend/app/views/spree/admin/promotions/edit.html.erb @@ -3,11 +3,11 @@ <%= @promotion.name %> <% end %> -<%= form_for @promotion, :url => object_url, :method => :put do |f| %> +<%= form_for @promotion, url: object_url, method: :put do |f| %>
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
    @@ -16,15 +16,15 @@
    - <%= render :partial => 'rules' %> + <%= render partial: 'rules' %>
    - <%= render :partial => 'actions' %> + <%= render partial: 'actions' %>
    -<%= render :partial => "spree/admin/variants/autocomplete", :formats => [:js] %> +<%= render partial: "spree/admin/variants/autocomplete", formats: [:js] %> diff --git a/backend/app/views/spree/admin/promotions/index.html.erb b/backend/app/views/spree/admin/promotions/index.html.erb index af4ae6951c0..5ad0bc258a8 100644 --- a/backend/app/views/spree/admin/promotions/index.html.erb +++ b/backend/app/views/spree/admin/promotions/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_promotion), new_object_url, :class => "btn-success", :icon => 'add' %> + <%= button_link_to Spree.t(:new_promotion), new_object_url, class: "btn-success", icon: 'add' %> <% end %> <% content_for :table_filter do %> @@ -30,7 +30,7 @@
    <%= label_tag :q_promotion_category_id_eq, Spree.t(:promotion_category) %> - <%= f.collection_select(:promotion_category_id_eq, @promotion_categories, :id, :name, { :include_blank => Spree.t('match_choices.all') }, { :class => 'select2' }) %> + <%= f.collection_select(:promotion_category_id_eq, @promotion_categories, :id, :name, { include_blank: Spree.t('match_choices.all') }, { class: 'select2' }) %>
    @@ -64,11 +64,11 @@ <%= promotion.code %> <%= promotion.description %> <%= promotion.usage_limit.nil? ? "∞" : promotion.usage_limit %> - <%= Spree.t(:current_promotion_usage, :count => promotion.credits_count) %> + <%= Spree.t(:current_promotion_usage, count: promotion.credits_count) %> <%= promotion.expires_at.to_date.to_s(:short_date) if promotion.expires_at %> - <%= link_to_edit promotion, :no_text => true %> - <%= link_to_delete promotion, :no_text => true %> + <%= link_to_edit promotion, no_text: true %> + <%= link_to_delete promotion, no_text: true %> <% end %> diff --git a/backend/app/views/spree/admin/promotions/new.html.erb b/backend/app/views/spree/admin/promotions/new.html.erb index ae0151173e8..9fe579ee402 100644 --- a/backend/app/views/spree/admin/promotions/new.html.erb +++ b/backend/app/views/spree/admin/promotions/new.html.erb @@ -3,9 +3,9 @@ <%= Spree.t(:new_promotion) %> <% end %> -<%= form_for :promotion, :url => collection_url do |f| %> - <%= render :partial => 'form', :locals => { :f => f } %> +<%= form_for :promotion, url: collection_url do |f| %> + <%= render partial: 'form', locals: { f: f } %>
    - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/promotions/rules/_landing_page.html.erb b/backend/app/views/spree/admin/promotions/rules/_landing_page.html.erb index 47bdb581a73..7f3a782b30b 100644 --- a/backend/app/views/spree/admin/promotions/rules/_landing_page.html.erb +++ b/backend/app/views/spree/admin/promotions/rules/_landing_page.html.erb @@ -1,7 +1,7 @@
    - <%= text_field_tag "#{param_prefix}[preferred_path]", promotion_rule.preferred_path, :class => 'form-control' %> + <%= text_field_tag "#{param_prefix}[preferred_path]", promotion_rule.preferred_path, class: 'form-control' %>

    <%= Spree.t('landing_page_rule.must_have_visited_path') %>

    diff --git a/backend/app/views/spree/admin/promotions/rules/_product.html.erb b/backend/app/views/spree/admin/promotions/rules/_product.html.erb index 70d56430744..cb98c092137 100644 --- a/backend/app/views/spree/admin/promotions/rules/_product.html.erb +++ b/backend/app/views/spree/admin/promotions/rules/_product.html.erb @@ -1,10 +1,10 @@
    <%= label_tag "#{param_prefix}_product_ids_string", Spree.t('product_rule.choose_products') %> - <%= hidden_field_tag "#{param_prefix}[product_ids_string]", promotion_rule.product_ids.join(","), :class => "product_picker" %> + <%= hidden_field_tag "#{param_prefix}[product_ids_string]", promotion_rule.product_ids.join(","), class: "product_picker" %>
    <%= label_tag Spree.t('product_rule.label') %> - <%= select_tag("#{param_prefix}[preferred_match_policy]", options_for_select(Spree::Promotion::Rules::Product::MATCH_POLICIES.map{|s| [Spree.t("product_rule.match_#{s}"),s] }, promotion_rule.preferred_match_policy), {:class => 'select_product form-control'}) %> + <%= select_tag("#{param_prefix}[preferred_match_policy]", options_for_select(Spree::Promotion::Rules::Product::MATCH_POLICIES.map{|s| [Spree.t("product_rule.match_#{s}"),s] }, promotion_rule.preferred_match_policy), {class: 'select_product form-control'}) %>
    diff --git a/backend/app/views/spree/admin/promotions/rules/_taxon.html.erb b/backend/app/views/spree/admin/promotions/rules/_taxon.html.erb index 56b06894105..e89cc5d19dc 100644 --- a/backend/app/views/spree/admin/promotions/rules/_taxon.html.erb +++ b/backend/app/views/spree/admin/promotions/rules/_taxon.html.erb @@ -1,10 +1,10 @@
    <%= label_tag "#{param_prefix}_taxon_ids_string", Spree.t('taxon_rule.choose_taxons') %> - <%= hidden_field_tag "#{param_prefix}[taxon_ids_string]", promotion_rule.taxon_ids.join(","), :class => "taxon_picker", id: 'product_taxon_ids' %> + <%= hidden_field_tag "#{param_prefix}[taxon_ids_string]", promotion_rule.taxon_ids.join(","), class: "taxon_picker", id: 'product_taxon_ids' %>
    <%= label_tag Spree.t('taxon_rule.label') %> - <%= select_tag("#{param_prefix}[preferred_match_policy]", options_for_select(Spree::Promotion::Rules::Taxon::MATCH_POLICIES.map{|s| [Spree.t("taxon_rule.match_#{s}"),s] }, promotion_rule.preferred_match_policy), {:class => 'select_taxon form-control'}) %> + <%= select_tag("#{param_prefix}[preferred_match_policy]", options_for_select(Spree::Promotion::Rules::Taxon::MATCH_POLICIES.map{|s| [Spree.t("taxon_rule.match_#{s}"),s] }, promotion_rule.preferred_match_policy), {class: 'select_taxon form-control'}) %>
    diff --git a/backend/app/views/spree/admin/properties/_form.html.erb b/backend/app/views/spree/admin/properties/_form.html.erb index 095586f3470..857e9c13b0e 100644 --- a/backend/app/views/spree/admin/properties/_form.html.erb +++ b/backend/app/views/spree/admin/properties/_form.html.erb @@ -2,14 +2,14 @@
    <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name, Spree.t(:name) %> * - <%= f.text_field :name, :class => 'form-control' %> + <%= f.text_field :name, class: 'form-control' %> <%= f.error_message_on :name %> <% end %>
    <%= f.field_container :presentation, class: ['form-group'] do %> <%= f.label :presentation, Spree.t(:presentation) %> * - <%= f.text_field :presentation, :class => 'form-control' %> + <%= f.text_field :presentation, class: 'form-control' %> <%= f.error_message_on :presentation %> <% end %>
    diff --git a/backend/app/views/spree/admin/properties/edit.html.erb b/backend/app/views/spree/admin/properties/edit.html.erb index 39c299615cf..6e5e8310517 100644 --- a/backend/app/views/spree/admin/properties/edit.html.erb +++ b/backend/app/views/spree/admin/properties/edit.html.erb @@ -3,11 +3,11 @@ <%= @property.name %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @property } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @property } %> <%= form_for [:admin, @property] do |f| %>
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/properties/index.html.erb b/backend/app/views/spree/admin/properties/index.html.erb index cfaad725583..1be0867e313 100644 --- a/backend/app/views/spree/admin/properties/index.html.erb +++ b/backend/app/views/spree/admin/properties/index.html.erb @@ -3,27 +3,27 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_property), new_object_url, { :class => "btn-success", :icon => 'add', 'data-update' => 'new_property', :id => 'new_property_link' } %> + <%= button_link_to Spree.t(:new_property), new_object_url, { class: "btn-success", icon: 'add', 'data-update' => 'new_property', id: 'new_property_link' } %> <% end %> <% content_for :table_filter do %>
    <%= search_form_for [:admin, @search] do |f| %> - <%- locals = {:f => f} %> + <%- locals = {f: f} %>
    <%= f.label :name_cont, Spree.t(:name) %> - <%= f.text_field :name_cont, :class => "form-control js-quick-search-target" %> + <%= f.text_field :name_cont, class: "form-control js-quick-search-target" %>
    <%= f.label :presentation_cont, Spree.t(:presentation) %> - <%= f.text_field :presentation_cont, :class => "form-control" %> + <%= f.text_field :presentation_cont, class: "form-control" %>
    @@ -51,8 +51,8 @@ <%= property.name %> <%= property.presentation %> - <%= link_to_edit(property, :no_text => true) %> - <%= link_to_delete(property, :no_text => true) %> + <%= link_to_edit(property, no_text: true) %> + <%= link_to_delete(property, no_text: true) %> <% end %> diff --git a/backend/app/views/spree/admin/prototypes/_prototypes.html.erb b/backend/app/views/spree/admin/prototypes/_prototypes.html.erb index 8c1543a7550..c0659d1604f 100644 --- a/backend/app/views/spree/admin/prototypes/_prototypes.html.erb +++ b/backend/app/views/spree/admin/prototypes/_prototypes.html.erb @@ -10,7 +10,7 @@ <%= prototype.name %> - <%= link_to_with_icon 'save', Spree.t(:select), select_admin_prototype_url(prototype), :class => ' btn btn-default btn-sm ajax select_properties_from_prototype', :no_text => true %> + <%= link_to_with_icon 'save', Spree.t(:select), select_admin_prototype_url(prototype), class: ' btn btn-default btn-sm ajax select_properties_from_prototype', no_text: true %> <% end %> diff --git a/backend/app/views/spree/admin/prototypes/available.js.erb b/backend/app/views/spree/admin/prototypes/available.js.erb index d75f3a5528b..b9510b45af1 100644 --- a/backend/app/views/spree/admin/prototypes/available.js.erb +++ b/backend/app/views/spree/admin/prototypes/available.js.erb @@ -1,2 +1,2 @@ -$("#prototypes").html('<%= escape_javascript(render :partial => "spree/admin/prototypes/prototypes") %>'); +$("#prototypes").html('<%= escape_javascript(render partial: "spree/admin/prototypes/prototypes") %>'); $(".js-new-ptype-link").hide(); diff --git a/backend/app/views/spree/admin/prototypes/edit.html.erb b/backend/app/views/spree/admin/prototypes/edit.html.erb index 550d1729505..1e370fa693f 100644 --- a/backend/app/views/spree/admin/prototypes/edit.html.erb +++ b/backend/app/views/spree/admin/prototypes/edit.html.erb @@ -3,11 +3,11 @@ <%= @prototype.name %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @prototype } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @prototype } %> <%= form_for [:admin, @prototype] do |f| %>
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/prototypes/index.html.erb b/backend/app/views/spree/admin/prototypes/index.html.erb index 6197b83b54f..1bdcf7c6927 100644 --- a/backend/app/views/spree/admin/prototypes/index.html.erb +++ b/backend/app/views/spree/admin/prototypes/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_prototype), new_object_url, { :class => "btn-success", :icon => 'add', 'data-update' => 'new_prototype', :id => 'new_prototype_link'} %> + <%= button_link_to Spree.t(:new_prototype), new_object_url, { class: "btn-success", icon: 'add', 'data-update' => 'new_prototype', id: 'new_prototype_link'} %> <% end %> <% if @prototypes.any? %> @@ -19,8 +19,8 @@ <%= prototype.name %> - <%= link_to_edit(prototype, :no_text => true, :class => 'admin_edit_prototype') %> - <%= link_to_delete(prototype, :no_text => true) %> + <%= link_to_edit(prototype, no_text: true, class: 'admin_edit_prototype') %> + <%= link_to_delete(prototype, no_text: true) %> <% end %> diff --git a/backend/app/views/spree/admin/prototypes/new.html.erb b/backend/app/views/spree/admin/prototypes/new.html.erb index e16683d8539..837265b4c4a 100644 --- a/backend/app/views/spree/admin/prototypes/new.html.erb +++ b/backend/app/views/spree/admin/prototypes/new.html.erb @@ -1,4 +1,4 @@ -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @prototype } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @prototype } %> <% content_for :page_title do %> <%= link_to Spree.t(:prototypes), spree.admin_prototypes_url %> / @@ -7,7 +7,7 @@ <%= form_for [:admin, @prototype] do |f| %>
    - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
    <% end %> diff --git a/backend/app/views/spree/admin/prototypes/show.html.erb b/backend/app/views/spree/admin/prototypes/show.html.erb index 7bc04bbee34..b35660c885c 100644 --- a/backend/app/views/spree/admin/prototypes/show.html.erb +++ b/backend/app/views/spree/admin/prototypes/show.html.erb @@ -5,7 +5,7 @@ <% @prototype.option_types.each do |ot| %>
  • - <%= check_box_tag "option_types[]", ot.id, (params[:option_types] || []).include?(ot.id.to_s), :id => "option_type_#{ot.id}", :class => "option-type" %> + <%= check_box_tag "option_types[]", ot.id, (params[:option_types] || []).include?(ot.id.to_s), id: "option_type_#{ot.id}", class: "option-type" %> <%= label_tag "option_type_#{ot.id}", ot.presentation %>
      diff --git a/backend/app/views/spree/admin/reports/sales_total.html.erb b/backend/app/views/spree/admin/reports/sales_total.html.erb index d67775f0926..d382b071a5a 100644 --- a/backend/app/views/spree/admin/reports/sales_total.html.erb +++ b/backend/app/views/spree/admin/reports/sales_total.html.erb @@ -4,7 +4,7 @@ <% end %>
      - <%= render :partial => 'spree/admin/shared/report_order_criteria' %> + <%= render partial: 'spree/admin/shared/report_order_criteria' %>
      diff --git a/backend/app/views/spree/admin/return_authorizations/_form.html.erb b/backend/app/views/spree/admin/return_authorizations/_form.html.erb index d8d310817c0..cfcbe1378bb 100644 --- a/backend/app/views/spree/admin/return_authorizations/_form.html.erb +++ b/backend/app/views/spree/admin/return_authorizations/_form.html.erb @@ -81,7 +81,7 @@ <%= f.field_container :memo, class: ['form-group'] do %> <%= f.label :memo, Spree.t(:memo) %> - <%= f.text_area :memo, :class => 'form-control' %> + <%= f.text_area :memo, class: 'form-control' %> <%= f.error_message_on :memo %> <% end %> diff --git a/backend/app/views/spree/admin/roles/edit.html.erb b/backend/app/views/spree/admin/roles/edit.html.erb index f356fc29335..6fc77e77f15 100644 --- a/backend/app/views/spree/admin/roles/edit.html.erb +++ b/backend/app/views/spree/admin/roles/edit.html.erb @@ -3,7 +3,7 @@ <%= @role.name.capitalize %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @role } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @role } %> <%= form_for [:admin, @role] do |f| %>
      diff --git a/backend/app/views/spree/admin/roles/new.html.erb b/backend/app/views/spree/admin/roles/new.html.erb index 2f90960ac99..daba60fdfd8 100644 --- a/backend/app/views/spree/admin/roles/new.html.erb +++ b/backend/app/views/spree/admin/roles/new.html.erb @@ -3,7 +3,7 @@ <%= Spree.t(:new_role) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @role } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @role } %> <%= form_for [:admin, @role] do |f| %>
      diff --git a/backend/app/views/spree/admin/search/users.rabl b/backend/app/views/spree/admin/search/users.rabl index 33f3cbba369..a26f998d4fe 100644 --- a/backend/app/views/spree/admin/search/users.rabl +++ b/backend/app/views/spree/admin/search/users.rabl @@ -7,7 +7,7 @@ address_fields = [:firstname, :lastname, :state_id, :country_id, :company] - child :ship_address => :ship_address do + child ship_address: :ship_address do attributes *address_fields child :state do attributes :name @@ -18,7 +18,7 @@ address_fields = [:firstname, :lastname, end end - child :bill_address => :bill_address do + child bill_address: :bill_address do attributes *address_fields child :state do attributes :name diff --git a/backend/app/views/spree/admin/shared/_calculator_fields.html.erb b/backend/app/views/spree/admin/shared/_calculator_fields.html.erb index 917613e7429..bf23d131840 100644 --- a/backend/app/views/spree/admin/shared/_calculator_fields.html.erb +++ b/backend/app/views/spree/admin/shared/_calculator_fields.html.erb @@ -8,8 +8,8 @@
      - <%= f.label(:calculator_type, Spree.t(:calculator), :for => 'calc_type') %> - <%= f.select(:calculator_type, @calculators.map { |c| [c.description, c.name] }, {}, {:id => 'calc_type', :class => 'select2'}) %> + <%= f.label(:calculator_type, Spree.t(:calculator), for: 'calc_type') %> + <%= f.select(:calculator_type, @calculators.map { |c| [c.description, c.name] }, {}, {id: 'calc_type', class: 'select2'}) %>
      <% if !@object.new_record? %>
      diff --git a/backend/app/views/spree/admin/shared/_destroy.js.erb b/backend/app/views/spree/admin/shared/_destroy.js.erb index f83684dd9c0..c79f8c8308f 100644 --- a/backend/app/views/spree/admin/shared/_destroy.js.erb +++ b/backend/app/views/spree/admin/shared/_destroy.js.erb @@ -6,4 +6,4 @@ show_flash('warning', "<%= j error %>"); <% end %> -<%= render :partial => '/spree/admin/shared/update_order_state' if @order %> +<%= render partial: '/spree/admin/shared/update_order_state' if @order %> diff --git a/backend/app/views/spree/admin/shared/_edit_resource_links.html.erb b/backend/app/views/spree/admin/shared/_edit_resource_links.html.erb index 566148aff35..0ece7311148 100644 --- a/backend/app/views/spree/admin/shared/_edit_resource_links.html.erb +++ b/backend/app/views/spree/admin/shared/_edit_resource_links.html.erb @@ -1,5 +1,5 @@
      <%= button Spree.t('actions.update'), 'refresh', 'submit', {class: 'btn-success'} %> <%= Spree.t(:or) %> - <%= button_link_to Spree.t('actions.cancel'), collection_url, :icon => 'delete' %> + <%= button_link_to Spree.t('actions.cancel'), collection_url, icon: 'delete' %>
      diff --git a/backend/app/views/spree/admin/shared/_head.html.erb b/backend/app/views/spree/admin/shared/_head.html.erb index 33e4e2c8488..14229c782d1 100644 --- a/backend/app/views/spree/admin/shared/_head.html.erb +++ b/backend/app/views/spree/admin/shared/_head.html.erb @@ -9,7 +9,7 @@ <%= yield :title %> <% else %> <%= "Spree #{Spree.t('administration')}: " %> - <%= Spree.t(controller.controller_name, :default => controller.controller_name.titleize) %> + <%= Spree.t(controller.controller_name, default: controller.controller_name.titleize) %> <% end %> diff --git a/backend/app/views/spree/admin/shared/_new_resource_links.html.erb b/backend/app/views/spree/admin/shared/_new_resource_links.html.erb index ca8ceef71d6..69357e8f6fb 100644 --- a/backend/app/views/spree/admin/shared/_new_resource_links.html.erb +++ b/backend/app/views/spree/admin/shared/_new_resource_links.html.erb @@ -1,5 +1,5 @@
      <%= button Spree.t('actions.create'), 'ok', 'submit', {class: 'btn-success'} %> <%= Spree.t(:or) %> - <%= button_link_to Spree.t('actions.cancel'), collection_url, :icon => 'remove' %> + <%= button_link_to Spree.t('actions.cancel'), collection_url, icon: 'remove' %>
      diff --git a/backend/app/views/spree/admin/shared/_order_summary.html.erb b/backend/app/views/spree/admin/shared/_order_summary.html.erb index 0da22771d4e..5598addd219 100644 --- a/backend/app/views/spree/admin/shared/_order_summary.html.erb +++ b/backend/app/views/spree/admin/shared/_order_summary.html.erb @@ -11,7 +11,7 @@
      @@ -71,7 +71,7 @@ @@ -81,7 +81,7 @@ diff --git a/backend/app/views/spree/admin/shared/_refunds.html.erb b/backend/app/views/spree/admin/shared/_refunds.html.erb index cce1d01e2e1..83841d3a1dc 100644 --- a/backend/app/views/spree/admin/shared/_refunds.html.erb +++ b/backend/app/views/spree/admin/shared/_refunds.html.erb @@ -23,7 +23,7 @@ <% if show_actions %> <% end %> diff --git a/backend/app/views/spree/admin/shared/_report_order_criteria.html.erb b/backend/app/views/spree/admin/shared/_report_order_criteria.html.erb index 32396b16164..56e672f61e5 100644 --- a/backend/app/views/spree/admin/shared/_report_order_criteria.html.erb +++ b/backend/app/views/spree/admin/shared/_report_order_criteria.html.erb @@ -1,12 +1,12 @@ -<%= search_form_for @search, :url => spree.sales_total_admin_reports_path do |s| %> +<%= search_form_for @search, url: spree.sales_total_admin_reports_path do |s| %>
      <%= label_tag nil, Spree.t(:date_range) %>
      - <%= s.text_field :completed_at_gt, :class => 'datepicker datepicker-from form-control', :value => datepicker_field_value(params[:q][:completed_at_gt]) %> + <%= s.text_field :completed_at_gt, class: 'datepicker datepicker-from form-control', value: datepicker_field_value(params[:q][:completed_at_gt]) %>
      - <%= s.text_field :completed_at_lt, :class => 'datepicker datepicker-to form-control', :value => datepicker_field_value(params[:q][:completed_at_lt]) %> + <%= s.text_field :completed_at_lt, class: 'datepicker datepicker-to form-control', value: datepicker_field_value(params[:q][:completed_at_lt]) %>
      diff --git a/backend/app/views/spree/admin/shared/_translations.html.erb b/backend/app/views/spree/admin/shared/_translations.html.erb index ba3156c4b8d..b14017eaae0 100644 --- a/backend/app/views/spree/admin/shared/_translations.html.erb +++ b/backend/app/views/spree/admin/shared/_translations.html.erb @@ -1,45 +1,40 @@ diff --git a/backend/app/views/spree/admin/shared/_update_order_state.js b/backend/app/views/spree/admin/shared/_update_order_state.js index 32b2d4d574f..d6e32802441 100644 --- a/backend/app/views/spree/admin/shared/_update_order_state.js +++ b/backend/app/views/spree/admin/shared/_update_order_state.js @@ -1,7 +1,7 @@ -$('#order_tab_summary h5#order_status').html('<%= j Spree.t(:status) %>: <%= j Spree.t(@order.state, :scope => :order_state) %>'); +$('#order_tab_summary h5#order_status').html('<%= j Spree.t(:status) %>: <%= j Spree.t(@order.state, scope: :order_state) %>'); $('#order_tab_summary h5#order_total').html('<%= j Spree.t(:total) %>: <%= j @order.display_total.to_html %>'); <% if @order.completed? %> - $('#order_tab_summary h5#payment_status').html('<%= j Spree.t(:payment) %>: <%= j Spree.t(@order.payment_state, :scope => :payment_states, :default => [:missing, "none"]) %>'); - $('#order_tab_summary h5#shipment_status').html('<%= j Spree.t(:shipment) %>: <%= j Spree.t(@order.shipment_state, :scope => :shipment_state, :default => [:missing, "none"]) %>'); + $('#order_tab_summary h5#payment_status').html('<%= j Spree.t(:payment) %>: <%= j Spree.t(@order.payment_state, scope: :payment_states, default: [:missing, "none"]) %>'); + $('#order_tab_summary h5#shipment_status').html('<%= j Spree.t(:shipment) %>: <%= j Spree.t(@order.shipment_state, scope: :shipment_state, default: [:missing, "none"]) %>'); <% end %> diff --git a/backend/app/views/spree/admin/shared/named_types/_index.html.erb b/backend/app/views/spree/admin/shared/named_types/_index.html.erb index ed7eaecd18e..de34554d13d 100644 --- a/backend/app/views/spree/admin/shared/named_types/_index.html.erb +++ b/backend/app/views/spree/admin/shared/named_types/_index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to new_button_text, new_object_url, { icon: 'add', id: 'admin_new_named_type', :class => "btn-success" } %> + <%= button_link_to new_button_text, new_object_url, { icon: 'add', id: 'admin_new_named_type', class: "btn-success" } %> <% end if can? :create, resource %> <% if @collection.any? %> diff --git a/backend/app/views/spree/admin/shared/sub_menu/_product.html.erb b/backend/app/views/spree/admin/shared/sub_menu/_product.html.erb index b788be1a1eb..37a856d86bf 100644 --- a/backend/app/views/spree/admin/shared/sub_menu/_product.html.erb +++ b/backend/app/views/spree/admin/shared/sub_menu/_product.html.erb @@ -1,6 +1,6 @@ <% end %> diff --git a/backend/app/views/spree/admin/shipping_categories/new.html.erb b/backend/app/views/spree/admin/shipping_categories/new.html.erb index fdaa9013438..33ebae42e5a 100644 --- a/backend/app/views/spree/admin/shipping_categories/new.html.erb +++ b/backend/app/views/spree/admin/shipping_categories/new.html.erb @@ -3,11 +3,11 @@ <%= Spree.t(:new_shipping_category) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @shipping_category } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @shipping_category } %> <%= form_for [:admin, @shipping_category] do |f| %>
      - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
      <% end %> diff --git a/backend/app/views/spree/admin/shipping_methods/_form.html.erb b/backend/app/views/spree/admin/shipping_methods/_form.html.erb index fa2e6561464..1eac5014075 100644 --- a/backend/app/views/spree/admin/shipping_methods/_form.html.erb +++ b/backend/app/views/spree/admin/shipping_methods/_form.html.erb @@ -1,17 +1,17 @@
      - <%= f.field_container :name, :class => ['form-group'] do %> + <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name, Spree.t(:name) %> - <%= f.text_field :name, :class => 'form-control' %> + <%= f.text_field :name, class: 'form-control' %> <%= f.error_message_on :name %> <% end %>
      - <%= f.field_container :display_on, :class => ['form-group'] do %> + <%= f.field_container :display_on, class: ['form-group'] do %> <%= f.label :display_on, Spree.t(:display) %> - <%= select(:shipping_method, :display_on, Spree::ShippingMethod::DISPLAY.collect { |display| [Spree.t(display), display == :both ? nil : display.to_s] }, {}, { :class => 'select2' }) %> + <%= select(:shipping_method, :display_on, Spree::ShippingMethod::DISPLAY.collect { |display| [Spree.t(display), display == :both ? nil : display.to_s] }, {}, { class: 'select2' }) %> <%= f.error_message_on :display_on %> <% end %>
      @@ -19,25 +19,25 @@
      - <%= f.field_container :admin_name, :class => ['form-group'] do %> + <%= f.field_container :admin_name, class: ['form-group'] do %> <%= f.label :admin_name, Spree.t(:internal_name) %> - <%= f.text_field :admin_name, :class => 'form-control', :label => false %> + <%= f.text_field :admin_name, class: 'form-control', label: false %> <%= f.error_message_on :admin_name %> <% end %>
      - <%= f.field_container :code, :class => ['form-group'] do %> + <%= f.field_container :code, class: ['form-group'] do %> <%= f.label :code, Spree.t(:code) %> - <%= f.text_field :code, :class => 'form-control', :label => false %> + <%= f.text_field :code, class: 'form-control', label: false %> <%= f.error_message_on :code %> <% end %>
      - <%= f.field_container :tracking_url, :class => ['form-group'] do %> + <%= f.field_container :tracking_url, class: ['form-group'] do %> <%= f.label :tracking_url, Spree.t(:tracking_url) %> - <%= f.text_field :tracking_url, :class => 'form-control', :placeholder => Spree.t(:tracking_url_placeholder) %> + <%= f.text_field :tracking_url, class: 'form-control', placeholder: Spree.t(:tracking_url_placeholder) %> <%= f.error_message_on :tracking_url %> <% end %>
      @@ -54,7 +54,7 @@
      - <%= f.field_container :categories, :class => ['form-group'] do %> + <%= f.field_container :categories, class: ['form-group'] do %> <% Spree::ShippingCategory.all.each do |category| %>
      <%= label_tag do %> @@ -78,7 +78,7 @@
      - <%= f.field_container :zones, :class => ['form-group'] do %> + <%= f.field_container :zones, class: ['form-group'] do %> <% shipping_method_zones = @shipping_method.zones.to_a %> <% Spree::Zone.all.each do |zone| %>
      @@ -97,7 +97,7 @@
      - <%= render :partial => 'spree/admin/shared/calculator_fields', :locals => { :f => f } %> + <%= render partial: 'spree/admin/shared/calculator_fields', locals: { f: f } %>
      @@ -109,7 +109,7 @@
      - <%= f.field_container :categories, :class => ['form-group'] do %> + <%= f.field_container :categories, class: ['form-group'] do %> <%= f.select :tax_category_id, @tax_categories.map { |tc| [tc.name, tc.id] }, { include_blank: true }, class: "select2" %> <%= f.error_message_on :tax_category_id %> <% end %> diff --git a/backend/app/views/spree/admin/shipping_methods/edit.html.erb b/backend/app/views/spree/admin/shipping_methods/edit.html.erb index dce2739e01b..6b48a692218 100644 --- a/backend/app/views/spree/admin/shipping_methods/edit.html.erb +++ b/backend/app/views/spree/admin/shipping_methods/edit.html.erb @@ -4,14 +4,14 @@ <% end %>
      - <%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @shipping_method } %> + <%= render partial: 'spree/admin/shared/error_messages', locals: { target: @shipping_method } %>
      <%= form_for [:admin, @shipping_method] do |f| %> - <%= render :partial => 'form', :locals => { :f => f } %> + <%= render partial: 'form', locals: { f: f } %>
      - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
      <% end %>
      diff --git a/backend/app/views/spree/admin/shipping_methods/index.html.erb b/backend/app/views/spree/admin/shipping_methods/index.html.erb index a3de18280da..c57188c94df 100644 --- a/backend/app/views/spree/admin/shipping_methods/index.html.erb +++ b/backend/app/views/spree/admin/shipping_methods/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_shipping_method), new_object_url, :class => "btn-success", :icon => 'add', :id => 'admin_new_shipping_method_link' %> + <%= button_link_to Spree.t(:new_shipping_method), new_object_url, class: "btn-success", icon: 'add', id: 'admin_new_shipping_method_link' %> <% end if can? :create, Spree::ShippingMethod %> <% if @shipping_methods.any? %> @@ -25,8 +25,8 @@
      <% end %> diff --git a/backend/app/views/spree/admin/shipping_methods/new.html.erb b/backend/app/views/spree/admin/shipping_methods/new.html.erb index d4a4becd89c..86128aaeef7 100644 --- a/backend/app/views/spree/admin/shipping_methods/new.html.erb +++ b/backend/app/views/spree/admin/shipping_methods/new.html.erb @@ -4,16 +4,16 @@ <% end %>
      - <%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @shipping_method } %> + <%= render partial: 'spree/admin/shared/error_messages', locals: { target: @shipping_method } %>
      <%= form_for [:admin, @shipping_method] do |f| %>
      - <%= render :partial => 'form', :locals => { :f => f } %> + <%= render partial: 'form', locals: { f: f } %>
      - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
      <% end %> diff --git a/backend/app/views/spree/admin/states/_form.html.erb b/backend/app/views/spree/admin/states/_form.html.erb index b9bd1b55aa9..0acc587133e 100644 --- a/backend/app/views/spree/admin/states/_form.html.erb +++ b/backend/app/views/spree/admin/states/_form.html.erb @@ -2,14 +2,14 @@
      <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name, Spree.t(:name) %> - <%= f.text_field :name, :class => 'form-control' %> + <%= f.text_field :name, class: 'form-control' %> <%= f.error_message_on :name %> <% end %>
      <%= f.field_container :abbr, class: ['form-group'] do %> <%= f.label :abbr, Spree.t(:abbreviation) %> - <%= f.text_field :abbr, :class => 'form-control' %> + <%= f.text_field :abbr, class: 'form-control' %> <% end %>
      diff --git a/backend/app/views/spree/admin/states/_state_list.html.erb b/backend/app/views/spree/admin/states/_state_list.html.erb index f395ef967e6..95002cba5dc 100644 --- a/backend/app/views/spree/admin/states/_state_list.html.erb +++ b/backend/app/views/spree/admin/states/_state_list.html.erb @@ -14,8 +14,8 @@ <% end %> diff --git a/backend/app/views/spree/admin/states/edit.html.erb b/backend/app/views/spree/admin/states/edit.html.erb index 31bfca57716..c9b490dc188 100644 --- a/backend/app/views/spree/admin/states/edit.html.erb +++ b/backend/app/views/spree/admin/states/edit.html.erb @@ -3,11 +3,11 @@ <%= @state.name %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @state } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @state } %> <%= form_for [:admin, @country, @state] do |f| %>
      - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
      <% end %> diff --git a/backend/app/views/spree/admin/states/index.html.erb b/backend/app/views/spree/admin/states/index.html.erb index d8d795d875d..9233cc5dc5f 100644 --- a/backend/app/views/spree/admin/states/index.html.erb +++ b/backend/app/views/spree/admin/states/index.html.erb @@ -3,16 +3,16 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_state), new_admin_country_state_url(@country), { :class => "btn-success", :icon => 'add', :id => 'new_state_link' } %> + <%= button_link_to Spree.t(:new_state), new_admin_country_state_url(@country), { class: "btn-success", icon: 'add', id: 'new_state_link' } %> <% end if can? :create, Spree::State %>
      <%= label_tag :country, Spree.t(:country) %> - <%= options_from_collection_for_select(@countries, :id, :name, @country.id) %>
      - <%= render :partial => 'state_list'%> + <%= render partial: 'state_list'%>
      diff --git a/backend/app/views/spree/admin/states/new.html.erb b/backend/app/views/spree/admin/states/new.html.erb index cd36a601bf4..a3372dace53 100644 --- a/backend/app/views/spree/admin/states/new.html.erb +++ b/backend/app/views/spree/admin/states/new.html.erb @@ -1,4 +1,4 @@ -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @state } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @state } %> <% content_for :page_title do %> <%= link_to Spree.t(:states), spree.admin_country_states_url(@country) %> / @@ -7,7 +7,7 @@ <%= form_for [:admin, @country, @state] do |f| %>
      - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
      <% end %> diff --git a/backend/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb b/backend/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb index 647774a75eb..37a16632c95 100644 --- a/backend/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb +++ b/backend/app/views/spree/admin/stock_locations/_transfer_stock_form.html.erb @@ -33,7 +33,7 @@
      <%= button Spree.t(:transfer_stock), 'plus' %> <%= Spree.t(:or) %> - <%= button_link_to Spree.t('actions.cancel'), collection_url, :icon => 'delete' %> + <%= button_link_to Spree.t('actions.cancel'), collection_url, icon: 'delete' %>
      <% end %> diff --git a/backend/app/views/spree/admin/stock_locations/edit.html.erb b/backend/app/views/spree/admin/stock_locations/edit.html.erb index f4834f22c2d..e89acd727dc 100644 --- a/backend/app/views/spree/admin/stock_locations/edit.html.erb +++ b/backend/app/views/spree/admin/stock_locations/edit.html.erb @@ -3,11 +3,11 @@ <%= @stock_location.name %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @stock_location } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @stock_location } %> <%= form_for [:admin, @stock_location] do |f| %>
      - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
      <% end %> diff --git a/backend/app/views/spree/admin/stock_locations/index.html.erb b/backend/app/views/spree/admin/stock_locations/index.html.erb index 4ccafcb36ac..77f13dfbe0e 100644 --- a/backend/app/views/spree/admin/stock_locations/index.html.erb +++ b/backend/app/views/spree/admin/stock_locations/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_stock_location), new_object_url, { :class => "btn-success", :icon => 'add', :id => 'admin_new_stock_location' } %> + <%= button_link_to Spree.t(:new_stock_location), new_object_url, { class: "btn-success", icon: 'add', id: 'admin_new_stock_location' } %> <% end if can? :create, Spree::StockLocation %> <% if @stock_locations.any? %> @@ -26,8 +26,8 @@ <% end %> diff --git a/backend/app/views/spree/admin/stock_locations/new.html.erb b/backend/app/views/spree/admin/stock_locations/new.html.erb index 55766cc281a..a5de1c7765d 100644 --- a/backend/app/views/spree/admin/stock_locations/new.html.erb +++ b/backend/app/views/spree/admin/stock_locations/new.html.erb @@ -3,11 +3,11 @@ <%= Spree.t(:new_stock_location) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @stock_location } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @stock_location } %> <%= form_for [:admin, @stock_location] do |f| %>
      - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
      <% end %> diff --git a/backend/app/views/spree/admin/stock_transfers/index.html.erb b/backend/app/views/spree/admin/stock_transfers/index.html.erb index e02a16cde9d..407edc15df8 100644 --- a/backend/app/views/spree/admin/stock_transfers/index.html.erb +++ b/backend/app/views/spree/admin/stock_transfers/index.html.erb @@ -3,13 +3,13 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_stock_transfer), new_admin_stock_transfer_path, { :icon => 'add', :class => 'btn-success' } %> + <%= button_link_to Spree.t(:new_stock_transfer), new_admin_stock_transfer_path, { icon: 'add', class: 'btn-success' } %> <% end if can? :create, Spree::StockTransfer %>
      <%= Spree.t(:search) %> - <%= search_form_for @q, :url => admin_stock_transfers_path do |f| %> + <%= search_form_for @q, url: admin_stock_transfers_path do |f| %>
      @@ -66,7 +66,7 @@
      <% end %> diff --git a/backend/app/views/spree/admin/stock_transfers/new.html.erb b/backend/app/views/spree/admin/stock_transfers/new.html.erb index 7105ce8c1f5..58b1fcb0212 100644 --- a/backend/app/views/spree/admin/stock_transfers/new.html.erb +++ b/backend/app/views/spree/admin/stock_transfers/new.html.erb @@ -19,7 +19,7 @@ {{/each}} -<%= form_tag admin_stock_transfers_path, :method => :post do %> +<%= form_tag admin_stock_transfers_path, method: :post do %>

      diff --git a/backend/app/views/spree/admin/stock_transfers/show.html.erb b/backend/app/views/spree/admin/stock_transfers/show.html.erb index 5b642e65df2..c2a1b09754d 100644 --- a/backend/app/views/spree/admin/stock_transfers/show.html.erb +++ b/backend/app/views/spree/admin/stock_transfers/show.html.erb @@ -4,7 +4,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_stock_transfer), new_admin_stock_transfer_path, { :icon => 'add', :class => 'btn-success' } %> + <%= button_link_to Spree.t(:new_stock_transfer), new_admin_stock_transfer_path, { icon: 'add', class: 'btn-success' } %> <% end if can? :create, Spree::StockTransfer %>
      @@ -28,7 +28,7 @@ <%= Spree.t(:source) %> / <%= @stock_transfer.source_location.name %> - <%= render :partial => 'stock_movements', :object => @stock_transfer.source_movements %> + <%= render partial: 'stock_movements', object: @stock_transfer.source_movements %>
      <% end %> @@ -37,7 +37,7 @@ <%= Spree.t(:destination) %> / <%= @stock_transfer.destination_location.name %> - <%= render :partial => 'stock_movements', :object => @stock_transfer.destination_movements %> + <%= render partial: 'stock_movements', object: @stock_transfer.destination_movements %> <% end %> diff --git a/backend/app/views/spree/admin/tax_categories/_form.html.erb b/backend/app/views/spree/admin/tax_categories/_form.html.erb index 790a6a5cbd5..81b6e71247c 100644 --- a/backend/app/views/spree/admin/tax_categories/_form.html.erb +++ b/backend/app/views/spree/admin/tax_categories/_form.html.erb @@ -1,21 +1,21 @@
      - <%= f.field_container :name, :class => ['form-group'] do %> + <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name, Spree.t(:name) %> - <%= f.text_field :name, :class => 'form-control' %> + <%= f.text_field :name, class: 'form-control' %> <%= f.error_message_on :name %> <% end %> - <%= f.field_container :tax_code, :class => ['form-group'] do %> + <%= f.field_container :tax_code, class: ['form-group'] do %> <%= f.label :tax_code, Spree.t(:tax_code) %> - <%= f.text_field :tax_code, :class => 'form-control' %> + <%= f.text_field :tax_code, class: 'form-control' %> <% end %> - <%= f.field_container :description, :class => ['form-group'] do %> + <%= f.field_container :description, class: ['form-group'] do %> <%= f.label :description, Spree.t(:description) %>
      - <%= f.text_field :description, :class => 'form-control' %> + <%= f.text_field :description, class: 'form-control' %> <% end %> - <%= f.field_container :is_default, :class => ['checkbox'] do %> + <%= f.field_container :is_default, class: ['checkbox'] do %> <%= f.label :is_default do %> <%= f.check_box :is_default %> <%= Spree.t(:default) %> diff --git a/backend/app/views/spree/admin/tax_categories/edit.html.erb b/backend/app/views/spree/admin/tax_categories/edit.html.erb index a02102b94aa..bad4abdc13c 100644 --- a/backend/app/views/spree/admin/tax_categories/edit.html.erb +++ b/backend/app/views/spree/admin/tax_categories/edit.html.erb @@ -3,11 +3,11 @@ <%= @tax_category.name %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @tax_category } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @tax_category } %> <%= form_for [:admin, @tax_category] do |f| %>
      - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
      <% end %> diff --git a/backend/app/views/spree/admin/tax_categories/new.html.erb b/backend/app/views/spree/admin/tax_categories/new.html.erb index a35bd4bf163..5210e65e881 100644 --- a/backend/app/views/spree/admin/tax_categories/new.html.erb +++ b/backend/app/views/spree/admin/tax_categories/new.html.erb @@ -3,11 +3,11 @@ <%= Spree.t(:new_tax_category) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @tax_category } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @tax_category } %> <%= form_for [:admin, @tax_category] do |f| %>
      - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
      <% end %> diff --git a/backend/app/views/spree/admin/tax_rates/_form.html.erb b/backend/app/views/spree/admin/tax_rates/_form.html.erb index 5f3c7facc0c..42a98eba202 100644 --- a/backend/app/views/spree/admin/tax_rates/_form.html.erb +++ b/backend/app/views/spree/admin/tax_rates/_form.html.erb @@ -10,12 +10,12 @@
      <%= f.label :name, Spree.t(:name) %> - <%= f.text_field :name, :class => 'form-control' %> + <%= f.text_field :name, class: 'form-control' %>
      <%= f.field_container :amount, class: ["form-group"] do %> <%= f.label :amount, Spree.t(:rate) %> - <%= f.text_field :amount, :class => 'form-control' %> + <%= f.text_field :amount, class: 'form-control' %> <%= f.error_message_on :amount %> <% end %>

      @@ -33,11 +33,11 @@

      <%= f.label :zone, Spree.t(:zone) %> - <%= f.collection_select(:zone_id, @available_zones, :id, :name, {}, {:class => 'select2'}) %> + <%= f.collection_select(:zone_id, @available_zones, :id, :name, {}, {class: 'select2'}) %>
      <%= f.label :tax_category_id, Spree.t(:tax_category) %> - <%= f.collection_select(:tax_category_id, @available_categories,:id, :name, {}, {:class => 'select2'}) %> + <%= f.collection_select(:tax_category_id, @available_categories,:id, :name, {}, {class: 'select2'}) %>
      <%= f.label :show_rate_in_label do %> @@ -51,4 +51,4 @@
      -<%= render 'spree/admin/shared/calculator_fields', :f => f %> +<%= render 'spree/admin/shared/calculator_fields', f: f %> diff --git a/backend/app/views/spree/admin/tax_rates/edit.html.erb b/backend/app/views/spree/admin/tax_rates/edit.html.erb index 87c779f4d3e..5fd76792d53 100644 --- a/backend/app/views/spree/admin/tax_rates/edit.html.erb +++ b/backend/app/views/spree/admin/tax_rates/edit.html.erb @@ -3,9 +3,9 @@ <%= @tax_rate.name %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @tax_rate } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @tax_rate } %> <%= form_for [:admin, @tax_rate] do |f| %> - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %> <% end %> diff --git a/backend/app/views/spree/admin/tax_rates/new.html.erb b/backend/app/views/spree/admin/tax_rates/new.html.erb index f13d020bc89..3900f3a99a4 100644 --- a/backend/app/views/spree/admin/tax_rates/new.html.erb +++ b/backend/app/views/spree/admin/tax_rates/new.html.erb @@ -3,12 +3,12 @@ <%= Spree.t(:new_tax_rate) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @tax_rate } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @tax_rate } %> <%= form_for [:admin, @tax_rate] do |f| %>
      - <%= render :partial => 'form', :locals => { :f => f } %> + <%= render partial: 'form', locals: { f: f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
      <% end %> diff --git a/backend/app/views/spree/admin/taxonomies/_form.html.erb b/backend/app/views/spree/admin/taxonomies/_form.html.erb index d91b9da817d..2add6481222 100644 --- a/backend/app/views/spree/admin/taxonomies/_form.html.erb +++ b/backend/app/views/spree/admin/taxonomies/_form.html.erb @@ -1,7 +1,7 @@
      <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name, Spree.t(:name) %> * - <%= f.text_field :name, :class => 'form-control' %> - <%= f.error_message_on :name, :class => 'error-message' %> + <%= f.text_field :name, class: 'form-control' %> + <%= f.error_message_on :name, class: 'error-message' %> <% end %>
      diff --git a/backend/app/views/spree/admin/taxonomies/new.html.erb b/backend/app/views/spree/admin/taxonomies/new.html.erb index c7795256fd2..08a2a2b5c10 100644 --- a/backend/app/views/spree/admin/taxonomies/new.html.erb +++ b/backend/app/views/spree/admin/taxonomies/new.html.erb @@ -2,7 +2,7 @@ <%= link_to Spree.t(:taxonomies), spree.admin_taxonomies_url %> / <%= Spree.t(:new_taxonomy) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @taxonomy } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @taxonomy } %> <%= form_for [:admin, @taxonomy] do |f| %>
      diff --git a/backend/app/views/spree/admin/taxons/_form.html.erb b/backend/app/views/spree/admin/taxons/_form.html.erb index 782c4262ea0..a0ae3c4d1c2 100644 --- a/backend/app/views/spree/admin/taxons/_form.html.erb +++ b/backend/app/views/spree/admin/taxons/_form.html.erb @@ -3,13 +3,13 @@
      <%= f.field_container :name, class: ['form-group'] do %> <%= f.label :name, Spree.t(:name) %> * - <%= text_field :taxon, :name, :class => 'form-control' %> - <%= f.error_message_on :name, :class => 'error-message' %> + <%= text_field :taxon, :name, class: 'form-control' %> + <%= f.error_message_on :name, class: 'error-message' %> <% end %> <%= f.field_container :permalink_part, class: ['form-group'] do %> <%= f.label :permalink_part, Spree.t(:permalink) %> * - <%= text_field_tag :permalink_part, @permalink_part, :class => 'form-control' %> + <%= text_field_tag :permalink_part, @permalink_part, class: 'form-control' %> @@ -24,23 +24,23 @@
      <%= f.field_container :description, class: ['form-group'] do %> <%= f.label :description, Spree.t(:description) %> - <%= f.text_area :description, :class => 'form-control', :rows => 6 %> + <%= f.text_area :description, class: 'form-control', rows: 6 %> <% end %>
      <%= f.field_container :meta_title, class: ['form-group'] do %> <%= f.label :meta_title, Spree.t(:meta_title) %> - <%= f.text_field :meta_title, :class => 'form-control', :rows => 6 %> + <%= f.text_field :meta_title, class: 'form-control', rows: 6 %> <% end %> <%= f.field_container :meta_description, class: ['form-group'] do %> <%= f.label :meta_description, Spree.t(:meta_description) %> - <%= f.text_field :meta_description, :class => 'form-control', :rows => 6 %> + <%= f.text_field :meta_description, class: 'form-control', rows: 6 %> <% end %> <%= f.field_container :meta_keywords, class: ['form-group'] do %> <%= f.label :meta_keywords, Spree.t(:meta_keywords) %> - <%= f.text_field :meta_keywords, :class => 'form-control', :rows => 6 %> + <%= f.text_field :meta_keywords, class: 'form-control', rows: 6 %> <% end %>
      diff --git a/backend/app/views/spree/admin/taxons/_taxon_table.html.erb b/backend/app/views/spree/admin/taxons/_taxon_table.html.erb index cdd239477c6..b14263750f2 100644 --- a/backend/app/views/spree/admin/taxons/_taxon_table.html.erb +++ b/backend/app/views/spree/admin/taxons/_taxon_table.html.erb @@ -12,7 +12,7 @@

      <% end %> diff --git a/backend/app/views/spree/admin/taxons/index.html.erb b/backend/app/views/spree/admin/taxons/index.html.erb index b835d407693..30027bff16d 100644 --- a/backend/app/views/spree/admin/taxons/index.html.erb +++ b/backend/app/views/spree/admin/taxons/index.html.erb @@ -9,5 +9,5 @@
        - <%= render :partial => "spree/admin/products/autocomplete", :formats => :js %> + <%= render partial: "spree/admin/products/autocomplete", formats: :js %> diff --git a/backend/app/views/spree/admin/trackers/_form.html.erb b/backend/app/views/spree/admin/trackers/_form.html.erb index e6d93c4d691..8baed4858e8 100644 --- a/backend/app/views/spree/admin/trackers/_form.html.erb +++ b/backend/app/views/spree/admin/trackers/_form.html.erb @@ -2,7 +2,7 @@
        <%= f.field_container :analytics_id, class: ["form-group"], "data-hook" => "analytics_id" do %> <%= f.label :analytics_id, Spree.t(:google_analytics_id) %> - <%= f.text_field :analytics_id, :class => 'form-control' %> + <%= f.text_field :analytics_id, class: 'form-control' %> <%= f.error_message_on :analytics_id %> <% end %>
        diff --git a/backend/app/views/spree/admin/trackers/edit.html.erb b/backend/app/views/spree/admin/trackers/edit.html.erb index 1829515fd98..21e7de74ece 100644 --- a/backend/app/views/spree/admin/trackers/edit.html.erb +++ b/backend/app/views/spree/admin/trackers/edit.html.erb @@ -3,11 +3,11 @@ <%= @tracker.analytics_id %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @tracker } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @tracker } %> <%= form_for [:admin, @tracker] do |f| %>
        - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %>
        <% end %> diff --git a/backend/app/views/spree/admin/trackers/index.html.erb b/backend/app/views/spree/admin/trackers/index.html.erb index bf901201132..e932da6e7c8 100644 --- a/backend/app/views/spree/admin/trackers/index.html.erb +++ b/backend/app/views/spree/admin/trackers/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_tracker), new_object_url, :class => "btn-success", :icon => 'add', :id => 'admin_new_tracker_link' %> + <%= button_link_to Spree.t(:new_tracker), new_object_url, class: "btn-success", icon: 'add', id: 'admin_new_tracker_link' %> <% end if can? :create, Spree::Tracker %> <% if @trackers.any? %> @@ -27,8 +27,8 @@ <% end %> diff --git a/backend/app/views/spree/admin/trackers/new.html.erb b/backend/app/views/spree/admin/trackers/new.html.erb index c87df22107b..bd57992354f 100644 --- a/backend/app/views/spree/admin/trackers/new.html.erb +++ b/backend/app/views/spree/admin/trackers/new.html.erb @@ -3,11 +3,11 @@ <%= Spree.t(:new_tracker) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @tracker } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @tracker } %> <%= form_for [:admin, @tracker] do |f| %>
        - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
        <% end %> diff --git a/backend/app/views/spree/admin/users/_addresses_form.html.erb b/backend/app/views/spree/admin/users/_addresses_form.html.erb index df01f8c2d80..94f4514bc42 100644 --- a/backend/app/views/spree/admin/users/_addresses_form.html.erb +++ b/backend/app/views/spree/admin/users/_addresses_form.html.erb @@ -10,7 +10,7 @@
        <%= f.fields_for :bill_address, (@user.bill_address || Spree::Address.default(@user, "bill")) do |ba_form| %> <% ba_form.object ||= Spree::Address.new(country: Spree::Country.new) %> - <%= render :partial => 'spree/admin/shared/address_form', :locals => { :f => ba_form, :type => "billing" } %> + <%= render partial: 'spree/admin/shared/address_form', locals: { f: ba_form, type: "billing" } %> <% end %>
        @@ -27,7 +27,7 @@
        <%= f.fields_for :ship_address, (@user.ship_address || Spree::Address.default(@user, "ship")) do |sa_form| %> <% sa_form.object ||= Spree::Address.new(country: Spree::Country.new) %> - <%= render :partial => 'spree/admin/shared/address_form', :locals => { :f => sa_form, :type => "shipping" } %> + <%= render partial: 'spree/admin/shared/address_form', locals: { f: sa_form, type: "shipping" } %> <% end %>
        diff --git a/backend/app/views/spree/admin/users/_form.html.erb b/backend/app/views/spree/admin/users/_form.html.erb index d2e33e1eced..189949de1de 100644 --- a/backend/app/views/spree/admin/users/_form.html.erb +++ b/backend/app/views/spree/admin/users/_form.html.erb @@ -2,7 +2,7 @@
        <%= f.field_container :email, class: ['form-group'] do %> <%= f.label :email, Spree.t(:email) %> - <%= f.email_field :email, :class => 'form-control' %> + <%= f.email_field :email, class: 'form-control' %> <%= f.error_message_on :email %> <% end %> @@ -23,13 +23,13 @@
        <%= f.field_container :password, class: ['form-group'] do %> <%= f.label :password, Spree.t(:password) %> - <%= f.password_field :password, :class => 'form-control' %> + <%= f.password_field :password, class: 'form-control' %> <%= f.error_message_on :password %> <% end %> <%= f.field_container :password_confirmation, class: ['form-group'] do %> <%= f.label :password_confirmation, Spree.t(:confirm_password) %> - <%= f.password_field :password_confirmation, :class => 'form-control' %> + <%= f.password_field :password_confirmation, class: 'form-control' %> <%= f.error_message_on :password_confirmation %> <% end %>
        diff --git a/backend/app/views/spree/admin/users/index.html.erb b/backend/app/views/spree/admin/users/index.html.erb index fe4701590b1..84f27edb346 100644 --- a/backend/app/views/spree/admin/users/index.html.erb +++ b/backend/app/views/spree/admin/users/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_user), new_admin_user_url, :class => "btn-success", :icon => 'add', :id => 'admin_new_user_link' %> + <%= button_link_to Spree.t(:new_user), new_admin_user_url, class: "btn-success", icon: 'add', id: 'admin_new_user_link' %> <% end %> <% content_for :table_filter_title do %> @@ -21,19 +21,19 @@
        <%= f.label Spree.t(:first_name) %> - <%= f.text_field :bill_address_firstname_cont, :class => 'form-control' %> + <%= f.text_field :bill_address_firstname_cont, class: 'form-control' %>
        <%= f.label Spree.t(:last_name) %> - <%= f.text_field :bill_address_lastname_cont, :class => 'form-control' %> + <%= f.text_field :bill_address_lastname_cont, class: 'form-control' %>
        <%= f.label Spree.t(:company) %> - <%= f.text_field :bill_address_company_cont, :class => 'form-control' %> + <%= f.text_field :bill_address_company_cont, class: 'form-control' %>
        <%= button Spree.t(:search), 'search' %> @@ -46,7 +46,7 @@
        @@ -56,8 +56,8 @@ <% end %> diff --git a/backend/app/views/spree/admin/users/new.html.erb b/backend/app/views/spree/admin/users/new.html.erb index b3c80776b37..7dd22670892 100644 --- a/backend/app/views/spree/admin/users/new.html.erb +++ b/backend/app/views/spree/admin/users/new.html.erb @@ -4,15 +4,15 @@ <% end %>
        - <%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @user } %> + <%= render partial: 'spree/admin/shared/error_messages', locals: { target: @user } %>
        <%= form_for [:admin, @user], url: spree.admin_users_url, method: :post do |f| %> - <%= render :partial => 'form', :locals => { :f => f } %> + <%= render partial: 'form', locals: { f: f } %>
        - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
        <% end %>
        diff --git a/backend/app/views/spree/admin/variants/_form.html.erb b/backend/app/views/spree/admin/variants/_form.html.erb index 05ca7506bab..16f581d7cfe 100644 --- a/backend/app/views/spree/admin/variants/_form.html.erb +++ b/backend/app/views/spree/admin/variants/_form.html.erb @@ -5,28 +5,28 @@
        <%= label :new_variant, option_type.presentation %> <%= f.collection_select 'option_value_ids', option_type.option_values, :id, :presentation, - { :include_blank => true }, { :name => 'variant[option_value_ids][]', :class => 'select2' } %> + { include_blank: true }, { name: 'variant[option_value_ids][]', class: 'select2' } %>
        <% end %>
        <%= f.label :sku, Spree.t(:sku) %> - <%= f.text_field :sku, :class => 'form-control' %> + <%= f.text_field :sku, class: 'form-control' %>
        <%= f.label :price, Spree.t(:price) %> - <%= f.text_field :price, :value => number_to_currency(@variant.price, :unit => ''), :class => 'form-control' %> + <%= f.text_field :price, value: number_to_currency(@variant.price, unit: ''), class: 'form-control' %>
        <%= f.label :cost_price, Spree.t(:cost_price) %> - <%= f.text_field :cost_price, :value => number_to_currency(@variant.cost_price, :unit => ''), :class => 'form-control' %> + <%= f.text_field :cost_price, value: number_to_currency(@variant.cost_price, unit: ''), class: 'form-control' %>
        <%= f.label :tax_category_id, Spree.t(:tax_category) %> - <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, { :include_blank => Spree.t('match_choices.none') }, { :class => 'select2' }) %> + <%= f.collection_select(:tax_category_id, @tax_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2' }) %>
        @@ -41,8 +41,8 @@
        <% [:weight, :height, :width, :depth].each do |field| %>
        <%= f.label field, Spree.t(field) %> - <% value = number_with_precision(@variant.send(field), :precision => 2) %> - <%= f.text_field field, :value => value, :class => 'form-control' %> + <% value = number_with_precision(@variant.send(field), precision: 2) %> + <%= f.text_field field, value: value, class: 'form-control' %>
        <% end %>
        diff --git a/backend/app/views/spree/admin/variants/new.html.erb b/backend/app/views/spree/admin/variants/new.html.erb index 54e6d263095..9bb773bea8a 100644 --- a/backend/app/views/spree/admin/variants/new.html.erb +++ b/backend/app/views/spree/admin/variants/new.html.erb @@ -1,11 +1,11 @@ -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @variant } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @variant } %> <%= form_for [:admin, @product, @variant] do |f| %>
        <%= Spree.t(:new_variant) %> - <%= render :partial => 'form', :locals => { :f => f } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { f: f } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %>
        <% end %> diff --git a/backend/app/views/spree/admin/zones/_country_members.html.erb b/backend/app/views/spree/admin/zones/_country_members.html.erb index a8801d9ea8b..1909df21513 100644 --- a/backend/app/views/spree/admin/zones/_country_members.html.erb +++ b/backend/app/views/spree/admin/zones/_country_members.html.erb @@ -9,7 +9,7 @@
        <%= zone_form.field_container :country_ids, class: ['form-group'] do %> <%= zone_form.label :country_ids, Spree.t(:countries) %> - <%= zone_form.collection_select :country_ids, @countries, :id, :name, {}, { :multiple => true, :class => "select2" } %> + <%= zone_form.collection_select :country_ids, @countries, :id, :name, {}, { multiple: true, class: "select2" } %> <% end %>
        diff --git a/backend/app/views/spree/admin/zones/_form.html.erb b/backend/app/views/spree/admin/zones/_form.html.erb index ca0c87d1c21..5534cf36dd3 100644 --- a/backend/app/views/spree/admin/zones/_form.html.erb +++ b/backend/app/views/spree/admin/zones/_form.html.erb @@ -8,13 +8,13 @@
        <%= zone_form.field_container :name, class: ['form-group'] do %> <%= zone_form.label :name, Spree.t(:name) %> - <%= zone_form.text_field :name, :class => 'form-control' %> + <%= zone_form.text_field :name, class: 'form-control' %> <%= zone_form.error_message_on :name %> <% end %> <%= zone_form.field_container :description, class: ['form-group'] do %> <%= zone_form.label :description, Spree.t(:description) %> - <%= zone_form.text_field :description, :class => 'form-control' %> + <%= zone_form.text_field :description, class: 'form-control' %> <% end %>
        @@ -28,13 +28,13 @@ <%= Spree.t(:type) %>
        <%= label_tag :country_based do %> - <%= zone_form.radio_button('kind', 'country', { :id => 'country_based' }) %> + <%= zone_form.radio_button('kind', 'country', { id: 'country_based' }) %> <%= Spree.t(:country_based) %> <% end %>
        <%= label_tag :state_based do %> - <%= zone_form.radio_button('kind', 'state', { :id => 'state_based' }) %> + <%= zone_form.radio_button('kind', 'state', { id: 'state_based' }) %> <%= Spree.t(:state_based) %> <% end %>
        @@ -43,7 +43,7 @@
        - <%= render :partial => 'state_members', :locals => { :zone_form => zone_form }%> - <%= render :partial => 'country_members', :locals => { :zone_form => zone_form } %> + <%= render partial: 'state_members', locals: { zone_form: zone_form }%> + <%= render partial: 'country_members', locals: { zone_form: zone_form } %>
        diff --git a/backend/app/views/spree/admin/zones/_state_members.html.erb b/backend/app/views/spree/admin/zones/_state_members.html.erb index 598f6a2c91b..ca80ba0f2fc 100644 --- a/backend/app/views/spree/admin/zones/_state_members.html.erb +++ b/backend/app/views/spree/admin/zones/_state_members.html.erb @@ -9,7 +9,7 @@
        <%= zone_form.field_container :state_ids, class: ['form-group'] do %> <%= zone_form.label :state_ids, Spree.t(:states) %> - <%= zone_form.collection_select :state_ids, @states, :id, :name, {}, { :multiple => true, :class => "select2" } %> + <%= zone_form.collection_select :state_ids, @states, :id, :name, {}, { multiple: true, class: "select2" } %> <% end %>
        diff --git a/backend/app/views/spree/admin/zones/edit.html.erb b/backend/app/views/spree/admin/zones/edit.html.erb index 4f9e0808aa4..737859dbfc7 100644 --- a/backend/app/views/spree/admin/zones/edit.html.erb +++ b/backend/app/views/spree/admin/zones/edit.html.erb @@ -3,10 +3,10 @@ <%= @zone.name %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @zone } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @zone } %> <%= form_for [:admin, @zone] do |zone_form| %> - <%= render :partial => 'form', :locals => { :zone_form => zone_form } %> + <%= render partial: 'form', locals: { zone_form: zone_form } %> - <%= render :partial => 'spree/admin/shared/edit_resource_links' %> + <%= render partial: 'spree/admin/shared/edit_resource_links' %> <% end %> diff --git a/backend/app/views/spree/admin/zones/index.html.erb b/backend/app/views/spree/admin/zones/index.html.erb index 0a584616974..9dfb7e092e5 100644 --- a/backend/app/views/spree/admin/zones/index.html.erb +++ b/backend/app/views/spree/admin/zones/index.html.erb @@ -3,7 +3,7 @@ <% end %> <% content_for :page_actions do %> - <%= button_link_to Spree.t(:new_zone), new_object_url, :class => "btn-success", :icon => 'add', :id => 'admin_new_zone_link' %> + <%= button_link_to Spree.t(:new_zone), new_object_url, class: "btn-success", icon: 'add', id: 'admin_new_zone_link' %> <% end if can? :create, Spree::Zone %> <%= paginate @zones %> @@ -12,9 +12,9 @@
        - <%= Spree.t(@order.state, :scope => :order_state) %> + <%= Spree.t(@order.state, scope: :order_state) %>
        - <%= Spree.t(@order.shipment_state, :scope => :shipment_states, :default => [:missing, "none"]) %> + <%= Spree.t(@order.shipment_state, scope: :shipment_states, default: [:missing, "none"]) %>
        - <%= Spree.t(@order.payment_state, :scope => :payment_states, :default => [:missing, "none"]) %> + <%= Spree.t(@order.payment_state, scope: :payment_states, default: [:missing, "none"]) %>
        <%= truncate(refund.reason.name, length: 100) %> - <%= link_to_with_icon('edit', Spree.t(:edit), edit_admin_order_payment_refund_path(refund.payment.order, refund.payment, refund), no_text: true, :class => "btn btn-default btn-sm") if can?(:edit, refund) %> + <%= link_to_with_icon('edit', Spree.t(:edit), edit_admin_order_payment_refund_path(refund.payment.order, refund.payment, refund), no_text: true, class: "btn btn-default btn-sm") if can?(:edit, refund) %>
        <%= shipping_category.name %> - <%= link_to_edit(shipping_category, :no_text => true) if can? :edit, shipping_category %> - <%= link_to_delete(shipping_category, :no_text => true) if can? :edit, shipping_category %> + <%= link_to_edit(shipping_category, no_text: true) if can? :edit, shipping_category %> + <%= link_to_delete(shipping_category, no_text: true) if can? :edit, shipping_category %>
        <%= shipping_method.calculator.description %> <%= shipping_method.display_on.blank? ? Spree.t(:both) : Spree.t(shipping_method.display_on) %> - <%= link_to_edit(shipping_method, :no_text => true) if can? :edit, shipping_method %> - <%= link_to_delete(shipping_method, :no_text => true) if can? :delete, shipping_method %> + <%= link_to_edit(shipping_method, no_text: true) if can? :edit, shipping_method %> + <%= link_to_delete(shipping_method, no_text: true) if can? :delete, shipping_method %>
        <%= state.name %> <%= state.abbr %> - <%= link_to_edit(state, :no_text => true) if can? :edit, state %> - <%= link_to_delete(state, :no_text => true) if can? :delete, state %> + <%= link_to_edit(state, no_text: true) if can? :edit, state %> + <%= link_to_delete(state, no_text: true) if can? :delete, state %>
        <%= Spree.t(state(stock_location)) %> <%= link_to Spree.t(:stock_movements), admin_stock_location_stock_movements_path(stock_location.id) %> - <%= link_to_edit(stock_location, :no_text => true) if can? :create, stock_location %> - <%= link_to_delete(stock_location, :no_text => true) if can? :create, stock_location %> + <%= link_to_edit(stock_location, no_text: true) if can? :create, stock_location %> + <%= link_to_delete(stock_location, no_text: true) if can? :create, stock_location %>
        <%= stock_transfer.source_location.try(:name) %> <%= stock_transfer.destination_location.try(:name) %> - <%= link_to_with_icon 'show', Spree.t(:show), admin_stock_transfer_path(stock_transfer), :class => 'btn btn-default btn-sm', :no_text => true, :data => {:action => 'view'} %> + <%= link_to_with_icon 'show', Spree.t(:show), admin_stock_transfer_path(stock_transfer), class: 'btn btn-default btn-sm', no_text: true, data: {action: 'view'} %>
        <%= taxon.name %> <%= taxon_path taxon %> - <%= link_to_delete taxon, :url => remove_admin_product_taxon_url(@product, taxon), :name => icon('delete') + ' ' + Spree.t(:remove) %> + <%= link_to_delete taxon, url: remove_admin_product_taxon_url(@product, taxon), name: icon('delete') + ' ' + Spree.t(:remove) %>
        <%= tracker.analytics_id %> <%= tracker.active ? Spree.t(:say_yes) : Spree.t(:say_no) %> - <%= link_to_edit(tracker, :no_text => true) if can? :edit, tracker %> - <%= link_to_delete(tracker, :no_text => true) if can? :delete, tracker %> + <%= link_to_edit(tracker, no_text: true) if can? :edit, tracker %> + <%= link_to_delete(tracker, no_text: true) if can? :delete, tracker %>
        - <%= sort_link @search,:email, Spree.t(:user), {}, {:title => 'users_email_title'} %> + <%= sort_link @search,:email, Spree.t(:user), {}, {title: 'users_email_title'} %>
        <%=link_to user.email, edit_admin_user_url(user) %> - <%= link_to_edit user, :no_text => true %> - <%= link_to_delete user, :no_text => true %> + <%= link_to_edit user, no_text: true %> + <%= link_to_delete user, no_text: true %>
        - + @@ -27,8 +27,8 @@ <% end %> diff --git a/backend/app/views/spree/admin/zones/new.html.erb b/backend/app/views/spree/admin/zones/new.html.erb index 1e0d73ad70b..c09e5156d54 100644 --- a/backend/app/views/spree/admin/zones/new.html.erb +++ b/backend/app/views/spree/admin/zones/new.html.erb @@ -3,9 +3,9 @@ <%= Spree.t(:new_zone) %> <% end %> -<%= render :partial => 'spree/admin/shared/error_messages', :locals => { :target => @zone } %> +<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @zone } %> <%= form_for [:admin, @zone] do |zone_form| %> - <%= render :partial => 'form', :locals => { :zone_form => zone_form } %> - <%= render :partial => 'spree/admin/shared/new_resource_links' %> + <%= render partial: 'form', locals: { zone_form: zone_form } %> + <%= render partial: 'spree/admin/shared/new_resource_links' %> <% end %> diff --git a/backend/lib/spree/backend/engine.rb b/backend/lib/spree/backend/engine.rb index 23c15975f7c..59c0c03adc1 100644 --- a/backend/lib/spree/backend/engine.rb +++ b/backend/lib/spree/backend/engine.rb @@ -3,7 +3,7 @@ module Backend class Engine < ::Rails::Engine config.middleware.use "Spree::Backend::Middleware::SeoAssist" - initializer "spree.backend.environment", :before => :load_config_initializers do |app| + initializer "spree.backend.environment", before: :load_config_initializers do |app| Spree::Backend::Config = Spree::BackendConfiguration.new end @@ -13,7 +13,7 @@ class Engine < ::Rails::Engine end # sets the manifests / assets to be precompiled, even when initialize_on_precompile is false - initializer "spree.assets.precompile", :group => :all do |app| + initializer "spree.assets.precompile", group: :all do |app| app.config.assets.paths << "#{Rails.root}/app/assets/fonts" app.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/ diff --git a/backend/spec/controllers/spree/admin/customer_returns_controller_spec.rb b/backend/spec/controllers/spree/admin/customer_returns_controller_spec.rb index 3401c9bee4b..6baa3621477 100644 --- a/backend/spec/controllers/spree/admin/customer_returns_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/customer_returns_controller_spec.rb @@ -2,7 +2,7 @@ module Spree module Admin - describe CustomerReturnsController, :type => :controller do + describe CustomerReturnsController, type: :controller do stub_authorization! describe "#index" do diff --git a/backend/spec/controllers/spree/admin/general_settings_controller_spec.rb b/backend/spec/controllers/spree/admin/general_settings_controller_spec.rb index 158001db8f0..56082b9641b 100644 --- a/backend/spec/controllers/spree/admin/general_settings_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/general_settings_controller_spec.rb @@ -4,7 +4,7 @@ let(:user) { create(:user) } before do - allow(controller).to receive_messages :spree_current_user => user + allow(controller).to receive_messages spree_current_user: user user.spree_roles << Spree::Role.find_or_create_by(name: 'admin') end diff --git a/backend/spec/controllers/spree/admin/missing_products_controller_spec.rb b/backend/spec/controllers/spree/admin/missing_products_controller_spec.rb index f5feee219e7..85db334f0c9 100644 --- a/backend/spec/controllers/spree/admin/missing_products_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/missing_products_controller_spec.rb @@ -4,12 +4,12 @@ # the load_resource filter in Spree::Admin::ResourceController is prepended to the filter chain # this means this call is triggered before the authorize_admin call and in this case # the load_resource filter halts the request meaning authorize_admin is not called at all. -describe Spree::Admin::ProductsController, :type => :controller do +describe Spree::Admin::ProductsController, type: :controller do stub_authorization! # Regression test for GH #538 it "cannot find a non-existent product" do - spree_get :edit, :id => "non-existent-product" + spree_get :edit, id: "non-existent-product" expect(response).to redirect_to(spree.admin_products_path) expect(flash[:error]).to eql("Product is not found") end diff --git a/backend/spec/controllers/spree/admin/payment_methods_controller_spec.rb b/backend/spec/controllers/spree/admin/payment_methods_controller_spec.rb index 9d17207b74c..0ff0e7177f3 100644 --- a/backend/spec/controllers/spree/admin/payment_methods_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/payment_methods_controller_spec.rb @@ -2,18 +2,18 @@ module Spree class GatewayWithPassword < PaymentMethod - preference :password, :string, :default => "password" + preference :password, :string, default: "password" end - describe Admin::PaymentMethodsController, :type => :controller do + describe Admin::PaymentMethodsController, type: :controller do stub_authorization! - let(:payment_method) { GatewayWithPassword.create!(:name => "Bogus", :preferred_password => "haxme") } + let(:payment_method) { GatewayWithPassword.create!(name: "Bogus", preferred_password: "haxme") } # regression test for #2094 it "does not clear password on update" do expect(payment_method.preferred_password).to eq("haxme") - spree_put :update, :id => payment_method.id, :payment_method => { :type => payment_method.class.to_s, :preferred_password => "" } + spree_put :update, id: payment_method.id, payment_method: { type: payment_method.class.to_s, preferred_password: "" } expect(response).to redirect_to(spree.edit_admin_payment_method_path(payment_method)) payment_method.reload @@ -23,14 +23,14 @@ class GatewayWithPassword < PaymentMethod context "tries to save invalid payment" do it "doesn't break, responds nicely" do expect { - spree_post :create, :payment_method => { :name => "", :type => "Spree::Gateway::Bogus" } + spree_post :create, payment_method: { name: "", type: "Spree::Gateway::Bogus" } }.not_to raise_error end end it "can create a payment method of a valid type" do expect { - spree_post :create, :payment_method => { :name => "Test Method", :type => "Spree::Gateway::Bogus" } + spree_post :create, payment_method: { name: "Test Method", type: "Spree::Gateway::Bogus" } }.to change(Spree::PaymentMethod, :count).by(1) expect(response).to be_redirect @@ -39,7 +39,7 @@ class GatewayWithPassword < PaymentMethod it "can not create a payment method of an invalid type" do expect { - spree_post :create, :payment_method => { :name => "Invalid Payment Method", :type => "Spree::InvalidType" } + spree_post :create, payment_method: { name: "Invalid Payment Method", type: "Spree::InvalidType" } }.to change(Spree::PaymentMethod, :count).by(0) expect(response).to be_redirect diff --git a/backend/spec/controllers/spree/admin/payments_controller_spec.rb b/backend/spec/controllers/spree/admin/payments_controller_spec.rb index 8a0cbf10f47..a4a82b4b0de 100644 --- a/backend/spec/controllers/spree/admin/payments_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/payments_controller_spec.rb @@ -2,14 +2,14 @@ module Spree module Admin - describe PaymentsController, :type => :controller do + describe PaymentsController, type: :controller do stub_authorization! let(:order) { create(:order) } context "with a valid credit card" do - let(:order) { create(:order_with_line_items, :state => "payment") } - let(:payment_method) { create(:credit_card_payment_method, :display_on => "back_end") } + let(:order) { create(:order_with_line_items, state: "payment") } + let(:payment_method) { create(:credit_card_payment_method, display_on: "back_end") } before do attributes = { @@ -44,11 +44,11 @@ module Admin # Regression test for #3233 context "with a backend payment method" do before do - @payment_method = create(:check_payment_method, :display_on => "back_end") + @payment_method = create(:check_payment_method, display_on: "back_end") end it "loads backend payment methods" do - spree_get :new, :order_id => order.number + spree_get :new, order_id: order.number expect(response.status).to eq(200) expect(assigns[:payment_methods]).to include(@payment_method) end diff --git a/backend/spec/controllers/spree/admin/products_controller_spec.rb b/backend/spec/controllers/spree/admin/products_controller_spec.rb index a04deade5fc..f10294c7d60 100644 --- a/backend/spec/controllers/spree/admin/products_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/products_controller_spec.rb @@ -4,12 +4,12 @@ stub_authorization! context "#index" do - let(:ability_user) { stub_model(Spree::LegacyUser, :has_spree_role? => true) } + let(:ability_user) { stub_model(Spree::LegacyUser, has_spree_role?: true) } # Regression test for #1259 it "can find a product by SKU" do - product = create(:product, :sku => "ABC123") - spree_get :index, :q => { :sku_start => "ABC123" } + product = create(:product, sku: "ABC123") + spree_get :index, q: { sku_start: "ABC123" } expect(assigns[:collection]).not_to be_empty expect(assigns[:collection]).to include(product) end @@ -19,7 +19,7 @@ context "adding properties to a product" do let!(:product) { create(:product) } specify do - spree_put :update, :id => product.to_param, :product => { :product_properties_attributes => { "1" => { :property_name => "Foo", :value => "bar" } } } + spree_put :update, id: product.to_param, product: { product_properties_attributes: { "1" => { property_name: "Foo", value: "bar" } } } expect(flash[:success]).to eq("Product #{product.name.inspect} has been successfully updated!") end @@ -96,7 +96,7 @@ def send_request let(:product) { create(:product) } it "restricts stock location based on accessible attributes" do expect(Spree::StockLocation).to receive(:accessible_by).and_return([]) - spree_get :stock, :id => product + spree_get :stock, id: product end end end diff --git a/backend/spec/controllers/spree/admin/promotion_actions_controller_spec.rb b/backend/spec/controllers/spree/admin/promotion_actions_controller_spec.rb index 14a8102964d..e17338422ed 100644 --- a/backend/spec/controllers/spree/admin/promotion_actions_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/promotion_actions_controller_spec.rb @@ -1,19 +1,19 @@ require 'spec_helper' -describe Spree::Admin::PromotionActionsController, :type => :controller do +describe Spree::Admin::PromotionActionsController, type: :controller do stub_authorization! let!(:promotion) { create(:promotion) } it "can create a promotion action of a valid type" do - spree_post :create, :promotion_id => promotion.id, :action_type => "Spree::Promotion::Actions::CreateAdjustment" + spree_post :create, promotion_id: promotion.id, action_type: "Spree::Promotion::Actions::CreateAdjustment" expect(response).to be_redirect expect(response).to redirect_to spree.edit_admin_promotion_path(promotion) expect(promotion.actions.count).to eq(1) end it "can not create a promotion action of an invalid type" do - spree_post :create, :promotion_id => promotion.id, :action_type => "Spree::InvalidType" + spree_post :create, promotion_id: promotion.id, action_type: "Spree::InvalidType" expect(response).to be_redirect expect(response).to redirect_to spree.edit_admin_promotion_path(promotion) expect(promotion.rules.count).to eq(0) diff --git a/backend/spec/controllers/spree/admin/promotion_rules_controller_spec.rb b/backend/spec/controllers/spree/admin/promotion_rules_controller_spec.rb index 4136fa0f530..27ab6ca78a1 100644 --- a/backend/spec/controllers/spree/admin/promotion_rules_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/promotion_rules_controller_spec.rb @@ -1,19 +1,19 @@ require 'spec_helper' -describe Spree::Admin::PromotionRulesController, :type => :controller do +describe Spree::Admin::PromotionRulesController, type: :controller do stub_authorization! let!(:promotion) { create(:promotion) } it "can create a promotion rule of a valid type" do - spree_post :create, :promotion_id => promotion.id, :promotion_rule => { :type => "Spree::Promotion::Rules::Product" } + spree_post :create, promotion_id: promotion.id, promotion_rule: { type: "Spree::Promotion::Rules::Product" } expect(response).to be_redirect expect(response).to redirect_to spree.edit_admin_promotion_path(promotion) expect(promotion.rules.count).to eq(1) end it "can not create a promotion rule of an invalid type" do - spree_post :create, :promotion_id => promotion.id, :promotion_rule => { :type => "Spree::InvalidType" } + spree_post :create, promotion_id: promotion.id, promotion_rule: { type: "Spree::InvalidType" } expect(response).to be_redirect expect(response).to redirect_to spree.edit_admin_promotion_path(promotion) expect(promotion.rules.count).to eq(0) diff --git a/backend/spec/controllers/spree/admin/promotions_controller_spec.rb b/backend/spec/controllers/spree/admin/promotions_controller_spec.rb index c851093acc8..eb5c89e7729 100644 --- a/backend/spec/controllers/spree/admin/promotions_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/promotions_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Admin::PromotionsController, :type => :controller do +describe Spree::Admin::PromotionsController, type: :controller do stub_authorization! let!(:promotion1) { create(:promotion, name: "name1", code: "code1", path: "path1") } diff --git a/backend/spec/controllers/spree/admin/reimbursements_controller_spec.rb b/backend/spec/controllers/spree/admin/reimbursements_controller_spec.rb index 2edc609f9a5..608f826c299 100644 --- a/backend/spec/controllers/spree/admin/reimbursements_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/reimbursements_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Admin::ReimbursementsController, :type => :controller do +describe Spree::Admin::ReimbursementsController, type: :controller do stub_authorization! let!(:default_refund_reason) do diff --git a/backend/spec/controllers/spree/admin/reports_controller_spec.rb b/backend/spec/controllers/spree/admin/reports_controller_spec.rb index e46a7f4c76a..b7ff6416f54 100644 --- a/backend/spec/controllers/spree/admin/reports_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/reports_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Admin::ReportsController, :type => :controller do +describe Spree::Admin::ReportsController, type: :controller do stub_authorization! describe 'ReportsController.available_reports' do diff --git a/backend/spec/controllers/spree/admin/resource_controller_spec.rb b/backend/spec/controllers/spree/admin/resource_controller_spec.rb index c0a61dba6df..bbe52f40bf7 100644 --- a/backend/spec/controllers/spree/admin/resource_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/resource_controller_spec.rb @@ -12,7 +12,7 @@ def model_class end end -describe Spree::Admin::WidgetsController, :type => :controller do +describe Spree::Admin::WidgetsController, type: :controller do stub_authorization! after(:all) do diff --git a/backend/spec/controllers/spree/admin/return_authorizations_controller_spec.rb b/backend/spec/controllers/spree/admin/return_authorizations_controller_spec.rb index f2927006854..344c1dccf37 100644 --- a/backend/spec/controllers/spree/admin/return_authorizations_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/return_authorizations_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Admin::ReturnAuthorizationsController, :type => :controller do +describe Spree::Admin::ReturnAuthorizationsController, type: :controller do stub_authorization! # Regression test for #1370 #3 diff --git a/backend/spec/controllers/spree/admin/return_items_controller_spec.rb b/backend/spec/controllers/spree/admin/return_items_controller_spec.rb index 009e22f0b47..fb4f044f744 100644 --- a/backend/spec/controllers/spree/admin/return_items_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/return_items_controller_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Admin::ReturnItemsController, :type => :controller do +describe Spree::Admin::ReturnItemsController, type: :controller do stub_authorization! describe '#update' do diff --git a/backend/spec/controllers/spree/admin/search_controller_spec.rb b/backend/spec/controllers/spree/admin/search_controller_spec.rb index 2a0f6c016aa..54410838e72 100644 --- a/backend/spec/controllers/spree/admin/search_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/search_controller_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe Spree::Admin::SearchController, :type => :controller do +describe Spree::Admin::SearchController, type: :controller do stub_authorization! # Regression test for ernie/ransack#176 describe "users" do - let(:user) { create(:user, :email => "spree_commerce@example.com") } + let(:user) { create(:user, email: "spree_commerce@example.com") } before do user.ship_address = create(:address) @@ -14,41 +14,41 @@ end it "can find a user by their email "do - spree_xhr_get :users, :q => user.email + spree_xhr_get :users, q: user.email expect(assigns[:users]).to include(user) end it "can find a user by their ship address's first name" do - spree_xhr_get :users, :q => user.ship_address.firstname + spree_xhr_get :users, q: user.ship_address.firstname expect(assigns[:users]).to include(user) end it "can find a user by their ship address's last name" do - spree_xhr_get :users, :q => user.ship_address.lastname + spree_xhr_get :users, q: user.ship_address.lastname expect(assigns[:users]).to include(user) end it "can find a user by their bill address's first name" do - spree_xhr_get :users, :q => user.bill_address.firstname + spree_xhr_get :users, q: user.bill_address.firstname expect(assigns[:users]).to include(user) end it "can find a user by their bill address's last name" do - spree_xhr_get :users, :q => user.bill_address.lastname + spree_xhr_get :users, q: user.bill_address.lastname expect(assigns[:users]).to include(user) end end describe "products" do - let(:product) { create(:product, :name => "Example Product") } + let(:product) { create(:product, name: "Example Product") } it "can find a product by its name "do - spree_xhr_get :products, :q => product.name + spree_xhr_get :products, q: product.name expect(assigns[:products]).to include(product) end it "can find a product by its slug "do - spree_xhr_get :products, :q => product.slug + spree_xhr_get :products, q: product.slug expect(assigns[:products]).to include(product) end end diff --git a/backend/spec/controllers/spree/admin/shipping_methods_controller_spec.rb b/backend/spec/controllers/spree/admin/shipping_methods_controller_spec.rb index fb25ec446de..0a22aa7b098 100644 --- a/backend/spec/controllers/spree/admin/shipping_methods_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/shipping_methods_controller_spec.rb @@ -1,14 +1,14 @@ require 'spec_helper' -describe Spree::Admin::ShippingMethodsController, :type => :controller do +describe Spree::Admin::ShippingMethodsController, type: :controller do stub_authorization! # Regression test for #1240 it "should not hard-delete shipping methods" do shipping_method = stub_model(Spree::ShippingMethod) - allow(Spree::ShippingMethod).to receive_messages :find => shipping_method + allow(Spree::ShippingMethod).to receive_messages find: shipping_method expect(shipping_method.deleted_at).to be_nil - spree_delete :destroy, :id => 1 + spree_delete :destroy, id: 1 expect(shipping_method.reload.deleted_at).not_to be_nil end end diff --git a/backend/spec/controllers/spree/admin/stock_items_controller_spec.rb b/backend/spec/controllers/spree/admin/stock_items_controller_spec.rb index 7c2063f6272..712bc71dcaa 100644 --- a/backend/spec/controllers/spree/admin/stock_items_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/stock_items_controller_spec.rb @@ -2,7 +2,7 @@ module Spree module Admin - describe StockItemsController, :type => :controller do + describe StockItemsController, type: :controller do stub_authorization! context "formats" do diff --git a/backend/spec/controllers/spree/admin/stock_locations_controller_spec.rb b/backend/spec/controllers/spree/admin/stock_locations_controller_spec.rb index 626ddbf9e79..616569619fc 100644 --- a/backend/spec/controllers/spree/admin/stock_locations_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/stock_locations_controller_spec.rb @@ -2,7 +2,7 @@ module Spree module Admin - describe StockLocationsController, :type => :controller do + describe StockLocationsController, type: :controller do stub_authorization! # Regression for #4272 diff --git a/backend/spec/controllers/spree/admin/stock_transfers_controller_spec.rb b/backend/spec/controllers/spree/admin/stock_transfers_controller_spec.rb index 23f372254e5..8e80b7fb273 100644 --- a/backend/spec/controllers/spree/admin/stock_transfers_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/stock_transfers_controller_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Admin::StockTransfersController, :type => :controller do + describe Admin::StockTransfersController, type: :controller do stub_authorization! let!(:stock_transfer1) { @@ -26,13 +26,13 @@ module Spree end it "searches by source location" do - spree_get :index, :q => { :source_location_id_eq => 1 } + spree_get :index, q: { source_location_id_eq: 1 } expect(assigns[:stock_transfers].count).to eq 1 expect(assigns[:stock_transfers]).to include(stock_transfer1) end it "searches by destination location" do - spree_get :index, :q => { :destination_location_id_eq => 4 } + spree_get :index, q: { destination_location_id_eq: 4 } expect(assigns[:stock_transfers].count).to eq 1 expect(assigns[:stock_transfers]).to include(stock_transfer2) end diff --git a/backend/spec/controllers/spree/admin/tax_categories_controller_spec.rb b/backend/spec/controllers/spree/admin/tax_categories_controller_spec.rb index 4f6e1799634..5c8b370fa06 100644 --- a/backend/spec/controllers/spree/admin/tax_categories_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/tax_categories_controller_spec.rb @@ -2,7 +2,7 @@ module Spree module Admin - describe TaxCategoriesController, :type => :controller do + describe TaxCategoriesController, type: :controller do stub_authorization! describe 'GET #index' do diff --git a/backend/spec/controllers/spree/admin/users_controller_spec.rb b/backend/spec/controllers/spree/admin/users_controller_spec.rb index 604a1a38390..155da819348 100644 --- a/backend/spec/controllers/spree/admin/users_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/users_controller_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' require 'spree/testing_support/bar_ability' -describe Spree::Admin::UsersController, :type => :controller do +describe Spree::Admin::UsersController, type: :controller do let(:user) { create(:user) } let(:mock_user) { mock_model Spree.user_class } before do - allow(controller).to receive_messages :spree_current_user => user + allow(controller).to receive_messages spree_current_user: user user.spree_roles.clear stub_const('Spree::User', user.class) end @@ -60,7 +60,7 @@ end it 'deny access to users without an admin role' do - allow(user).to receive_messages :has_spree_role? => false + allow(user).to receive_messages has_spree_role?: false spree_post :index expect(response).to redirect_to(spree.forbidden_path) end @@ -76,14 +76,14 @@ expect(Spree.user_class).to receive(:new).with(hash_including( "ship_address_attributes" => { "city" => "New York" } )) - spree_post :create, { :user => { :ship_address_attributes => { :city => "New York" } } } + spree_post :create, { user: { ship_address_attributes: { city: "New York" } } } end it "can create a billing_address" do expect(Spree.user_class).to receive(:new).with(hash_including( "bill_address_attributes" => { "city" => "New York" } )) - spree_post :create, { :user => { :bill_address_attributes => { :city => "New York" } } } + spree_post :create, { user: { bill_address_attributes: { city: "New York" } } } end end @@ -97,14 +97,14 @@ expect(mock_user).to receive(:update_attributes).with(hash_including( "ship_address_attributes" => { "city" => "New York" } )) - spree_put :update, { :id => mock_user.id, :user => { :ship_address_attributes => { :city => "New York" } } } + spree_put :update, { id: mock_user.id, user: { ship_address_attributes: { city: "New York" } } } end it "allows billing address attributes through" do expect(mock_user).to receive(:update_attributes).with(hash_including( "bill_address_attributes" => { "city" => "New York" } )) - spree_put :update, { :id => mock_user.id, :user => { :bill_address_attributes => { :city => "New York" } } } + spree_put :update, { id: mock_user.id, user: { bill_address_attributes: { city: "New York" } } } end it "allows updating without password resetting" do @@ -121,13 +121,13 @@ end it "assigns a list of the users orders" do - spree_get :orders, { :id => user.id } + spree_get :orders, { id: user.id } expect(assigns[:orders].count).to eq 1 expect(assigns[:orders].first).to eq order end it "assigns a ransack search for Spree::Order" do - spree_get :orders, { :id => user.id } + spree_get :orders, { id: user.id } expect(assigns[:search]).to be_a Ransack::Search expect(assigns[:search].klass).to eq Spree::Order end @@ -141,13 +141,13 @@ end it "assigns a list of the users orders" do - spree_get :items, { :id => user.id } + spree_get :items, { id: user.id } expect(assigns[:orders].count).to eq 1 expect(assigns[:orders].first).to eq order end it "assigns a ransack search for Spree::Order" do - spree_get :items, { :id => user.id } + spree_get :items, { id: user.id } expect(assigns[:search]).to be_a Ransack::Search expect(assigns[:search].klass).to eq Spree::Order end diff --git a/backend/spec/controllers/spree/admin/variants_controller_spec.rb b/backend/spec/controllers/spree/admin/variants_controller_spec.rb index 00bfa6d4d93..d3328ab1d50 100644 --- a/backend/spec/controllers/spree/admin/variants_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/variants_controller_spec.rb @@ -2,7 +2,7 @@ module Spree module Admin - describe VariantsController, :type => :controller do + describe VariantsController, type: :controller do stub_authorization! describe "#index" do diff --git a/backend/spec/features/admin/configuration/states_spec.rb b/backend/spec/features/admin/configuration/states_spec.rb index 5aba4b5353a..16c8adcad16 100755 --- a/backend/spec/features/admin/configuration/states_spec.rb +++ b/backend/spec/features/admin/configuration/states_spec.rb @@ -6,7 +6,7 @@ let!(:country) { create(:country) } before(:each) do - @hungary = Spree::Country.create!(:name => "Hungary", :iso_name => "Hungary") + @hungary = Spree::Country.create!(name: "Hungary", iso_name: "Hungary") end def go_to_states_page @@ -16,7 +16,7 @@ def go_to_states_page end context "admin visiting states listing" do - let!(:state) { create(:state, :country => country) } + let!(:state) { create(:state, country: country) } it "should correctly display the states" do visit spree.admin_country_states_path(country) diff --git a/backend/spec/features/admin/configuration/zones_spec.rb b/backend/spec/features/admin/configuration/zones_spec.rb index 836fb6adf7a..3426cedce44 100644 --- a/backend/spec/features/admin/configuration/zones_spec.rb +++ b/backend/spec/features/admin/configuration/zones_spec.rb @@ -11,8 +11,8 @@ context "show" do it "should display existing zones" do - create(:zone, :name => "eastern", :description => "zone is eastern") - create(:zone, :name => "western", :description => "cool san fran") + create(:zone, name: "eastern", description: "zone is eastern") + create(:zone, name: "western", description: "cool san fran") click_link "Zones" within_row(1) { expect(page).to have_content("eastern") } @@ -30,8 +30,8 @@ click_link "Zones" click_link "admin_new_zone_link" expect(page).to have_content("New Zone") - fill_in "zone_name", :with => "japan" - fill_in "zone_description", :with => "japanese time zone" + fill_in "zone_name", with: "japan" + fill_in "zone_description", with: "japanese time zone" click_button "Create" expect(page).to have_content("successfully created!") end diff --git a/backend/spec/features/admin/homepage_spec.rb b/backend/spec/features/admin/homepage_spec.rb index d5d5fe30103..d411f3fb23b 100644 --- a/backend/spec/features/admin/homepage_spec.rb +++ b/backend/spec/features/admin/homepage_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Homepage", :type => :feature do +describe "Homepage", type: :feature do context 'as admin user' do stub_authorization! diff --git a/backend/spec/features/admin/locale_spec.rb b/backend/spec/features/admin/locale_spec.rb index 9c0209f1a81..ef01b2e9682 100644 --- a/backend/spec/features/admin/locale_spec.rb +++ b/backend/spec/features/admin/locale_spec.rb @@ -1,19 +1,19 @@ require 'spec_helper' -describe "setting locale", :type => :feature do +describe "setting locale", type: :feature do stub_authorization! before do I18n.locale = I18n.default_locale I18n.backend.store_translations(:fr, - :date => { - :month_names => [], + date: { + month_names: [], }, - :spree => { - :admin => { - :tab => { :orders => "Ordres" } + spree: { + admin: { + tab: { orders: "Ordres" } }, - :listing_orders => "Ordres", + listing_orders: "Ordres", }) Spree::Backend::Config[:locale] = "fr" end diff --git a/backend/spec/features/admin/orders/adjustments_promotions_spec.rb b/backend/spec/features/admin/orders/adjustments_promotions_spec.rb index 0d0b0355ff7..94f5513cfaf 100644 --- a/backend/spec/features/admin/orders/adjustments_promotions_spec.rb +++ b/backend/spec/features/admin/orders/adjustments_promotions_spec.rb @@ -5,12 +5,12 @@ before(:each) do promotion = create(:promotion_with_item_adjustment, - :name => "$10 off", - :path => 'test', - :code => "10_off", - :starts_at => 1.day.ago, - :expires_at => 1.day.from_now, - :adjustment_rate => 10) + name: "$10 off", + path: 'test', + code: "10_off", + starts_at: 1.day.ago, + expires_at: 1.day.from_now, + adjustment_rate: 10) order = create(:order_with_totals) line_item = order.line_items.first diff --git a/backend/spec/features/admin/orders/adjustments_spec.rb b/backend/spec/features/admin/orders/adjustments_spec.rb index 9ceb653edbd..299eea91364 100644 --- a/backend/spec/features/admin/orders/adjustments_spec.rb +++ b/backend/spec/features/admin/orders/adjustments_spec.rb @@ -13,11 +13,11 @@ let!(:tax_adjustment) do create(:tax_adjustment, - :adjustable => line_item, - :state => 'closed', - :order => order, - :label => "VAT 5%", - :amount => 10) + adjustable: line_item, + state: 'closed', + order: order, + label: "VAT 5%", + amount: 10) end let!(:adjustment) { order.adjustments.create!(order: order, label: 'Rebate', amount: 10) } diff --git a/backend/spec/features/admin/orders/cancelling_and_resuming_spec.rb b/backend/spec/features/admin/orders/cancelling_and_resuming_spec.rb index ab77efc68de..e6604cabc49 100644 --- a/backend/spec/features/admin/orders/cancelling_and_resuming_spec.rb +++ b/backend/spec/features/admin/orders/cancelling_and_resuming_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Cancelling + Resuming", :type => :feature do +describe "Cancelling + Resuming", type: :feature do stub_authorization! diff --git a/backend/spec/features/admin/orders/line_items_spec.rb b/backend/spec/features/admin/orders/line_items_spec.rb index d45854dddbf..81b0a559d73 100644 --- a/backend/spec/features/admin/orders/line_items_spec.rb +++ b/backend/spec/features/admin/orders/line_items_spec.rb @@ -7,11 +7,11 @@ before do # Removing the delivery step causes the order page to render a different # partial, called _line_items, which shows line items rather than shipments - allow(Spree::Order).to receive_messages :checkout_step_names => [:address, :payment, :confirm, :complete] + allow(Spree::Order).to receive_messages checkout_step_names: [:address, :payment, :confirm, :complete] end let!(:order) do - order = create(:order_with_line_items, :line_items_count => 1) + order = create(:order_with_line_items, line_items_count: 1) order.shipments.destroy_all order end @@ -21,7 +21,7 @@ within(".line-items") do within_row(1) do find(".edit-line-item").click - fill_in "quantity", :with => 10 + fill_in "quantity", with: 10 find(".save-line-item").click within '.line-item-qty-show' do expect(page).to have_content("10") diff --git a/backend/spec/features/admin/orders/log_entries_spec.rb b/backend/spec/features/admin/orders/log_entries_spec.rb index 44bd6be89c9..d73959cd5c4 100644 --- a/backend/spec/features/admin/orders/log_entries_spec.rb +++ b/backend/spec/features/admin/orders/log_entries_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Log entries", :type => :feature do +describe "Log entries", type: :feature do stub_authorization! let!(:payment) { create(:payment) } @@ -10,12 +10,12 @@ response = ActiveMerchant::Billing::Response.new( true, "Transaction successful", - :transid => "ABCD1234" + transid: "ABCD1234" ) payment.log_entries.create( - :source => payment.source, - :details => response.to_yaml + source: payment.source, + details: response.to_yaml ) end @@ -34,12 +34,12 @@ response = ActiveMerchant::Billing::Response.new( false, "Transaction failed", - :transid => "ABCD1234" + transid: "ABCD1234" ) payment.log_entries.create( - :source => payment.source, - :details => response.to_yaml + source: payment.source, + details: response.to_yaml ) end diff --git a/backend/spec/features/admin/orders/new_order_spec.rb b/backend/spec/features/admin/orders/new_order_spec.rb index 8c007411144..191dd5e1b87 100644 --- a/backend/spec/features/admin/orders/new_order_spec.rb +++ b/backend/spec/features/admin/orders/new_order_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "New Order", :type => :feature do +describe "New Order", type: :feature do let!(:product) { create(:product_in_stock) } let!(:state) { create(:state) } let!(:user) { create(:user, ship_address: create(:address), bill_address: create(:address)) } diff --git a/backend/spec/features/admin/orders/risk_analysis_spec.rb b/backend/spec/features/admin/orders/risk_analysis_spec.rb index 7d4af2fabc3..902c637839c 100644 --- a/backend/spec/features/admin/orders/risk_analysis_spec.rb +++ b/backend/spec/features/admin/orders/risk_analysis_spec.rb @@ -17,7 +17,7 @@ def visit_order context "the order is considered risky" do before do - allow_any_instance_of(Spree::Admin::BaseController).to receive_messages :try_spree_current_user => create(:user) + allow_any_instance_of(Spree::Admin::BaseController).to receive_messages try_spree_current_user: create(:user) order.payments.first.update_column(:avs_response, 'X') order.considered_risky! diff --git a/backend/spec/features/admin/products/edit/products_spec.rb b/backend/spec/features/admin/products/edit/products_spec.rb index fff4700bcdf..e00b4f96abe 100644 --- a/backend/spec/features/admin/products/edit/products_spec.rb +++ b/backend/spec/features/admin/products/edit/products_spec.rb @@ -6,8 +6,8 @@ context 'editing a product' do it 'should list the product details' do - create(:product, :name => 'Bún thịt nướng', :sku => 'A100', - :description => 'lorem ipsum', :available_on => '2013-08-14 01:02:03') + create(:product, name: 'Bún thịt nướng', sku: 'A100', + description: 'lorem ipsum', available_on: '2013-08-14 01:02:03') visit spree.admin_products_path within_row(1) { click_icon :edit } diff --git a/backend/spec/features/admin/products/option_types_spec.rb b/backend/spec/features/admin/products/option_types_spec.rb index b02c8fcf323..e24a4f37795 100644 --- a/backend/spec/features/admin/products/option_types_spec.rb +++ b/backend/spec/features/admin/products/option_types_spec.rb @@ -83,7 +83,7 @@ within('table#listing_option_types') { click_icon :edit } wait_for_ajax - page.find("tbody#option_values", :visible => true) + page.find("tbody#option_values", visible: true) expect(all("tbody#option_values tr").select(&:visible?).count).to eq(1) diff --git a/backend/spec/features/admin/products/products_spec.rb b/backend/spec/features/admin/products/products_spec.rb index 0858e92a691..a6ba113efea 100644 --- a/backend/spec/features/admin/products/products_spec.rb +++ b/backend/spec/features/admin/products/products_spec.rb @@ -222,11 +222,11 @@ def build_option_type_with_values(name, values) before do # change English locale’s separator and delimiter to match 19,99 format I18n.backend.store_translations(:en, - :number => { - :currency => { - :format => { - :separator => ",", - :delimiter => "." + number: { + currency: { + format: { + separator: ",", + delimiter: "." } } }) @@ -235,18 +235,18 @@ def build_option_type_with_values(name, values) after do # revert changes to English locale I18n.backend.store_translations(:en, - :number => { - :currency => { - :format => { - :separator => ".", - :delimiter => "," + number: { + currency: { + format: { + separator: ".", + delimiter: "," } } }) end - it "should show localized price value on validation errors", :js => true do - fill_in "product_price", :with => "19,99" + it "should show localized price value on validation errors", js: true do + fill_in "product_price", with: "19,99" click_button "Create" expect(find('input#product_price').value).to eq('19,99') end @@ -383,7 +383,7 @@ def build_option_type_with_values(name, values) end end - context 'deleting a product', :js => true do + context 'deleting a product', js: true do let!(:product) { create(:product) } it "is still viewable" do diff --git a/backend/spec/features/admin/products/stock_management_spec.rb b/backend/spec/features/admin/products/stock_management_spec.rb index 5446e769b1b..d538de1c8c1 100644 --- a/backend/spec/features/admin/products/stock_management_spec.rb +++ b/backend/spec/features/admin/products/stock_management_spec.rb @@ -96,7 +96,7 @@ expect(page).to have_content('successfully created') - within("#listing_product_stock tr", :text => "SPREEC") do + within("#listing_product_stock tr", text: "SPREEC") do within("table") do expect(column_text(2)).to eq '40' end diff --git a/backend/spec/features/admin/promotions/adjustments_spec.rb b/backend/spec/features/admin/promotions/adjustments_spec.rb index eda9605e154..a71bf62c4d4 100644 --- a/backend/spec/features/admin/promotions/adjustments_spec.rb +++ b/backend/spec/features/admin/promotions/adjustments_spec.rb @@ -19,8 +19,8 @@ select2 "Item total", from: "Add rule of type" within('#rule_fields') { click_button "Add" } - eventually_fill_in "promotion_promotion_rules_attributes_#{Spree::Promotion.count}_preferred_amount_min", :with => 30 - eventually_fill_in "promotion_promotion_rules_attributes_#{Spree::Promotion.count}_preferred_amount_max", :with => 60 + eventually_fill_in "promotion_promotion_rules_attributes_#{Spree::Promotion.count}_preferred_amount_min", with: 30 + eventually_fill_in "promotion_promotion_rules_attributes_#{Spree::Promotion.count}_preferred_amount_max", with: 60 within('#rule_fields') { click_button "Update" } select2 "Create whole-order adjustment", from: "Add action of type" diff --git a/backend/spec/features/admin/reports_spec.rb b/backend/spec/features/admin/reports_spec.rb index fe61bdba154..c246d5ab1ab 100644 --- a/backend/spec/features/admin/reports_spec.rb +++ b/backend/spec/features/admin/reports_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Reports", :type => :feature do +describe "Reports", type: :feature do stub_authorization! context "visiting the admin reports page" do @@ -19,28 +19,28 @@ context "searching the admin reports page" do before do order = create(:order) - order.update_columns({:adjustment_total => 100}) + order.update_columns({adjustment_total: 100}) order.completed_at = Time.current order.save! order = create(:order) - order.update_columns({:adjustment_total => 200}) + order.update_columns({adjustment_total: 200}) order.completed_at = Time.current order.save! #incomplete order order = create(:order) - order.update_columns({:adjustment_total => 50}) + order.update_columns({adjustment_total: 50}) order.save! order = create(:order) - order.update_columns({:adjustment_total => 200}) + order.update_columns({adjustment_total: 200}) order.completed_at = 3.years.ago order.created_at = 3.years.ago order.save! order = create(:order) - order.update_columns({:adjustment_total => 200}) + order.update_columns({adjustment_total: 200}) order.completed_at = 3.years.from_now order.created_at = 3.years.from_now order.save! @@ -51,8 +51,8 @@ click_link "Reports" click_link "Sales Total" - fill_in "q_completed_at_gt", :with => 1.week.ago - fill_in "q_completed_at_lt", :with => 1.week.from_now + fill_in "q_completed_at_gt", with: 1.week.ago + fill_in "q_completed_at_lt", with: 1.week.from_now click_button "Search" expect(page).to have_content("$300.00") diff --git a/backend/spec/features/admin/users_spec.rb b/backend/spec/features/admin/users_spec.rb index d5ce34ecbc7..e1f4ae125ba 100644 --- a/backend/spec/features/admin/users_spec.rb +++ b/backend/spec/features/admin/users_spec.rb @@ -165,7 +165,7 @@ it 'can generate a new api key' do within("#admin_user_edit_api_key") do expect(user_a.spree_api_key).to be_blank - click_button Spree.t('generate_key', :scope => 'api') + click_button Spree.t('generate_key', scope: 'api') end expect(user_a.reload.spree_api_key).to be_present @@ -185,7 +185,7 @@ it 'can clear an api key' do within("#admin_user_edit_api_key") do - click_button Spree.t('clear_key', :scope => 'api') + click_button Spree.t('clear_key', scope: 'api') end expect(user_a.reload.spree_api_key).to be_blank @@ -196,7 +196,7 @@ old_key = user_a.spree_api_key within("#admin_user_edit_api_key") do - click_button Spree.t('regenerate_key', :scope => 'api') + click_button Spree.t('regenerate_key', scope: 'api') end expect(user_a.reload.spree_api_key).to be_present diff --git a/backend/spec/helpers/admin/base_helper_spec.rb b/backend/spec/helpers/admin/base_helper_spec.rb index c7916c71880..3e560b7ff1a 100644 --- a/backend/spec/helpers/admin/base_helper_spec.rb +++ b/backend/spec/helpers/admin/base_helper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Admin::BaseHelper, :type => :helper do +describe Spree::Admin::BaseHelper, type: :helper do include Spree::Admin::BaseHelper context "#datepicker_field_value" do diff --git a/backend/spec/helpers/admin/stock_movements_helper_spec.rb b/backend/spec/helpers/admin/stock_movements_helper_spec.rb index 7f9a7f48cc1..3dd727ab24f 100644 --- a/backend/spec/helpers/admin/stock_movements_helper_spec.rb +++ b/backend/spec/helpers/admin/stock_movements_helper_spec.rb @@ -1,7 +1,7 @@ # coding: UTF-8 require 'spec_helper' -describe Spree::Admin::StockMovementsHelper, :type => :helper do +describe Spree::Admin::StockMovementsHelper, type: :helper do describe "#pretty_originator" do diff --git a/backend/spec/spec_helper.rb b/backend/spec/spec_helper.rb index 2a2ba9cc26f..62fb2bafede 100644 --- a/backend/spec/spec_helper.rb +++ b/backend/spec/spec_helper.rb @@ -99,7 +99,7 @@ Timeout.timeout(30, &example) end - config.after(:each, :type => :feature) do |example| + config.after(:each, type: :feature) do |example| missing_translations = page.body.scan(/translation missing: #{I18n.locale}\.(.*?)[\s<\"&]/) if missing_translations.any? puts "Found missing translations: #{missing_translations.inspect}" diff --git a/cmd/lib/spree_cmd/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt b/cmd/lib/spree_cmd/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt index 3be016fc1c8..318009607d2 100644 --- a/cmd/lib/spree_cmd/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +++ b/cmd/lib/spree_cmd/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt @@ -2,7 +2,7 @@ module <%= class_name %> module Generators class InstallGenerator < Rails::Generators::Base - class_option :auto_run_migrations, :type => :boolean, :default => false + class_option :auto_run_migrations, type: :boolean, default: false def add_javascripts append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/<%= file_name %>\n" @@ -10,8 +10,8 @@ module <%= class_name %> end def add_stylesheets - inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", :before => /\*\//, :verbose => true - inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", :before => /\*\//, :verbose => true + inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/<%= file_name %>\n", before: /\*\//, verbose: true + inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/<%= file_name %>\n", before: /\*\//, verbose: true end def add_migrations diff --git a/core/app/models/spree/gateway/bogus.rb b/core/app/models/spree/gateway/bogus.rb index 0109f57c64b..787be369fcb 100644 --- a/core/app/models/spree/gateway/bogus.rb +++ b/core/app/models/spree/gateway/bogus.rb @@ -21,43 +21,43 @@ def create_profile(payment) return if payment.source.has_payment_profile? # simulate the storage of credit card profile using remote service if success = VALID_CCS.include?(payment.source.number) - payment.source.update_attributes(:gateway_customer_profile_id => generate_profile_id(success)) + payment.source.update_attributes(gateway_customer_profile_id: generate_profile_id(success)) end end def authorize(money, credit_card, options = {}) profile_id = credit_card.gateway_customer_profile_id if VALID_CCS.include? credit_card.number or (profile_id and profile_id.starts_with? 'BGS-') - ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345', :avs_result => { :code => 'D' }) + ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345', avs_result: { code: 'D' }) else - ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', { :message => 'Bogus Gateway: Forced failure' }, :test => true) + ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', { message: 'Bogus Gateway: Forced failure' }, test: true) end end def purchase(money, credit_card, options = {}) profile_id = credit_card.gateway_customer_profile_id if VALID_CCS.include? credit_card.number or (profile_id and profile_id.starts_with? 'BGS-') - ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345', :avs_result => { :code => 'M' }) + ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345', avs_result: { code: 'M' }) else - ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', :message => 'Bogus Gateway: Forced failure', :test => true) + ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', message: 'Bogus Gateway: Forced failure', test: true) end end def credit(money, credit_card, response_code, options = {}) - ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345') + ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345') end def capture(money, authorization, gateway_options) if authorization == '12345' - ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true) + ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true) else - ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', :error => 'Bogus Gateway: Forced failure', :test => true) + ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', error: 'Bogus Gateway: Forced failure', test: true) end end def void(response_code, credit_card, options = {}) - ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345') + ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345') end def cancel(_response_code) @@ -83,7 +83,7 @@ def generate_profile_id(success) prefix = success ? 'BGS' : 'FAIL' while record random = "#{prefix}-#{Array.new(6){rand(6)}.join}" - record = CreditCard.where(:gateway_customer_profile_id => random).first + record = CreditCard.where(gateway_customer_profile_id: random).first end random end diff --git a/core/app/models/spree/gateway/bogus_simple.rb b/core/app/models/spree/gateway/bogus_simple.rb index 8b0757b220a..711daeb4dfa 100644 --- a/core/app/models/spree/gateway/bogus_simple.rb +++ b/core/app/models/spree/gateway/bogus_simple.rb @@ -8,17 +8,17 @@ def payment_profiles_supported? def authorize(money, credit_card, options = {}) if VALID_CCS.include? credit_card.number - ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345', :avs_result => { :code => 'A' }) + ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345', avs_result: { code: 'A' }) else - ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', { :message => 'Bogus Gateway: Forced failure' }, :test => true) + ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', { message: 'Bogus Gateway: Forced failure' }, test: true) end end def purchase(money, credit_card, options = {}) if VALID_CCS.include? credit_card.number - ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, :test => true, :authorization => '12345', :avs_result => { :code => 'A' }) + ActiveMerchant::Billing::Response.new(true, 'Bogus Gateway: Forced success', {}, test: true, authorization: '12345', avs_result: { code: 'A' }) else - ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', :message => 'Bogus Gateway: Forced failure', :test => true) + ActiveMerchant::Billing::Response.new(false, 'Bogus Gateway: Forced failure', message: 'Bogus Gateway: Forced failure', test: true) end end diff --git a/core/app/models/spree/image.rb b/core/app/models/spree/image.rb index 6e9f1b36a4d..7047e371ab6 100644 --- a/core/app/models/spree/image.rb +++ b/core/app/models/spree/image.rb @@ -9,8 +9,8 @@ class Image < Asset path: ':rails_root/public/spree/products/:id/:style/:basename.:extension', convert_options: { all: '-strip -auto-orient -colorspace sRGB' } validates_attachment :attachment, - :presence => true, - :content_type => { :content_type => %w(image/jpeg image/jpg image/png image/gif) } + presence: true, + content_type: { content_type: %w(image/jpeg image/jpg image/png image/gif) } # save the w,h of the original image (from which others can be calculated) # we need to look at the write-queue for images which have not been saved yet diff --git a/core/app/models/spree/order_updater.rb b/core/app/models/spree/order_updater.rb index 37973dd5541..11dbd8d7f6a 100644 --- a/core/app/models/spree/order_updater.rb +++ b/core/app/models/spree/order_updater.rb @@ -138,7 +138,7 @@ def update_shipment_state # will return nil if no shipments are found order.shipment_state = shipment_states.first # TODO inventory unit states? - # if order.shipment_state && order.inventory_units.where(:shipment_id => nil).exists? + # if order.shipment_state && order.inventory_units.where(shipment_id: nil).exists? # shipments exist but there are unassigned inventory units # order.shipment_state = 'partial' # end diff --git a/core/app/models/spree/payment/processing.rb b/core/app/models/spree/payment/processing.rb index bf9c6750b75..67b067093ed 100644 --- a/core/app/models/spree/payment/processing.rb +++ b/core/app/models/spree/payment/processing.rb @@ -143,7 +143,7 @@ def handle_response(response, success_state, failure_state) end def record_response(response) - log_entries.create!(:details => response.to_yaml) + log_entries.create!(details: response.to_yaml) end def protect_from_connection_error diff --git a/core/app/models/spree/preferences/store.rb b/core/app/models/spree/preferences/store.rb index b60b5d0e545..5382bd3c1dd 100644 --- a/core/app/models/spree/preferences/store.rb +++ b/core/app/models/spree/preferences/store.rb @@ -24,7 +24,7 @@ def set(key, value) def exist?(key) @cache.exist?(key) || - should_persist? && Spree::Preference.where(:key => key).exists? + should_persist? && Spree::Preference.where(key: key).exists? end def get(key) @@ -73,7 +73,7 @@ def clear_cache def persist(cache_key, value) return unless should_persist? - preference = Spree::Preference.where(:key => cache_key).first_or_initialize + preference = Spree::Preference.where(key: cache_key).first_or_initialize preference.value = value preference.save end diff --git a/core/app/models/spree/product/scopes.rb b/core/app/models/spree/product/scopes.rb index af7e62b0e61..eabfe0c8326 100644 --- a/core/app/models/spree/product/scopes.rb +++ b/core/app/models/spree/product/scopes.rb @@ -39,34 +39,34 @@ def self.property_conditions(property) add_simple_scopes simple_scopes add_search_scope :ascend_by_master_price do - joins(:master => :default_price).order("#{price_table_name}.amount ASC") + joins(master: :default_price).order("#{price_table_name}.amount ASC") end add_search_scope :descend_by_master_price do - joins(:master => :default_price).order("#{price_table_name}.amount DESC") + joins(master: :default_price).order("#{price_table_name}.amount DESC") end add_search_scope :price_between do |low, high| - joins(:master => :default_price).where(Price.table_name => { :amount => low..high }) + joins(master: :default_price).where(Price.table_name => { amount: low..high }) end add_search_scope :master_price_lte do |price| - joins(:master => :default_price).where("#{price_table_name}.amount <= ?", price) + joins(master: :default_price).where("#{price_table_name}.amount <= ?", price) end add_search_scope :master_price_gte do |price| - joins(:master => :default_price).where("#{price_table_name}.amount >= ?", price) + joins(master: :default_price).where("#{price_table_name}.amount >= ?", price) end # This scope selects products in taxon AND all its descendants # If you need products only within one taxon use # - # Spree::Product.joins(:taxons).where(Taxon.table_name => { :id => taxon.id }) + # Spree::Product.joins(:taxons).where(Taxon.table_name => { id: taxon.id }) # # If you're using count on the result of this scope, you must use the # `:distinct` option as well: # - # Spree::Product.in_taxon(taxon).count(:distinct => true) + # Spree::Product.in_taxon(taxon).count(distinct: true) # # This is so that the count query is distinct'd: # @@ -162,8 +162,8 @@ def self.property_conditions(property) # there is alternative faster and more elegant solution, it has small drawback though, # it doesn stack with other scopes :/ # - # :joins => "LEFT OUTER JOIN (SELECT line_items.variant_id as vid, COUNT(*) as cnt FROM line_items GROUP BY line_items.variant_id) AS popularity_count ON variants.id = vid", - # :order => 'COALESCE(cnt, 0) DESC' + # joins: "LEFT OUTER JOIN (SELECT line_items.variant_id as vid, COUNT(*) as cnt FROM line_items GROUP BY line_items.variant_id) AS popularity_count ON variants.id = vid", + # order: 'COALESCE(cnt, 0) DESC' add_search_scope :descend_by_popularity do joins(:master). order(%Q{ diff --git a/core/app/models/spree/promotion/actions/create_line_items.rb b/core/app/models/spree/promotion/actions/create_line_items.rb index 8c14284ffad..ec511405b68 100644 --- a/core/app/models/spree/promotion/actions/create_line_items.rb +++ b/core/app/models/spree/promotion/actions/create_line_items.rb @@ -5,7 +5,7 @@ class CreateLineItems < PromotionAction has_many :promotion_action_line_items, foreign_key: :promotion_action_id accepts_nested_attributes_for :promotion_action_line_items - delegate :eligible?, :to => :promotion + delegate :eligible?, to: :promotion # Adds a line item to the Order if the promotion is eligible # diff --git a/core/app/models/spree/promotion_handler/coupon.rb b/core/app/models/spree/promotion_handler/coupon.rb index cc3948b9c0a..5010bbba088 100644 --- a/core/app/models/spree/promotion_handler/coupon.rb +++ b/core/app/models/spree/promotion_handler/coupon.rb @@ -54,7 +54,7 @@ def handle_present_promotion(promotion) # If any of the actions for the promotion return `true`, # then result here will also be `true`. - result = promotion.activate(:order => order) + result = promotion.activate(order: order) if result determine_promotion_application_result else diff --git a/core/app/models/spree/promotion_handler/page.rb b/core/app/models/spree/promotion_handler/page.rb index caf3c0a9455..f0dbfad62e5 100644 --- a/core/app/models/spree/promotion_handler/page.rb +++ b/core/app/models/spree/promotion_handler/page.rb @@ -10,14 +10,14 @@ def initialize(order, path) def activate if promotion && promotion.eligible?(order) - promotion.activate(:order => order) + promotion.activate(order: order) end end private def promotion - @promotion ||= Promotion.active.find_by(:path => path) + @promotion ||= Promotion.active.find_by(path: path) end end end diff --git a/core/app/models/spree/return_item.rb b/core/app/models/spree/return_item.rb index ad1af9c4930..191de3dfae3 100644 --- a/core/app/models/spree/return_item.rb +++ b/core/app/models/spree/return_item.rb @@ -102,7 +102,7 @@ def reception_completed? transition to: :manual_intervention_required, from: [:accepted, :pending, :manual_intervention_required] end - after_transition any => any, :do => :persist_acceptance_status_errors + after_transition any => any, do: :persist_acceptance_status_errors end def self.from_inventory_unit(inventory_unit) diff --git a/core/db/default/spree/roles.rb b/core/db/default/spree/roles.rb index 0b6f77ef4ca..8115da2e592 100644 --- a/core/db/default/spree/roles.rb +++ b/core/db/default/spree/roles.rb @@ -1,2 +1,2 @@ -Spree::Role.where(:name => "admin").first_or_create -Spree::Role.where(:name => "user").first_or_create +Spree::Role.where(name: "admin").first_or_create +Spree::Role.where(name: "user").first_or_create diff --git a/core/db/migrate/20120831092320_spree_one_two.rb b/core/db/migrate/20120831092320_spree_one_two.rb index 2a8ef137c14..07e9957ecb4 100644 --- a/core/db/migrate/20120831092320_spree_one_two.rb +++ b/core/db/migrate/20120831092320_spree_one_two.rb @@ -14,9 +14,9 @@ def up t.string :event_name t.string :type t.integer :usage_limit - t.string :match_policy, :default => 'all' + t.string :match_policy, default: 'all' t.string :code - t.boolean :advertise, :default => false + t.boolean :advertise, default: false t.string :path t.timestamps null: false end @@ -37,52 +37,52 @@ def up t.timestamps null: false end - add_index :spree_addresses, [:firstname], :name => 'index_addresses_on_firstname' - add_index :spree_addresses, [:lastname], :name => 'index_addresses_on_lastname' + add_index :spree_addresses, [:firstname], name: 'index_addresses_on_firstname' + add_index :spree_addresses, [:lastname], name: 'index_addresses_on_lastname' create_table :spree_adjustments do |t| - t.references :source, :polymorphic => true - t.references :adjustable, :polymorphic => true - t.references :originator, :polymorphic => true - t.decimal :amount, :precision => 8, :scale => 2 + t.references :source, polymorphic: true + t.references :adjustable, polymorphic: true + t.references :originator, polymorphic: true + t.decimal :amount, precision: 8, scale: 2 t.string :label t.boolean :mandatory t.boolean :locked - t.boolean :eligible, :default => true + t.boolean :eligible, default: true t.timestamps null: false end - add_index :spree_adjustments, [:adjustable_id], :name => 'index_adjustments_on_order_id' + add_index :spree_adjustments, [:adjustable_id], name: 'index_adjustments_on_order_id' create_table :spree_assets do |t| - t.references :viewable, :polymorphic => true + t.references :viewable, polymorphic: true t.integer :attachment_width t.integer :attachment_height t.integer :attachment_file_size t.integer :position t.string :attachment_content_type t.string :attachment_file_name - t.string :type, :limit => 75 + t.string :type, limit: 75 t.datetime :attachment_updated_at t.text :alt end - add_index :spree_assets, [:viewable_id], :name => 'index_assets_on_viewable_id' - add_index :spree_assets, [:viewable_type, :type], :name => 'index_assets_on_viewable_type_and_type' + add_index :spree_assets, [:viewable_id], name: 'index_assets_on_viewable_id' + add_index :spree_assets, [:viewable_type, :type], name: 'index_assets_on_viewable_type_and_type' create_table :spree_calculators do |t| t.string :type - t.references :calculable, :polymorphic => true + t.references :calculable, polymorphic: true t.timestamps null: false end create_table :spree_configurations do |t| t.string :name - t.string :type, :limit => 50 + t.string :type, limit: 50 t.timestamps null: false end - add_index :spree_configurations, [:name, :type], :name => 'index_spree_configurations_on_name_and_type' + add_index :spree_configurations, [:name, :type], name: 'index_spree_configurations_on_name_and_type' create_table :spree_countries do |t| t.string :iso_name @@ -112,15 +112,15 @@ def up t.string :type t.string :name t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' - t.string :server, :default => 'test' - t.boolean :test_mode, :default => true + t.boolean :active, default: true + t.string :environment, default: 'development' + t.string :server, default: 'test' + t.boolean :test_mode, default: true t.timestamps null: false end create_table :spree_inventory_units do |t| - t.integer :lock_version, :default => 0 + t.integer :lock_version, default: 0 t.string :state t.references :variant t.references :order @@ -129,41 +129,41 @@ def up t.timestamps null: false end - add_index :spree_inventory_units, [:order_id], :name => 'index_inventory_units_on_order_id' - add_index :spree_inventory_units, [:shipment_id], :name => 'index_inventory_units_on_shipment_id' - add_index :spree_inventory_units, [:variant_id], :name => 'index_inventory_units_on_variant_id' + add_index :spree_inventory_units, [:order_id], name: 'index_inventory_units_on_order_id' + add_index :spree_inventory_units, [:shipment_id], name: 'index_inventory_units_on_shipment_id' + add_index :spree_inventory_units, [:variant_id], name: 'index_inventory_units_on_variant_id' create_table :spree_line_items do |t| t.references :variant t.references :order - t.integer :quantity, :null => false - t.decimal :price, :precision => 8, :scale => 2, :null => false + t.integer :quantity, null: false + t.decimal :price, precision: 8, scale: 2, null: false t.timestamps null: false end - add_index :spree_line_items, [:order_id], :name => 'index_spree_line_items_on_order_id' - add_index :spree_line_items, [:variant_id], :name => 'index_spree_line_items_on_variant_id' + add_index :spree_line_items, [:order_id], name: 'index_spree_line_items_on_order_id' + add_index :spree_line_items, [:variant_id], name: 'index_spree_line_items_on_variant_id' create_table :spree_log_entries do |t| - t.references :source, :polymorphic => true + t.references :source, polymorphic: true t.text :details t.timestamps null: false end create_table :spree_mail_methods do |t| t.string :environment - t.boolean :active, :default => true + t.boolean :active, default: true t.timestamps null: false end create_table :spree_option_types do |t| - t.string :name, :limit => 100 - t.string :presentation, :limit => 100 - t.integer :position, :default => 0, :null => false + t.string :name, limit: 100 + t.string :presentation, limit: 100 + t.integer :position, default: 0, null: false t.timestamps null: false end - create_table :spree_option_types_prototypes, :id => false do |t| + create_table :spree_option_types_prototypes, id: false do |t| t.references :prototype t.references :option_type end @@ -176,25 +176,25 @@ def up t.timestamps null: false end - create_table :spree_option_values_variants, :id => false do |t| + create_table :spree_option_values_variants, id: false do |t| t.references :variant t.references :option_value end - add_index :spree_option_values_variants, [:variant_id, :option_value_id], :name => 'index_option_values_variants_on_variant_id_and_option_value_id' - add_index :spree_option_values_variants, [:variant_id], :name => 'index_spree_option_values_variants_on_variant_id' + add_index :spree_option_values_variants, [:variant_id, :option_value_id], name: 'index_option_values_variants_on_variant_id_and_option_value_id' + add_index :spree_option_values_variants, [:variant_id], name: 'index_spree_option_values_variants_on_variant_id' create_table :spree_orders do |t| - t.string :number, :limit => 15 - t.decimal :item_total, :precision => 8, :scale => 2, :default => 0.0, :null => false - t.decimal :total, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.string :number, limit: 15 + t.decimal :item_total, precision: 8, scale: 2, default: 0.0, null: false + t.decimal :total, precision: 8, scale: 2, default: 0.0, null: false t.string :state - t.decimal :adjustment_total, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.decimal :adjustment_total, precision: 8, scale: 2, default: 0.0, null: false t.references :user t.datetime :completed_at t.references :bill_address t.references :ship_address - t.decimal :payment_total, :precision => 8, :scale => 2, :default => 0.0 + t.decimal :payment_total, precision: 8, scale: 2, default: 0.0 t.references :shipping_method t.string :shipment_state t.string :payment_state @@ -203,23 +203,23 @@ def up t.timestamps null: false end - add_index :spree_orders, [:number], :name => 'index_spree_orders_on_number' + add_index :spree_orders, [:number], name: 'index_spree_orders_on_number' create_table :spree_payment_methods do |t| t.string :type t.string :name t.text :description - t.boolean :active, :default => true - t.string :environment, :default => 'development' + t.boolean :active, default: true + t.string :environment, default: 'development' t.datetime :deleted_at t.string :display_on t.timestamps null: false end create_table :spree_payments do |t| - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.decimal :amount, precision: 8, scale: 2, default: 0.0, null: false t.references :order - t.references :source, :polymorphic => true + t.references :source, polymorphic: true t.references :payment_method t.string :state t.string :response_code @@ -228,15 +228,15 @@ def up end create_table :spree_preferences do |t| - t.string :name, :limit => 100 - t.references :owner, :polymorphic => true + t.string :name, limit: 100 + t.references :owner, polymorphic: true t.text :value t.string :key t.string :value_type t.timestamps null: false end - add_index :spree_preferences, [:key], :name => 'index_spree_preferences_on_key', :unique => true + add_index :spree_preferences, [:key], name: 'index_spree_preferences_on_key', unique: true create_table :spree_product_option_types do |t| t.integer :position @@ -252,10 +252,10 @@ def up t.timestamps null: false end - add_index :spree_product_properties, [:product_id], :name => 'index_product_properties_on_product_id' + add_index :spree_product_properties, [:product_id], name: 'index_product_properties_on_product_id' create_table :spree_products do |t| - t.string :name, :default => '', :null => false + t.string :name, default: '', null: false t.text :description t.datetime :available_on t.datetime :deleted_at @@ -264,30 +264,30 @@ def up t.string :meta_keywords t.references :tax_category t.references :shipping_category - t.integer :count_on_hand, :default => 0, :null => false + t.integer :count_on_hand, default: 0, null: false t.timestamps null: false end - add_index :spree_products, [:available_on], :name => 'index_spree_products_on_available_on' - add_index :spree_products, [:deleted_at], :name => 'index_spree_products_on_deleted_at' - add_index :spree_products, [:name], :name => 'index_spree_products_on_name' - add_index :spree_products, [:permalink], :name => 'index_spree_products_on_permalink' + add_index :spree_products, [:available_on], name: 'index_spree_products_on_available_on' + add_index :spree_products, [:deleted_at], name: 'index_spree_products_on_deleted_at' + add_index :spree_products, [:name], name: 'index_spree_products_on_name' + add_index :spree_products, [:permalink], name: 'index_spree_products_on_permalink' - create_table :spree_products_taxons, :id => false do |t| + create_table :spree_products_taxons, id: false do |t| t.references :product t.references :taxon end - add_index :spree_products_taxons, [:product_id], :name => 'index_spree_products_taxons_on_product_id' - add_index :spree_products_taxons, [:taxon_id], :name => 'index_spree_products_taxons_on_taxon_id' + add_index :spree_products_taxons, [:product_id], name: 'index_spree_products_taxons_on_product_id' + add_index :spree_products_taxons, [:taxon_id], name: 'index_spree_products_taxons_on_taxon_id' create_table :spree_properties do |t| t.string :name - t.string :presentation, :null => false + t.string :presentation, null: false t.timestamps null: false end - create_table :spree_properties_prototypes, :id => false do |t| + create_table :spree_properties_prototypes, id: false do |t| t.references :prototype t.references :property end @@ -300,7 +300,7 @@ def up create_table :spree_return_authorizations do |t| t.string :number t.string :state - t.decimal :amount, :precision => 8, :scale => 2, :default => 0.0, :null => false + t.decimal :amount, precision: 8, scale: 2, default: 0.0, null: false t.references :order t.text :reason t.timestamps null: false @@ -310,18 +310,18 @@ def up t.string :name end - create_table :spree_roles_users, :id => false do |t| + create_table :spree_roles_users, id: false do |t| t.references :role t.references :user end - add_index :spree_roles_users, [:role_id], :name => 'index_spree_roles_users_on_role_id' - add_index :spree_roles_users, [:user_id], :name => 'index_spree_roles_users_on_user_id' + add_index :spree_roles_users, [:role_id], name: 'index_spree_roles_users_on_role_id' + add_index :spree_roles_users, [:user_id], name: 'index_spree_roles_users_on_user_id' create_table :spree_shipments do |t| t.string :tracking t.string :number - t.decimal :cost, :precision => 8, :scale => 2 + t.decimal :cost, precision: 8, scale: 2 t.datetime :shipped_at t.references :order t.references :shipping_method @@ -330,7 +330,7 @@ def up t.timestamps null: false end - add_index :spree_shipments, [:number], :name => 'index_shipments_on_number' + add_index :spree_shipments, [:number], name: 'index_shipments_on_number' create_table :spree_shipping_categories do |t| t.string :name @@ -368,28 +368,28 @@ def up create_table :spree_tax_categories do |t| t.string :name t.string :description - t.boolean :is_default, :default => false + t.boolean :is_default, default: false t.datetime :deleted_at t.timestamps null: false end create_table :spree_tax_rates do |t| - t.decimal :amount, :precision => 8, :scale => 5 + t.decimal :amount, precision: 8, scale: 5 t.references :zone t.references :tax_category - t.boolean :included_in_price, :default => false + t.boolean :included_in_price, default: false t.timestamps null: false end create_table :spree_taxonomies do |t| - t.string :name, :null => false + t.string :name, null: false t.timestamps null: false end create_table :spree_taxons do |t| t.references :parent - t.integer :position, :default => 0 - t.string :name, :null => false + t.integer :position, default: 0 + t.string :name, null: false t.string :permalink t.references :taxonomy t.integer :lft @@ -402,35 +402,35 @@ def up t.timestamps null: false end - add_index :spree_taxons, [:parent_id], :name => 'index_taxons_on_parent_id' - add_index :spree_taxons, [:permalink], :name => 'index_taxons_on_permalink' - add_index :spree_taxons, [:taxonomy_id], :name => 'index_taxons_on_taxonomy_id' + add_index :spree_taxons, [:parent_id], name: 'index_taxons_on_parent_id' + add_index :spree_taxons, [:permalink], name: 'index_taxons_on_permalink' + add_index :spree_taxons, [:taxonomy_id], name: 'index_taxons_on_taxonomy_id' - create_table :spree_tokenized_permissions, :force => true do |t| - t.references :permissable, :polymorphic => true + create_table :spree_tokenized_permissions, force: true do |t| + t.references :permissable, polymorphic: true t.string :token t.timestamps null: false end - add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], :name => 'index_tokenized_name_and_type' + add_index :spree_tokenized_permissions, [:permissable_id, :permissable_type], name: 'index_tokenized_name_and_type' create_table :spree_trackers do |t| t.string :environment t.string :analytics_id - t.boolean :active, :default => true + t.boolean :active, default: true t.timestamps null: false end create_table :spree_users do |t| - t.string :encrypted_password, :limit => 128 - t.string :password_salt, :limit => 128 + t.string :encrypted_password, limit: 128 + t.string :password_salt, limit: 128 t.string :email t.string :remember_token t.string :persistence_token t.string :reset_password_token t.string :perishable_token - t.integer :sign_in_count, :default => 0, :null => false - t.integer :failed_attempts, :default => 0, :null => false + t.integer :sign_in_count, default: 0, null: false + t.integer :failed_attempts, default: 0, null: false t.datetime :last_request_at t.datetime :current_sign_in_at t.datetime :last_sign_in_at @@ -448,24 +448,24 @@ def up end create_table :spree_variants do |t| - t.string :sku, :default => '', :null => false - t.decimal :price, :precision => 8, :scale => 2, :null => false - t.decimal :weight, :precision => 8, :scale => 2 - t.decimal :height, :precision => 8, :scale => 2 - t.decimal :width, :precision => 8, :scale => 2 - t.decimal :depth, :precision => 8, :scale => 2 + t.string :sku, default: '', null: false + t.decimal :price, precision: 8, scale: 2, null: false + t.decimal :weight, precision: 8, scale: 2 + t.decimal :height, precision: 8, scale: 2 + t.decimal :width, precision: 8, scale: 2 + t.decimal :depth, precision: 8, scale: 2 t.datetime :deleted_at - t.boolean :is_master, :default => false + t.boolean :is_master, default: false t.references :product - t.integer :count_on_hand, :default => 0, :null => false - t.decimal :cost_price, :precision => 8, :scale => 2 + t.integer :count_on_hand, default: 0, null: false + t.decimal :cost_price, precision: 8, scale: 2 t.integer :position end - add_index :spree_variants, [:product_id], :name => 'index_spree_variants_on_product_id' + add_index :spree_variants, [:product_id], name: 'index_spree_variants_on_product_id' create_table :spree_zone_members do |t| - t.references :zoneable, :polymorphic => true + t.references :zoneable, polymorphic: true t.references :zone t.timestamps null: false end @@ -473,8 +473,8 @@ def up create_table :spree_zones do |t| t.string :name t.string :description - t.boolean :default_tax, :default => false - t.integer :zone_members_count, :default => 0 + t.boolean :default_tax, default: false + t.integer :zone_members_count, default: 0 t.timestamps null: false end end diff --git a/core/db/migrate/20120831092359_spree_promo_one_two.rb b/core/db/migrate/20120831092359_spree_promo_one_two.rb index 0c34662c16e..3367a29b4e2 100644 --- a/core/db/migrate/20120831092359_spree_promo_one_two.rb +++ b/core/db/migrate/20120831092359_spree_promo_one_two.rb @@ -3,27 +3,27 @@ def up # This migration is just a compressed migration for all previous versions of spree_promo return if table_exists?(:spree_products_promotion_rules) - create_table :spree_products_promotion_rules, :id => false, :force => true do |t| + create_table :spree_products_promotion_rules, id: false, force: true do |t| t.references :product t.references :promotion_rule end - add_index :spree_products_promotion_rules, [:product_id], :name => 'index_products_promotion_rules_on_product_id' - add_index :spree_products_promotion_rules, [:promotion_rule_id], :name => 'index_products_promotion_rules_on_promotion_rule_id' + add_index :spree_products_promotion_rules, [:product_id], name: 'index_products_promotion_rules_on_product_id' + add_index :spree_products_promotion_rules, [:promotion_rule_id], name: 'index_products_promotion_rules_on_promotion_rule_id' - create_table :spree_promotion_action_line_items, :force => true do |t| + create_table :spree_promotion_action_line_items, force: true do |t| t.references :promotion_action t.references :variant - t.integer :quantity, :default => 1 + t.integer :quantity, default: 1 end - create_table :spree_promotion_actions, :force => true do |t| + create_table :spree_promotion_actions, force: true do |t| t.references :activator t.integer :position t.string :type end - create_table :spree_promotion_rules, :force => true do |t| + create_table :spree_promotion_rules, force: true do |t| t.references :activator t.references :user t.references :product_group @@ -31,15 +31,15 @@ def up t.timestamps null: false end - add_index :spree_promotion_rules, [:product_group_id], :name => 'index_promotion_rules_on_product_group_id' - add_index :spree_promotion_rules, [:user_id], :name => 'index_promotion_rules_on_user_id' + add_index :spree_promotion_rules, [:product_group_id], name: 'index_promotion_rules_on_product_group_id' + add_index :spree_promotion_rules, [:user_id], name: 'index_promotion_rules_on_user_id' - create_table :spree_promotion_rules_users, :id => false, :force => true do |t| + create_table :spree_promotion_rules_users, id: false, force: true do |t| t.references :user t.references :promotion_rule end - add_index :spree_promotion_rules_users, [:promotion_rule_id], :name => 'index_promotion_rules_users_on_promotion_rule_id' - add_index :spree_promotion_rules_users, [:user_id], :name => 'index_promotion_rules_users_on_user_id' + add_index :spree_promotion_rules_users, [:promotion_rule_id], name: 'index_promotion_rules_users_on_promotion_rule_id' + add_index :spree_promotion_rules_users, [:user_id], name: 'index_promotion_rules_users_on_user_id' end end diff --git a/core/db/migrate/20120905151823_add_toggle_tax_rate_display.rb b/core/db/migrate/20120905151823_add_toggle_tax_rate_display.rb index f4f3406c3ef..82d31675dc0 100644 --- a/core/db/migrate/20120905151823_add_toggle_tax_rate_display.rb +++ b/core/db/migrate/20120905151823_add_toggle_tax_rate_display.rb @@ -1,5 +1,5 @@ class AddToggleTaxRateDisplay < ActiveRecord::Migration def change - add_column :spree_tax_rates, :show_rate_in_label, :boolean, :default => true + add_column :spree_tax_rates, :show_rate_in_label, :boolean, default: true end end diff --git a/core/db/migrate/20121009142519_add_lock_version_to_variant.rb b/core/db/migrate/20121009142519_add_lock_version_to_variant.rb index 91c8ec33a7f..fb7f5247602 100644 --- a/core/db/migrate/20121009142519_add_lock_version_to_variant.rb +++ b/core/db/migrate/20121009142519_add_lock_version_to_variant.rb @@ -1,5 +1,5 @@ class AddLockVersionToVariant < ActiveRecord::Migration def change - add_column :spree_variants, :lock_version, :integer, :default => 0 + add_column :spree_variants, :lock_version, :integer, default: 0 end end diff --git a/core/db/migrate/20121010142909_add_states_required_to_countries.rb b/core/db/migrate/20121010142909_add_states_required_to_countries.rb index 82bfd02b630..6aaf358e4e4 100644 --- a/core/db/migrate/20121010142909_add_states_required_to_countries.rb +++ b/core/db/migrate/20121010142909_add_states_required_to_countries.rb @@ -1,5 +1,5 @@ class AddStatesRequiredToCountries < ActiveRecord::Migration def change - add_column :spree_countries, :states_required, :boolean,:default => true + add_column :spree_countries, :states_required, :boolean, default: true end end diff --git a/core/db/migrate/20121012071449_add_on_demand_to_product_and_variant.rb b/core/db/migrate/20121012071449_add_on_demand_to_product_and_variant.rb index cf73c90b679..db441822c2f 100644 --- a/core/db/migrate/20121012071449_add_on_demand_to_product_and_variant.rb +++ b/core/db/migrate/20121012071449_add_on_demand_to_product_and_variant.rb @@ -1,6 +1,6 @@ class AddOnDemandToProductAndVariant < ActiveRecord::Migration def change - add_column :spree_products, :on_demand, :boolean, :default => false - add_column :spree_variants, :on_demand, :boolean, :default => false + add_column :spree_products, :on_demand, :boolean, default: false + add_column :spree_variants, :on_demand, :boolean, default: false end end diff --git a/core/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb b/core/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb index 8f413e325f8..d24c04ab5d4 100644 --- a/core/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb +++ b/core/db/migrate/20121017010007_remove_not_null_constraint_from_products_on_hand.rb @@ -1,11 +1,11 @@ class RemoveNotNullConstraintFromProductsOnHand < ActiveRecord::Migration def up - change_column :spree_products, :count_on_hand, :integer, :null => true - change_column :spree_variants, :count_on_hand, :integer, :null => true + change_column :spree_products, :count_on_hand, :integer, null: true + change_column :spree_variants, :count_on_hand, :integer, null: true end def down - change_column :spree_products, :count_on_hand, :integer, :null => false - change_column :spree_variants, :count_on_hand, :integer, :null => false + change_column :spree_products, :count_on_hand, :integer, null: false + change_column :spree_variants, :count_on_hand, :integer, null: false end end diff --git a/core/db/migrate/20121031162139_split_prices_from_variants.rb b/core/db/migrate/20121031162139_split_prices_from_variants.rb index 27aa83fa8e5..5cc44932d5d 100644 --- a/core/db/migrate/20121031162139_split_prices_from_variants.rb +++ b/core/db/migrate/20121031162139_split_prices_from_variants.rb @@ -1,16 +1,16 @@ class SplitPricesFromVariants < ActiveRecord::Migration def up create_table :spree_prices do |t| - t.integer :variant_id, :null => false - t.decimal :amount, :precision => 8, :scale => 2, :null => false + t.integer :variant_id, null: false + t.decimal :amount, precision: 8, scale: 2, null: false t.string :currency end Spree::Variant.all.each do |variant| Spree::Price.create!( - :variant_id => variant.id, - :amount => variant[:price], - :currency => Spree::Config[:currency] + variant_id: variant.id, + amount: variant[:price], + currency: Spree::Config[:currency] ) end @@ -19,13 +19,13 @@ def up def down prices = ActiveRecord::Base.connection.execute("select variant_id, amount from spree_prices") - add_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8 + add_column :spree_variants, :price, :decimal, after: :sku, scale: 2, precision: 8 prices.each do |price| ActiveRecord::Base.connection.execute("update spree_variants set price = #{price['amount']} where id = #{price['variant_id']}") end - change_column :spree_variants, :price, :decimal, :after => :sku, :scale => 2, :precision => 8, :null => false + change_column :spree_variants, :price, :decimal, after: :sku, scale: 2, precision: 8, null: false drop_table :spree_prices end end diff --git a/core/db/migrate/20121107003422_remove_not_null_from_spree_prices_amount.rb b/core/db/migrate/20121107003422_remove_not_null_from_spree_prices_amount.rb index 066c0a6a176..6fdb36284b3 100644 --- a/core/db/migrate/20121107003422_remove_not_null_from_spree_prices_amount.rb +++ b/core/db/migrate/20121107003422_remove_not_null_from_spree_prices_amount.rb @@ -1,9 +1,9 @@ class RemoveNotNullFromSpreePricesAmount < ActiveRecord::Migration def up - change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => true + change_column :spree_prices, :amount, :decimal, precision: 8, scale: 2, null: true end def down - change_column :spree_prices, :amount, :decimal, :precision => 8, :scale => 2, :null => false + change_column :spree_prices, :amount, :decimal, precision: 8, scale: 2, null: false end end diff --git a/core/db/migrate/20121109173623_add_cost_currency_to_variants.rb b/core/db/migrate/20121109173623_add_cost_currency_to_variants.rb index bfd29d323f6..52d8ea24c26 100644 --- a/core/db/migrate/20121109173623_add_cost_currency_to_variants.rb +++ b/core/db/migrate/20121109173623_add_cost_currency_to_variants.rb @@ -1,5 +1,5 @@ class AddCostCurrencyToVariants < ActiveRecord::Migration def change - add_column :spree_variants, :cost_currency, :string, :after => :cost_price + add_column :spree_variants, :cost_currency, :string, after: :cost_price end end diff --git a/core/db/migrate/20121124203911_add_position_to_taxonomies.rb b/core/db/migrate/20121124203911_add_position_to_taxonomies.rb index 2f824e1638d..82e37084655 100644 --- a/core/db/migrate/20121124203911_add_position_to_taxonomies.rb +++ b/core/db/migrate/20121124203911_add_position_to_taxonomies.rb @@ -1,5 +1,5 @@ class AddPositionToTaxonomies < ActiveRecord::Migration def change - add_column :spree_taxonomies, :position, :integer, :default => 0 + add_column :spree_taxonomies, :position, :integer, default: 0 end end diff --git a/core/db/migrate/20130120201805_add_position_to_product_properties.spree.rb b/core/db/migrate/20130120201805_add_position_to_product_properties.spree.rb index 05bc1270190..737dfbc2b59 100644 --- a/core/db/migrate/20130120201805_add_position_to_product_properties.spree.rb +++ b/core/db/migrate/20130120201805_add_position_to_product_properties.spree.rb @@ -1,6 +1,6 @@ class AddPositionToProductProperties < ActiveRecord::Migration def change - add_column :spree_product_properties, :position, :integer, :default => 0 + add_column :spree_product_properties, :position, :integer, default: 0 end end diff --git a/core/db/migrate/20130211190146_create_spree_stock_items.rb b/core/db/migrate/20130211190146_create_spree_stock_items.rb index f6606862116..addebad7a4f 100644 --- a/core/db/migrate/20130211190146_create_spree_stock_items.rb +++ b/core/db/migrate/20130211190146_create_spree_stock_items.rb @@ -9,6 +9,6 @@ def change t.timestamps null: false end add_index :spree_stock_items, :stock_location_id - add_index :spree_stock_items, [:stock_location_id, :variant_id], :name => 'stock_item_by_loc_and_var_id' + add_index :spree_stock_items, [:stock_location_id, :variant_id], name: 'stock_item_by_loc_and_var_id' end end diff --git a/core/db/migrate/20130226032817_change_meta_description_on_spree_products_to_text.rb b/core/db/migrate/20130226032817_change_meta_description_on_spree_products_to_text.rb index a362deb32ff..b6cfea9db7a 100644 --- a/core/db/migrate/20130226032817_change_meta_description_on_spree_products_to_text.rb +++ b/core/db/migrate/20130226032817_change_meta_description_on_spree_products_to_text.rb @@ -1,5 +1,5 @@ class ChangeMetaDescriptionOnSpreeProductsToText < ActiveRecord::Migration def change - change_column :spree_products, :meta_description, :text, :limit => nil + change_column :spree_products, :meta_description, :text, limit: nil end end diff --git a/core/db/migrate/20130227143905_add_pending_to_inventory_unit.rb b/core/db/migrate/20130227143905_add_pending_to_inventory_unit.rb index ea17f507a4a..fd2a7c9c495 100644 --- a/core/db/migrate/20130227143905_add_pending_to_inventory_unit.rb +++ b/core/db/migrate/20130227143905_add_pending_to_inventory_unit.rb @@ -1,6 +1,6 @@ class AddPendingToInventoryUnit < ActiveRecord::Migration def change - add_column :spree_inventory_units, :pending, :boolean, :default => true - Spree::InventoryUnit.update_all(:pending => false) + add_column :spree_inventory_units, :pending, :boolean, default: true + Spree::InventoryUnit.update_all(pending: false) end end diff --git a/core/db/migrate/20130228210442_create_shipping_method_zone.rb b/core/db/migrate/20130228210442_create_shipping_method_zone.rb index 0bd523a3b5a..4b6ab9b9a93 100644 --- a/core/db/migrate/20130228210442_create_shipping_method_zone.rb +++ b/core/db/migrate/20130228210442_create_shipping_method_zone.rb @@ -3,7 +3,7 @@ class ShippingMethodZone < ActiveRecord::Base self.table_name = 'shipping_methods_zones' end def up - create_table :shipping_methods_zones, :id => false do |t| + create_table :shipping_methods_zones, id: false do |t| t.integer :shipping_method_id t.integer :zone_id end diff --git a/core/db/migrate/20130301162924_create_shipping_method_categories.rb b/core/db/migrate/20130301162924_create_shipping_method_categories.rb index b83ba19ccaa..01fce0e5af9 100644 --- a/core/db/migrate/20130301162924_create_shipping_method_categories.rb +++ b/core/db/migrate/20130301162924_create_shipping_method_categories.rb @@ -1,8 +1,8 @@ class CreateShippingMethodCategories < ActiveRecord::Migration def change create_table :spree_shipping_method_categories do |t| - t.integer :shipping_method_id, :null => false - t.integer :shipping_category_id, :null => false + t.integer :shipping_method_id, null: false + t.integer :shipping_category_id, null: false t.timestamps null: false end diff --git a/core/db/migrate/20130304162240_create_spree_shipping_rates.rb b/core/db/migrate/20130304162240_create_spree_shipping_rates.rb index 85fb3824ae1..924fcef27dd 100644 --- a/core/db/migrate/20130304162240_create_spree_shipping_rates.rb +++ b/core/db/migrate/20130304162240_create_spree_shipping_rates.rb @@ -3,13 +3,13 @@ def up create_table :spree_shipping_rates do |t| t.belongs_to :shipment t.belongs_to :shipping_method - t.boolean :selected, :default => false - t.decimal :cost, :precision => 8, :scale => 2 + t.boolean :selected, default: false + t.decimal :cost, precision: 8, scale: 2 t.timestamps null: false end add_index(:spree_shipping_rates, [:shipment_id, :shipping_method_id], - :name => 'spree_shipping_rates_join_index', - :unique => true) + name: 'spree_shipping_rates_join_index', + unique: true) # Spree::Shipment.all.each do |shipment| # shipping_method = Spree::ShippingMethod.find(shipment.shipment_method_id) diff --git a/core/db/migrate/20130306181701_add_address_fields_to_stock_location.rb b/core/db/migrate/20130306181701_add_address_fields_to_stock_location.rb index 68974817a46..0de2dec6fd9 100644 --- a/core/db/migrate/20130306181701_add_address_fields_to_stock_location.rb +++ b/core/db/migrate/20130306181701_add_address_fields_to_stock_location.rb @@ -12,11 +12,11 @@ def change add_column :spree_stock_locations, :phone, :string - usa = Spree::Country.where(:iso => 'US').first + usa = Spree::Country.where(iso: 'US').first # In case USA isn't found. # See #3115 country = usa || Spree::Country.first Spree::Country.reset_column_information - Spree::StockLocation.update_all(:country_id => country) + Spree::StockLocation.update_all(country_id: country) end end diff --git a/core/db/migrate/20130306191917_add_active_field_to_stock_locations.rb b/core/db/migrate/20130306191917_add_active_field_to_stock_locations.rb index a5dbd91113b..d7f6acc5d3c 100644 --- a/core/db/migrate/20130306191917_add_active_field_to_stock_locations.rb +++ b/core/db/migrate/20130306191917_add_active_field_to_stock_locations.rb @@ -1,5 +1,5 @@ class AddActiveFieldToStockLocations < ActiveRecord::Migration def change - add_column :spree_stock_locations, :active, :boolean, :default => true + add_column :spree_stock_locations, :active, :boolean, default: true end end diff --git a/core/db/migrate/20130306195650_add_backorderable_to_stock_item.rb b/core/db/migrate/20130306195650_add_backorderable_to_stock_item.rb index 5465ec80254..2c122ac854c 100644 --- a/core/db/migrate/20130306195650_add_backorderable_to_stock_item.rb +++ b/core/db/migrate/20130306195650_add_backorderable_to_stock_item.rb @@ -1,5 +1,5 @@ class AddBackorderableToStockItem < ActiveRecord::Migration def change - add_column :spree_stock_items, :backorderable, :boolean, :default => true + add_column :spree_stock_items, :backorderable, :boolean, default: true end end diff --git a/core/db/migrate/20130307161754_add_default_quantity_to_stock_movement.rb b/core/db/migrate/20130307161754_add_default_quantity_to_stock_movement.rb index 0c6c73ad00a..05590ceec9b 100644 --- a/core/db/migrate/20130307161754_add_default_quantity_to_stock_movement.rb +++ b/core/db/migrate/20130307161754_add_default_quantity_to_stock_movement.rb @@ -1,5 +1,5 @@ class AddDefaultQuantityToStockMovement < ActiveRecord::Migration def change - change_column :spree_stock_movements, :quantity, :integer, :default => 0 + change_column :spree_stock_movements, :quantity, :integer, default: 0 end end diff --git a/core/db/migrate/20130319062004_change_orders_total_precision.rb b/core/db/migrate/20130319062004_change_orders_total_precision.rb index b98b7b1d1b5..d625639102e 100644 --- a/core/db/migrate/20130319062004_change_orders_total_precision.rb +++ b/core/db/migrate/20130319062004_change_orders_total_precision.rb @@ -1,8 +1,8 @@ class ChangeOrdersTotalPrecision < ActiveRecord::Migration def change - change_column :spree_orders, :item_total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false - change_column :spree_orders, :total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false - change_column :spree_orders, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false - change_column :spree_orders, :payment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0 + change_column :spree_orders, :item_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false + change_column :spree_orders, :total, :decimal, precision: 10, scale: 2, default: 0.0, null: false + change_column :spree_orders, :adjustment_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false + change_column :spree_orders, :payment_total, :decimal, precision: 10, scale: 2, default: 0.0 end end diff --git a/core/db/migrate/20130319063911_change_spree_payments_amount_precision.rb b/core/db/migrate/20130319063911_change_spree_payments_amount_precision.rb index a643c59d0fb..02f4e2592c6 100644 --- a/core/db/migrate/20130319063911_change_spree_payments_amount_precision.rb +++ b/core/db/migrate/20130319063911_change_spree_payments_amount_precision.rb @@ -1,7 +1,7 @@ class ChangeSpreePaymentsAmountPrecision < ActiveRecord::Migration def change - change_column :spree_payments, :amount, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false + change_column :spree_payments, :amount, :decimal, precision: 10, scale: 2, default: 0.0, null: false end end diff --git a/core/db/migrate/20130319064308_change_spree_return_authorization_amount_precision.rb b/core/db/migrate/20130319064308_change_spree_return_authorization_amount_precision.rb index 450640b4feb..a0112cf042f 100644 --- a/core/db/migrate/20130319064308_change_spree_return_authorization_amount_precision.rb +++ b/core/db/migrate/20130319064308_change_spree_return_authorization_amount_precision.rb @@ -1,7 +1,7 @@ class ChangeSpreeReturnAuthorizationAmountPrecision < ActiveRecord::Migration def change - change_column :spree_return_authorizations, :amount, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false + change_column :spree_return_authorizations, :amount, :decimal, precision: 10, scale: 2, default: 0.0, null: false end end diff --git a/core/db/migrate/20130319082943_change_adjustments_amount_precision.rb b/core/db/migrate/20130319082943_change_adjustments_amount_precision.rb index 534a9720715..ce377c06b02 100644 --- a/core/db/migrate/20130319082943_change_adjustments_amount_precision.rb +++ b/core/db/migrate/20130319082943_change_adjustments_amount_precision.rb @@ -1,7 +1,7 @@ class ChangeAdjustmentsAmountPrecision < ActiveRecord::Migration def change - change_column :spree_adjustments, :amount, :decimal, :precision => 10, :scale => 2 + change_column :spree_adjustments, :amount, :decimal, precision: 10, scale: 2 end end diff --git a/core/db/migrate/20130319190507_drop_source_and_destination_from_stock_movement.rb b/core/db/migrate/20130319190507_drop_source_and_destination_from_stock_movement.rb index 3b316e32e59..11bc98561b6 100644 --- a/core/db/migrate/20130319190507_drop_source_and_destination_from_stock_movement.rb +++ b/core/db/migrate/20130319190507_drop_source_and_destination_from_stock_movement.rb @@ -1,8 +1,8 @@ class DropSourceAndDestinationFromStockMovement < ActiveRecord::Migration def up change_table :spree_stock_movements do |t| - t.remove_references :source, :polymorphic => true - t.remove_references :destination, :polymorphic => true + t.remove_references :source, polymorphic: true + t.remove_references :destination, polymorphic: true end end diff --git a/core/db/migrate/20130325163316_migrate_inventory_unit_sold_to_on_hand.rb b/core/db/migrate/20130325163316_migrate_inventory_unit_sold_to_on_hand.rb index 6325ca0134b..cdcb4ad2dad 100644 --- a/core/db/migrate/20130325163316_migrate_inventory_unit_sold_to_on_hand.rb +++ b/core/db/migrate/20130325163316_migrate_inventory_unit_sold_to_on_hand.rb @@ -1,9 +1,9 @@ class MigrateInventoryUnitSoldToOnHand < ActiveRecord::Migration def up - Spree::InventoryUnit.where(:state => 'sold').update_all(:state => 'on_hand') + Spree::InventoryUnit.where(state: 'sold').update_all(state: 'on_hand') end def down - Spree::InventoryUnit.where(:state => 'on_hand').update_all(:state => 'sold') + Spree::InventoryUnit.where(state: 'on_hand').update_all(state: 'sold') end end diff --git a/core/db/migrate/20130417120035_update_adjustment_states.rb b/core/db/migrate/20130417120035_update_adjustment_states.rb index 2dae59d352c..88d9d35c484 100644 --- a/core/db/migrate/20130417120035_update_adjustment_states.rb +++ b/core/db/migrate/20130417120035_update_adjustment_states.rb @@ -1,14 +1,14 @@ class UpdateAdjustmentStates < ActiveRecord::Migration def up Spree::Order.complete.find_each do |order| - order.adjustments.update_all(:state => 'closed') + order.adjustments.update_all(state: 'closed') end Spree::Shipment.shipped.includes(:adjustment).find_each do |shipment| shipment.adjustment.update_column(:state, 'finalized') if shipment.adjustment end - Spree::Adjustment.where(:state => nil).update_all(:state => 'open') + Spree::Adjustment.where(state: nil).update_all(state: 'open') end def down diff --git a/core/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb b/core/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb index 8e1c187a58f..a5f8fbc6ef7 100644 --- a/core/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb +++ b/core/db/migrate/20130417123427_add_shipping_rates_to_shipments.rb @@ -1,9 +1,9 @@ class AddShippingRatesToShipments < ActiveRecord::Migration def up Spree::Shipment.find_each do |shipment| - shipment.shipping_rates.create(:shipping_method_id => shipment.shipping_method_id, - :cost => shipment.cost, - :selected => true) + shipment.shipping_rates.create(shipping_method_id: shipment.shipping_method_id, + cost: shipment.cost, + selected: true) end remove_column :spree_shipments, :shipping_method_id diff --git a/core/db/migrate/20130628021056_add_unique_index_to_permalink_on_spree_products.rb b/core/db/migrate/20130628021056_add_unique_index_to_permalink_on_spree_products.rb index 9e2a54b7426..8599272fc9d 100644 --- a/core/db/migrate/20130628021056_add_unique_index_to_permalink_on_spree_products.rb +++ b/core/db/migrate/20130628021056_add_unique_index_to_permalink_on_spree_products.rb @@ -1,5 +1,5 @@ class AddUniqueIndexToPermalinkOnSpreeProducts < ActiveRecord::Migration def change - add_index "spree_products", ["permalink"], :name => "permalink_idx_unique", :unique => true + add_index "spree_products", ["permalink"], name: "permalink_idx_unique", unique: true end end diff --git a/core/db/migrate/20130628022817_add_unique_index_to_orders_shipments_and_stock_transfers.rb b/core/db/migrate/20130628022817_add_unique_index_to_orders_shipments_and_stock_transfers.rb index 2dbc6b2c13e..8f99c75b59e 100644 --- a/core/db/migrate/20130628022817_add_unique_index_to_orders_shipments_and_stock_transfers.rb +++ b/core/db/migrate/20130628022817_add_unique_index_to_orders_shipments_and_stock_transfers.rb @@ -1,7 +1,7 @@ class AddUniqueIndexToOrdersShipmentsAndStockTransfers < ActiveRecord::Migration def add - add_index "spree_orders", ["number"], :name => "number_idx_unique", :unique => true - add_index "spree_shipments", ["number"], :name => "number_idx_unique", :unique => true - add_index "spree_stock_transfers", ["number"], :name => "number_idx_unique", :unique => true + add_index "spree_orders", ["number"], name: "number_idx_unique", unique: true + add_index "spree_shipments", ["number"], name: "number_idx_unique", unique: true + add_index "spree_stock_transfers", ["number"], name: "number_idx_unique", unique: true end end diff --git a/core/db/migrate/20130718042445_add_cost_price_to_line_item.rb b/core/db/migrate/20130718042445_add_cost_price_to_line_item.rb index f67fa1a0a37..b2d1e45d8c1 100644 --- a/core/db/migrate/20130718042445_add_cost_price_to_line_item.rb +++ b/core/db/migrate/20130718042445_add_cost_price_to_line_item.rb @@ -1,5 +1,5 @@ class AddCostPriceToLineItem < ActiveRecord::Migration def change - add_column :spree_line_items, :cost_price, :decimal, :precision => 8, :scale => 2 + add_column :spree_line_items, :cost_price, :decimal, precision: 8, scale: 2 end end diff --git a/core/db/migrate/20130718233855_set_backorderable_to_default_to_false.rb b/core/db/migrate/20130718233855_set_backorderable_to_default_to_false.rb index c05cd19426a..3040c39daa3 100644 --- a/core/db/migrate/20130718233855_set_backorderable_to_default_to_false.rb +++ b/core/db/migrate/20130718233855_set_backorderable_to_default_to_false.rb @@ -1,6 +1,6 @@ class SetBackorderableToDefaultToFalse < ActiveRecord::Migration def change - change_column :spree_stock_items, :backorderable, :boolean, :default => false - change_column :spree_stock_locations, :backorderable_default, :boolean, :default => false + change_column :spree_stock_items, :backorderable, :boolean, default: false + change_column :spree_stock_locations, :backorderable_default, :boolean, default: false end end diff --git a/core/db/migrate/20130807024301_upgrade_adjustments.rb b/core/db/migrate/20130807024301_upgrade_adjustments.rb index 6a4a68e1bde..0422de6fdea 100644 --- a/core/db/migrate/20130807024301_upgrade_adjustments.rb +++ b/core/db/migrate/20130807024301_upgrade_adjustments.rb @@ -5,7 +5,7 @@ def up belongs_to :originator, polymorphic: true end # Shipping adjustments are now tracked as fields on the object - Spree::Adjustment.where(:source_type => "Spree::Shipment").find_each do |adjustment| + Spree::Adjustment.where(source_type: "Spree::Shipment").find_each do |adjustment| # Account for possible invalid data next if adjustment.source.nil? adjustment.source.update_column(:cost, adjustment.amount) @@ -13,14 +13,14 @@ def up end # Tax adjustments have their sources altered - Spree::Adjustment.where(:originator_type => "Spree::TaxRate").find_each do |adjustment| + Spree::Adjustment.where(originator_type: "Spree::TaxRate").find_each do |adjustment| adjustment.source_id = adjustment.originator_id adjustment.source_type = "Spree::TaxRate" adjustment.save! end # Promotion adjustments have their source altered also - Spree::Adjustment.where(:originator_type => "Spree::PromotionAction").find_each do |adjustment| + Spree::Adjustment.where(originator_type: "Spree::PromotionAction").find_each do |adjustment| next if adjustment.originator.nil? adjustment.source = adjustment.originator begin diff --git a/core/db/migrate/20130813004002_add_shipment_total_to_spree_orders.rb b/core/db/migrate/20130813004002_add_shipment_total_to_spree_orders.rb index 9cafc576367..4993bdfb9dc 100644 --- a/core/db/migrate/20130813004002_add_shipment_total_to_spree_orders.rb +++ b/core/db/migrate/20130813004002_add_shipment_total_to_spree_orders.rb @@ -1,5 +1,5 @@ class AddShipmentTotalToSpreeOrders < ActiveRecord::Migration def change - add_column :spree_orders, :shipment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0, :null => false + add_column :spree_orders, :shipment_total, :decimal, precision: 10, scale: 2, default: 0.0, null: false end end diff --git a/core/db/migrate/20130813140619_expand_order_number_size.rb b/core/db/migrate/20130813140619_expand_order_number_size.rb index 6963289718e..33f44582f15 100644 --- a/core/db/migrate/20130813140619_expand_order_number_size.rb +++ b/core/db/migrate/20130813140619_expand_order_number_size.rb @@ -1,9 +1,9 @@ class ExpandOrderNumberSize < ActiveRecord::Migration def up - change_column :spree_orders, :number, :string, :limit => 32 + change_column :spree_orders, :number, :string, limit: 32 end def down - change_column :spree_orders, :number, :string, :limit => 15 + change_column :spree_orders, :number, :string, limit: 15 end end diff --git a/core/db/migrate/20130815000406_add_adjustment_total_to_line_items.rb b/core/db/migrate/20130815000406_add_adjustment_total_to_line_items.rb index 2c653ec38f9..dc63c731ef2 100644 --- a/core/db/migrate/20130815000406_add_adjustment_total_to_line_items.rb +++ b/core/db/migrate/20130815000406_add_adjustment_total_to_line_items.rb @@ -1,5 +1,5 @@ class AddAdjustmentTotalToLineItems < ActiveRecord::Migration def change - add_column :spree_line_items, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0 + add_column :spree_line_items, :adjustment_total, :decimal, precision: 10, scale: 2, default: 0.0 end end diff --git a/core/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb b/core/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb index 7c9bc0f07ee..a9baed27f31 100644 --- a/core/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb +++ b/core/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb @@ -1,5 +1,5 @@ class AddAdjustmentTotalToShipments < ActiveRecord::Migration def change - add_column :spree_shipments, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0 + add_column :spree_shipments, :adjustment_total, :decimal, precision: 10, scale: 2, default: 0.0 end end diff --git a/core/db/migrate/20130830001033_add_shipping_category_to_shipping_methods_and_products.rb b/core/db/migrate/20130830001033_add_shipping_category_to_shipping_methods_and_products.rb index 6dab377defe..a2460b3140c 100644 --- a/core/db/migrate/20130830001033_add_shipping_category_to_shipping_methods_and_products.rb +++ b/core/db/migrate/20130830001033_add_shipping_category_to_shipping_methods_and_products.rb @@ -1,7 +1,7 @@ class AddShippingCategoryToShippingMethodsAndProducts < ActiveRecord::Migration def up default_category = Spree::ShippingCategory.first - default_category ||= Spree::ShippingCategory.create!(:name => "Default") + default_category ||= Spree::ShippingCategory.create!(name: "Default") Spree::ShippingMethod.all.each do |method| method.shipping_categories << default_category if method.shipping_categories.blank? diff --git a/core/db/migrate/20131026154747_add_track_inventory_to_variant.rb b/core/db/migrate/20131026154747_add_track_inventory_to_variant.rb index c25bd4abd66..2cb247be791 100644 --- a/core/db/migrate/20131026154747_add_track_inventory_to_variant.rb +++ b/core/db/migrate/20131026154747_add_track_inventory_to_variant.rb @@ -1,5 +1,5 @@ class AddTrackInventoryToVariant < ActiveRecord::Migration def change - add_column :spree_variants, :track_inventory, :boolean, :default => true + add_column :spree_variants, :track_inventory, :boolean, default: true end end diff --git a/core/db/migrate/20131118043959_add_included_to_adjustments.rb b/core/db/migrate/20131118043959_add_included_to_adjustments.rb index 8fc88d6826f..a36dc16e49c 100644 --- a/core/db/migrate/20131118043959_add_included_to_adjustments.rb +++ b/core/db/migrate/20131118043959_add_included_to_adjustments.rb @@ -1,5 +1,5 @@ class AddIncludedToAdjustments < ActiveRecord::Migration def change - add_column :spree_adjustments, :included, :boolean, :default => false unless Spree::Adjustment.column_names.include?("included") + add_column :spree_adjustments, :included, :boolean, default: false unless Spree::Adjustment.column_names.include?("included") end end diff --git a/core/db/migrate/20131211112807_create_spree_orders_promotions.rb b/core/db/migrate/20131211112807_create_spree_orders_promotions.rb index 2deb04d0aff..a909a5a924f 100644 --- a/core/db/migrate/20131211112807_create_spree_orders_promotions.rb +++ b/core/db/migrate/20131211112807_create_spree_orders_promotions.rb @@ -1,6 +1,6 @@ class CreateSpreeOrdersPromotions < ActiveRecord::Migration def change - create_table :spree_orders_promotions, :id => false do |t| + create_table :spree_orders_promotions, id: false do |t| t.references :order t.references :promotion end diff --git a/core/db/migrate/20131218054603_add_item_count_to_spree_orders.rb b/core/db/migrate/20131218054603_add_item_count_to_spree_orders.rb index 92115af1965..11dbd12e5a8 100644 --- a/core/db/migrate/20131218054603_add_item_count_to_spree_orders.rb +++ b/core/db/migrate/20131218054603_add_item_count_to_spree_orders.rb @@ -1,5 +1,5 @@ class AddItemCountToSpreeOrders < ActiveRecord::Migration def change - add_column :spree_orders, :item_count, :integer, :default => 0 + add_column :spree_orders, :item_count, :integer, default: 0 end end diff --git a/core/db/migrate/20140219060952_add_considered_risky_to_orders.rb b/core/db/migrate/20140219060952_add_considered_risky_to_orders.rb index 7b4c4161097..4faf1c6a2c7 100644 --- a/core/db/migrate/20140219060952_add_considered_risky_to_orders.rb +++ b/core/db/migrate/20140219060952_add_considered_risky_to_orders.rb @@ -1,5 +1,5 @@ class AddConsideredRiskyToOrders < ActiveRecord::Migration def change - add_column :spree_orders, :considered_risky, :boolean, :default => false + add_column :spree_orders, :considered_risky, :boolean, default: false end end diff --git a/core/db/migrate/20140508151342_change_spree_price_amount_precision.rb b/core/db/migrate/20140508151342_change_spree_price_amount_precision.rb index f68e0961bb3..15e5fd2fc53 100644 --- a/core/db/migrate/20140508151342_change_spree_price_amount_precision.rb +++ b/core/db/migrate/20140508151342_change_spree_price_amount_precision.rb @@ -1,8 +1,8 @@ class ChangeSpreePriceAmountPrecision < ActiveRecord::Migration def change - change_column :spree_prices, :amount, :decimal, :precision => 10, :scale => 2 - change_column :spree_line_items, :price, :decimal, :precision => 10, :scale => 2 - change_column :spree_line_items, :cost_price, :decimal, :precision => 10, :scale => 2 - change_column :spree_variants, :cost_price, :decimal, :precision => 10, :scale => 2 + change_column :spree_prices, :amount, :decimal, precision: 10, scale: 2 + change_column :spree_line_items, :price, :decimal, precision: 10, scale: 2 + change_column :spree_line_items, :cost_price, :decimal, precision: 10, scale: 2 + change_column :spree_variants, :cost_price, :decimal, precision: 10, scale: 2 end end diff --git a/core/db/migrate/20140530024945_move_order_token_from_tokenized_permission.rb b/core/db/migrate/20140530024945_move_order_token_from_tokenized_permission.rb index 0e304d04c1b..804bb3af8e2 100644 --- a/core/db/migrate/20140530024945_move_order_token_from_tokenized_permission.rb +++ b/core/db/migrate/20140530024945_move_order_token_from_tokenized_permission.rb @@ -6,7 +6,7 @@ class Spree::TokenizedPermission < Spree::Base def up case Spree::Order.connection.adapter_name when 'SQLite' - Spree::Order.has_one :tokenized_permission, :as => :permissable + Spree::Order.has_one :tokenized_permission, as: :permissable Spree::Order.includes(:tokenized_permission).each do |o| o.update_column :guest_token, o.tokenized_permission.token end diff --git a/core/db/migrate/20140718195325_create_friendly_id_slugs.rb b/core/db/migrate/20140718195325_create_friendly_id_slugs.rb index 770f626446b..0699293b892 100644 --- a/core/db/migrate/20140718195325_create_friendly_id_slugs.rb +++ b/core/db/migrate/20140718195325_create_friendly_id_slugs.rb @@ -1,15 +1,15 @@ class CreateFriendlyIdSlugs < ActiveRecord::Migration def change create_table :friendly_id_slugs do |t| - t.string :slug, :null => false - t.integer :sluggable_id, :null => false - t.string :sluggable_type, :limit => 50 + t.string :slug, null: false + t.integer :sluggable_id, null: false + t.string :sluggable_type, limit: 50 t.string :scope t.datetime :created_at end add_index :friendly_id_slugs, :sluggable_id add_index :friendly_id_slugs, [:slug, :sluggable_type] - add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], :unique => true + add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], unique: true add_index :friendly_id_slugs, :sluggable_type end end diff --git a/core/lib/generators/spree/custom_user/templates/migration.rb.tt b/core/lib/generators/spree/custom_user/templates/migration.rb.tt index 620d455949a..abbf98ee133 100644 --- a/core/lib/generators/spree/custom_user/templates/migration.rb.tt +++ b/core/lib/generators/spree/custom_user/templates/migration.rb.tt @@ -1,6 +1,6 @@ class AddSpreeFieldsToCustomUserTable < ActiveRecord::Migration def up - add_column <%= table_name.inspect %>, :spree_api_key, :string, :limit => 48 + add_column <%= table_name.inspect %>, :spree_api_key, :string, limit: 48 add_column <%= table_name.inspect %>, :ship_address_id, :integer add_column <%= table_name.inspect %>, :bill_address_id, :integer end diff --git a/core/lib/generators/spree/dummy/dummy_generator.rb b/core/lib/generators/spree/dummy/dummy_generator.rb index 58a3c6f00b6..faff849b0e7 100644 --- a/core/lib/generators/spree/dummy/dummy_generator.rb +++ b/core/lib/generators/spree/dummy/dummy_generator.rb @@ -6,8 +6,8 @@ module Spree class DummyGenerator < Rails::Generators::Base desc "Creates blank Rails application, installs Spree and all sample data" - class_option :lib_name, :default => '' - class_option :database, :default => '' + class_option :lib_name, default: '' + class_option :database, default: '' def self.source_paths paths = self.superclass.source_paths @@ -41,14 +41,14 @@ def test_dummy_config @lib_name = options[:lib_name] @database = options[:database] - template "rails/database.yml", "#{dummy_path}/config/database.yml", :force => true - template "rails/boot.rb", "#{dummy_path}/config/boot.rb", :force => true - template "rails/application.rb", "#{dummy_path}/config/application.rb", :force => true - template "rails/routes.rb", "#{dummy_path}/config/routes.rb", :force => true - template "rails/test.rb", "#{dummy_path}/config/environments/test.rb", :force => true - template "rails/script/rails", "#{dummy_path}/spec/dummy/script/rails", :force => true - template "initializers/custom_user.rb", "#{dummy_path}/config/initializers/custom_user.rb", :force => true - template "initializers/devise.rb", "#{dummy_path}/config/initializers/devise.rb", :force => true + template "rails/database.yml", "#{dummy_path}/config/database.yml", force: true + template "rails/boot.rb", "#{dummy_path}/config/boot.rb", force: true + template "rails/application.rb", "#{dummy_path}/config/application.rb", force: true + template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true + template "rails/test.rb", "#{dummy_path}/config/environments/test.rb", force: true + template "rails/script/rails", "#{dummy_path}/spec/dummy/script/rails", force: true + template "initializers/custom_user.rb", "#{dummy_path}/config/initializers/custom_user.rb", force: true + template "initializers/devise.rb", "#{dummy_path}/config/initializers/devise.rb", force: true end def test_dummy_inject_extension_requirements @@ -91,7 +91,7 @@ def inject_require_for(requirement) rescue LoadError # #{requirement} is not available. end - ], :before => /require '#{@lib_name}'/, :verbose => true + ], before: /require '#{@lib_name}'/, verbose: true end def dummy_path diff --git a/core/lib/generators/spree/dummy/templates/rails/application.rb b/core/lib/generators/spree/dummy/templates/rails/application.rb index a97c3e71cac..e387ded83ba 100644 --- a/core/lib/generators/spree/dummy/templates/rails/application.rb +++ b/core/lib/generators/spree/dummy/templates/rails/application.rb @@ -2,7 +2,7 @@ require 'rails/all' -Bundler.require(*Rails.groups(:assets => %w(development test))) +Bundler.require(*Rails.groups(assets: %w(development test))) require '<%= lib_name %>' diff --git a/core/lib/generators/spree/install/install_generator.rb b/core/lib/generators/spree/install/install_generator.rb index e71cdfaa4db..3dcb037887c 100644 --- a/core/lib/generators/spree/install/install_generator.rb +++ b/core/lib/generators/spree/install/install_generator.rb @@ -5,15 +5,15 @@ module Spree class InstallGenerator < Rails::Generators::Base - class_option :migrate, :type => :boolean, :default => true, :banner => 'Run Spree migrations' - class_option :seed, :type => :boolean, :default => true, :banner => 'load seed data (migrations must be run)' - class_option :sample, :type => :boolean, :default => true, :banner => 'load sample data (migrations must be run)' - class_option :auto_accept, :type => :boolean - class_option :user_class, :type => :string - class_option :admin_email, :type => :string - class_option :admin_password, :type => :string - class_option :lib_name, :type => :string, :default => 'spree' - class_option :enforce_available_locales, :type => :boolean, :default => nil + class_option :migrate, type: :boolean, default: true, banner: 'Run Spree migrations' + class_option :seed, type: :boolean, default: true, banner: 'load seed data (migrations must be run)' + class_option :sample, type: :boolean, default: true, banner: 'load sample data (migrations must be run)' + class_option :auto_accept, type: :boolean + class_option :user_class, type: :string + class_option :admin_email, type: :string + class_option :admin_password, type: :string + class_option :lib_name, type: :string, default: 'spree' + class_option :enforce_available_locales, type: :boolean, default: nil def self.source_paths paths = self.superclass.source_paths @@ -160,7 +160,7 @@ def load_sample_data end def notify_about_routes - insert_into_file File.join('config', 'routes.rb'), :after => "Rails.application.routes.draw do\n" do + insert_into_file File.join('config', 'routes.rb'), after: "Rails.application.routes.draw do\n" do %Q{ # This line mounts Spree's routes at the root of your application. # This means, any requests to URLs such as /products, will go to Spree::ProductsController. diff --git a/core/lib/spree/core/controller_helpers/common.rb b/core/lib/spree/core/controller_helpers/common.rb index f47a553caab..a45d834206b 100644 --- a/core/lib/spree/core/controller_helpers/common.rb +++ b/core/lib/spree/core/controller_helpers/common.rb @@ -42,8 +42,8 @@ def accurate_title def render_404(exception = nil) respond_to do |type| - type.html { render :status => :not_found, :file => "#{::Rails.root}/public/404", :formats => [:html], :layout => nil} - type.all { render :status => :not_found, :nothing => true } + type.html { render status: :not_found, file: "#{::Rails.root}/public/404", formats: [:html], layout: nil} + type.all { render status: :not_found, nothing: true } end end diff --git a/core/lib/spree/core/controller_helpers/respond_with.rb b/core/lib/spree/core/controller_helpers/respond_with.rb index 66f4aaffa52..c2ca14f3ee8 100644 --- a/core/lib/spree/core/controller_helpers/respond_with.rb +++ b/core/lib/spree/core/controller_helpers/respond_with.rb @@ -52,7 +52,7 @@ def respond_override(options={}) end if format_value.is_a?(Proc) - options = {action_name.to_sym => {format_name.to_sym => {:success => format_value}}} + options = {action_name.to_sym => {format_name.to_sym => {success: format_value}}} end self.spree_responders.deep_merge!(self.name.to_sym => options) diff --git a/core/lib/spree/core/delegate_belongs_to.rb b/core/lib/spree/core/delegate_belongs_to.rb index 80e1907ec53..961e0324c8b 100644 --- a/core/lib/spree/core/delegate_belongs_to.rb +++ b/core/lib/spree/core/delegate_belongs_to.rb @@ -29,7 +29,7 @@ module ClassMethods # @todo Integrate this with ActiveRecord::Dirty, so if you set a property through one of these setters and then call save on this object, it will save the associated object automatically. # delegate_belongs_to :contact # delegate_belongs_to :contact, [:defaults] ## same as above, and useless - # delegate_belongs_to :contact, [:defaults, :address, :fullname], :class_name => 'VCard' + # delegate_belongs_to :contact, [:defaults, :address, :fullname], class_name: 'VCard' ## def delegate_belongs_to(association, *attrs) opts = attrs.extract_options! diff --git a/core/lib/spree/core/product_duplicator.rb b/core/lib/spree/core/product_duplicator.rb index 8615683cab2..4372ce0ab5b 100644 --- a/core/lib/spree/core/product_duplicator.rb +++ b/core/lib/spree/core/product_duplicator.rb @@ -58,7 +58,7 @@ def duplicate_variant(variant) def duplicate_image(image) new_image = image.dup - new_image.assign_attributes(:attachment => image.attachment.clone) + new_image.assign_attributes(attachment: image.attachment.clone) new_image end diff --git a/core/lib/spree/testing_support/caching.rb b/core/lib/spree/testing_support/caching.rb index 8405e9f4eff..f4a2fcb9e03 100644 --- a/core/lib/spree/testing_support/caching.rb +++ b/core/lib/spree/testing_support/caching.rb @@ -24,9 +24,9 @@ def clear_cache_events end RSpec.configure do |config| - config.include Spree::TestingSupport::Caching, :caching => true + config.include Spree::TestingSupport::Caching, caching: true - config.before(:each, :caching => true) do + config.before(:each, caching: true) do ActionController::Base.perform_caching = true ActiveSupport::Notifications.subscribe("read_fragment.action_controller") do |event, start_time, finish_time, _, details| @@ -40,7 +40,7 @@ def clear_cache_events end end - config.after(:each, :caching => true) do + config.after(:each, caching: true) do ActionController::Base.perform_caching = false Rails.cache.clear end diff --git a/core/lib/spree/testing_support/controller_requests.rb b/core/lib/spree/testing_support/controller_requests.rb index 2244e685a49..2455b7f4c51 100644 --- a/core/lib/spree/testing_support/controller_requests.rb +++ b/core/lib/spree/testing_support/controller_requests.rb @@ -6,7 +6,7 @@ # # require 'spree/testing_support/controller_requests' # RSpec.configure do |c| -# c.include Spree::TestingSupport::ControllerRequests, :type => :controller +# c.include Spree::TestingSupport::ControllerRequests, type: :controller # end # # Then, in your controller tests, you can access spree routes like this: @@ -85,7 +85,7 @@ def process_spree_action(action, parameters = nil, session = nil, flash = nil, m def process_spree_xhr_action(action, parameters = nil, session = nil, flash = nil, method = :get) parameters ||= {} - parameters.reverse_merge!(:format => :json) + parameters.reverse_merge!(format: :json) xml_http_request(method, action, parameters, session, flash) end end diff --git a/core/lib/spree/testing_support/order_walkthrough.rb b/core/lib/spree/testing_support/order_walkthrough.rb index cdcd8ff3f01..7ab2e5acb58 100644 --- a/core/lib/spree/testing_support/order_walkthrough.rb +++ b/core/lib/spree/testing_support/order_walkthrough.rb @@ -13,8 +13,8 @@ def self.up_to(state) # Need to create a valid zone too... zone = FactoryGirl.create(:zone) country = FactoryGirl.create(:country) - zone.members << Spree::ZoneMember.create(:zoneable => country) - country.states << FactoryGirl.create(:state, :country => country) + zone.members << Spree::ZoneMember.create(zoneable: country) + country.states << FactoryGirl.create(:state, country: country) # A shipping method must exist for rates to be displayed on checkout page unless Spree::ShippingMethod.exists? @@ -45,8 +45,8 @@ def self.add_line_item!(order) end def self.address(order) - order.bill_address = FactoryGirl.create(:address, :country_id => Spree::Zone.global.members.first.zoneable.id) - order.ship_address = FactoryGirl.create(:address, :country_id => Spree::Zone.global.members.first.zoneable.id) + order.bill_address = FactoryGirl.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id) + order.ship_address = FactoryGirl.create(:address, country_id: Spree::Zone.global.members.first.zoneable.id) order.next! end diff --git a/core/lib/tasks/core.rake b/core/lib/tasks/core.rake index c3c5a202dca..6da70e4d300 100644 --- a/core/lib/tasks/core.rake +++ b/core/lib/tasks/core.rake @@ -32,7 +32,7 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]} end desc "Migrate schema to version 0 and back up again. WARNING: Destroys all data in tables!!" - task :remigrate => :environment do + task remigrate: :environment do require 'highline/import' if ENV['SKIP_NAG'] or ENV['OVERWRITE'].to_s.downcase == 'true' or agree("This task will destroy any data in the database. Are you sure you want to \ncontinue? [y/n] ") @@ -101,7 +101,7 @@ use rake db:load_file[/absolute/path/to/sample/filename.rb]} desc "Fix orphan line items after upgrading to Spree 3.1: only needed if you have line items attached to deleted records with Slug (product) and SKU (variant) duplicates of non-deleted records." - task :fix_orphan_line_items => :environment do |t, args| + task fix_orphan_line_items: :environment do |t, args| def get_input STDOUT.flush input = STDIN.gets.chomp diff --git a/core/spec/helpers/base_helper_spec.rb b/core/spec/helpers/base_helper_spec.rb index 1a3f755c88a..dc962cc9fe8 100644 --- a/core/spec/helpers/base_helper_spec.rb +++ b/core/spec/helpers/base_helper_spec.rb @@ -25,8 +25,8 @@ context "with a checkout zone defined" do context "checkout zone is of type country" do before do - @country_zone = create(:zone, :name => "CountryZone") - @country_zone.members.create(:zoneable => country) + @country_zone = create(:zone, name: "CountryZone") + @country_zone.members.create(zoneable: country) Spree::Config[:checkout_zone] = @country_zone.name end @@ -37,9 +37,9 @@ context "checkout zone is of type state" do before do - state_zone = create(:zone, :name => "StateZone") - state = create(:state, :country => country) - state_zone.members.create(:zoneable => state) + state_zone = create(:zone, name: "StateZone") + state = create(:state, country: country) + state_zone.members.create(zoneable: state) Spree::Config[:checkout_zone] = state_zone.name end @@ -52,10 +52,10 @@ # Regression test for #1436 context "defining custom image helpers" do - let(:product) { mock_model(Spree::Product, :images => [], :variant_images => []) } + let(:product) { mock_model(Spree::Product, images: [], variant_images: []) } before do Spree::Image.class_eval do - attachment_definitions[:attachment][:styles].merge!({:very_strange => '1x1'}) + attachment_definitions[:attachment][:styles].merge!({very_strange: '1x1'}) end end @@ -104,7 +104,7 @@ def link_to_tracking_html(options = {}) # controller_name is used by this method to infer what it is supposed # to be generating meta_data_tags for text = FFaker::Lorem.paragraphs(2).join(" ") - @test = Spree::Product.new(:description => text) + @test = Spree::Product.new(description: text) tags = Nokogiri::HTML.parse(meta_data_tags) content = tags.css("meta[name=description]").first["content"] assert content.length <= 160, "content length is not truncated to 160 characters" @@ -113,10 +113,10 @@ def link_to_tracking_html(options = {}) # Regression test for #5384 context "custom image helpers conflict with inproper statements" do - let(:product) { mock_model(Spree::Product, :images => [], :variant_images => []) } + let(:product) { mock_model(Spree::Product, images: [], variant_images: []) } before do Spree::Image.class_eval do - attachment_definitions[:attachment][:styles].merge!({:foobar => '1x1'}) + attachment_definitions[:attachment][:styles].merge!({foobar: '1x1'}) end end diff --git a/core/spec/helpers/products_helper_spec.rb b/core/spec/helpers/products_helper_spec.rb index e587d9338ad..1f865001662 100644 --- a/core/spec/helpers/products_helper_spec.rb +++ b/core/spec/helpers/products_helper_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" module Spree - describe ProductsHelper, :type => :helper do + describe ProductsHelper, type: :helper do include ProductsHelper let(:product) { create(:product) } @@ -18,7 +18,7 @@ module Spree let(:variant_price) { 10 } before do - @variant = create(:variant, :product => product) + @variant = create(:variant, product: product) product.price = 15 @variant.price = 10 allow(product).to receive(:amount_in) { product_price } @@ -75,8 +75,8 @@ module Spree context "#variant_price_full" do before do Spree::Config[:show_variant_full_price] = true - @variant1 = create(:variant, :product => product) - @variant2 = create(:variant, :product => product) + @variant1 = create(:variant, product: product) + @variant2 = create(:variant, product: product) end context "when currency is default" do @@ -196,7 +196,7 @@ module Spree subject { helper.cache_key_for_products } before(:each) do @products = double('products collection') - allow(helper).to receive(:params) { {:page => 10} } + allow(helper).to receive(:params) { {page: 10} } allow(helper).to receive(:current_price_options) { price_options } end diff --git a/core/spec/lib/i18n_spec.rb b/core/spec/lib/i18n_spec.rb index cde6b7bcb8b..44c946f000a 100644 --- a/core/spec/lib/i18n_spec.rb +++ b/core/spec/lib/i18n_spec.rb @@ -6,15 +6,15 @@ before do I18n.backend.store_translations(:en, { - :spree => { - :foo => "bar", - :bar => { - :foo => "bar within bar scope", - :invalid => nil, - :legacy_translation => "back in the day..." + spree: { + foo: "bar", + bar: { + foo: "bar within bar scope", + invalid: nil, + legacy_translation: "back in the day..." }, - :invalid => nil, - :legacy_translation => "back in the day..." + invalid: nil, + legacy_translation: "back in the day..." } }) end @@ -42,11 +42,11 @@ end it "prepends a string scope" do - expect(Spree.normal_t(:foo, :scope => "bar")).to eql("bar within bar scope") + expect(Spree.normal_t(:foo, scope: "bar")).to eql("bar within bar scope") end it "prepends to an array scope" do - expect(Spree.normal_t(:foo, :scope => ["bar"])).to eql("bar within bar scope") + expect(Spree.normal_t(:foo, scope: ["bar"])).to eql("bar within bar scope") end it "returns two translations" do @@ -74,7 +74,7 @@ def assert_missing_translation(key) end it "logs missing translations" do - Spree.t(:missing, :scope => [:else, :where]) + Spree.t(:missing, scope: [:else, :where]) Spree.check_missing_translations assert_missing_translation("else") assert_missing_translation("else.where") diff --git a/core/spec/lib/search/base_spec.rb b/core/spec/lib/search/base_spec.rb index 26d82fb1389..8f48dbbc1c2 100644 --- a/core/spec/lib/search/base_spec.rb +++ b/core/spec/lib/search/base_spec.rb @@ -12,7 +12,7 @@ end it "returns all products by default" do - params = { :per_page => "" } + params = { per_page: "" } searcher = Spree::Core::Search::Base.new(params) expect(searcher.retrieve_products.count).to eq(2) end @@ -34,28 +34,28 @@ end it "switches to next page according to the page parameter" do - @product3 = create(:product, :name => "RoR Pants", :price => 14.00) + @product3 = create(:product, name: "RoR Pants", price: 14.00) - params = { :per_page => "2" } + params = { per_page: "2" } searcher = Spree::Core::Search::Base.new(params) expect(searcher.retrieve_products.count).to eq(2) - params.merge! :page => "2" + params.merge! page: "2" searcher = Spree::Core::Search::Base.new(params) expect(searcher.retrieve_products.count).to eq(1) end it "maps search params to named scopes" do - params = { :per_page => "", - :search => { "price_range_any" => ["Under $10.00"] }} + params = { per_page: "", + search: { "price_range_any" => ["Under $10.00"] }} searcher = Spree::Core::Search::Base.new(params) expect(searcher.send(:get_base_scope).to_sql).to match /<= 10/ expect(searcher.retrieve_products.count).to eq(1) end it "maps multiple price_range_any filters" do - params = { :per_page => "", - :search => { "price_range_any" => ["Under $10.00", "$10.00 - $15.00"] }} + params = { per_page: "", + search: { "price_range_any" => ["Under $10.00", "$10.00 - $15.00"] }} searcher = Spree::Core::Search::Base.new(params) expect(searcher.send(:get_base_scope).to_sql).to match /<= 10/ expect(searcher.send(:get_base_scope).to_sql).to match /between 10 and 15/i @@ -63,8 +63,8 @@ end it "uses ransack if scope not found" do - params = { :per_page => "", - :search => { "name_not_cont" => "Shirt" }} + params = { per_page: "", + search: { "name_not_cont" => "Shirt" }} searcher = Spree::Core::Search::Base.new(params) expect(searcher.retrieve_products.count).to eq(1) end @@ -77,7 +77,7 @@ end it "finds products in alternate currencies" do - price = create(:price, :currency => 'EUR', :variant => @product1.master) + price = create(:price, currency: 'EUR', variant: @product1.master) searcher = Spree::Core::Search::Base.new({}) searcher.current_currency = 'EUR' expect(searcher.retrieve_products).to eq([@product1]) diff --git a/core/spec/lib/spree/localized_number_spec.rb b/core/spec/lib/spree/localized_number_spec.rb index 62da9ec9af0..2943e20459d 100644 --- a/core/spec/lib/spree/localized_number_spec.rb +++ b/core/spec/lib/spree/localized_number_spec.rb @@ -6,7 +6,7 @@ before do I18n.enforce_available_locales = false I18n.locale = I18n.default_locale - I18n.backend.store_translations(:de, { :number => { :currency => { :format => { :delimiter => '.', :separator => ',' } } } }) + I18n.backend.store_translations(:de, { number: { currency: { format: { delimiter: '.', separator: ',' } } } }) end after do diff --git a/core/spec/lib/spree/money_spec.rb b/core/spec/lib/spree/money_spec.rb index f0c8d40388c..0824894282e 100644 --- a/core/spec/lib/spree/money_spec.rb +++ b/core/spec/lib/spree/money_spec.rb @@ -20,7 +20,7 @@ context "with currency" do it "passed in option" do - money = Spree::Money.new(10, :with_currency => true, :html => false) + money = Spree::Money.new(10, with_currency: true, html: false) expect(money.to_s).to eq("$10.00 USD") end end @@ -40,14 +40,14 @@ context "currency parameter" do context "when currency is specified in Canadian Dollars" do it "uses the currency param over the global configuration" do - money = Spree::Money.new(10, :currency => 'CAD', :with_currency => true, :html => false) + money = Spree::Money.new(10, currency: 'CAD', with_currency: true, html: false) expect(money.to_s).to eq("$10.00 CAD") end end context "when currency is specified in Japanese Yen" do it "uses the currency param over the global configuration" do - money = Spree::Money.new(100, :currency => 'JPY', :html => false) + money = Spree::Money.new(100, currency: 'JPY', html: false) expect(money.to_s).to eq("¥100") end end @@ -55,7 +55,7 @@ context "symbol positioning" do it "passed in option" do - money = Spree::Money.new(10, :symbol_position => :after, :html => false) + money = Spree::Money.new(10, symbol_position: :after, html: false) expect(money.to_s).to eq("10.00 $") end end @@ -67,7 +67,7 @@ end it "passed in option" do - money = Spree::Money.new(-10, :sign_before_symbol => false) + money = Spree::Money.new(-10, sign_before_symbol: false) expect(money.to_s).to eq("$-10.00") end end @@ -80,7 +80,7 @@ end it "formats correctly" do - money = Spree::Money.new(1000, :html => false) + money = Spree::Money.new(1000, html: false) expect(money.to_s).to eq("¥1,000") end end diff --git a/core/spec/mailers/reimbursement_mailer_spec.rb b/core/spec/mailers/reimbursement_mailer_spec.rb index 998c0e0a0af..262ae86f8c1 100644 --- a/core/spec/mailers/reimbursement_mailer_spec.rb +++ b/core/spec/mailers/reimbursement_mailer_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'email_spec' -describe Spree::ReimbursementMailer, :type => :mailer do +describe Spree::ReimbursementMailer, type: :mailer do include EmailSpec::Helpers include EmailSpec::Matchers @@ -27,7 +27,7 @@ context "pt-BR locale" do before do I18n.enforce_available_locales = false - pt_br_shipped_email = { :spree => { :reimbursement_mailer => { :reimbursement_email => { :dear_customer => 'Caro Cliente,' } } } } + pt_br_shipped_email = { spree: { reimbursement_mailer: { reimbursement_email: { dear_customer: 'Caro Cliente,' } } } } I18n.backend.store_translations :'pt-BR', pt_br_shipped_email I18n.locale = :'pt-BR' end diff --git a/core/spec/mailers/test_mailer_spec.rb b/core/spec/mailers/test_mailer_spec.rb index 6ab3dbd985d..3c217cd2fad 100644 --- a/core/spec/mailers/test_mailer_spec.rb +++ b/core/spec/mailers/test_mailer_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'email_spec' -describe Spree::TestMailer, :type => :mailer do +describe Spree::TestMailer, type: :mailer do include EmailSpec::Helpers include EmailSpec::Matchers diff --git a/core/spec/models/spree/ability_spec.rb b/core/spec/models/spree/ability_spec.rb index 9bf4a51ee82..1a62751fa86 100644 --- a/core/spec/models/spree/ability_spec.rb +++ b/core/spec/models/spree/ability_spec.rb @@ -17,7 +17,7 @@ def initialize(user) end end -describe Spree::Ability, :type => :model do +describe Spree::Ability, type: :model do let(:user) { build(:user) } let(:ability) { Spree::Ability.new(user) } let(:token) { nil } @@ -34,7 +34,7 @@ def initialize(user) it 'should apply the registered abilities permissions' do Spree::Ability.register_ability(FooAbility) - expect(Spree::Ability.new(user).can?(:update, mock_model(Spree::Order, :id => 1))).to be true + expect(Spree::Ability.new(user).can?(:update, mock_model(Spree::Order, id: 1))).to be true end end diff --git a/core/spec/models/spree/address_spec.rb b/core/spec/models/spree/address_spec.rb index 055c902c776..cf90b2185e4 100644 --- a/core/spec/models/spree/address_spec.rb +++ b/core/spec/models/spree/address_spec.rb @@ -10,18 +10,18 @@ it "creates a copy of the address with the exception of the id, updated_at and created_at attributes" do state = create(:state) original = create(:address, - :address1 => 'address1', - :address2 => 'address2', - :alternative_phone => 'alternative_phone', - :city => 'city', - :country => Spree::Country.first, - :firstname => 'firstname', - :lastname => 'lastname', - :company => 'company', - :phone => 'phone', - :state_id => state.id, - :state_name => state.name, - :zipcode => '10001') + address1: 'address1', + address2: 'address2', + alternative_phone: 'alternative_phone', + city: 'city', + country: Spree::Country.first, + firstname: 'firstname', + lastname: 'lastname', + company: 'company', + phone: 'phone', + state_id: state.id, + state_name: state.name, + zipcode: '10001') cloned = original.clone @@ -65,12 +65,12 @@ end end - let(:country) { mock_model(Spree::Country, :states => [state], :states_required => true) } - let(:state) { stub_model(Spree::State, :name => 'maryland', :abbr => 'md') } - let(:address) { build(:address, :country => country) } + let(:country) { mock_model(Spree::Country, states: [state], states_required: true) } + let(:state) { stub_model(Spree::State, name: 'maryland', abbr: 'md') } + let(:address) { build(:address, country: country) } before do - allow(country.states).to receive_messages :find_all_by_name_or_abbr => [state] + allow(country.states).to receive_messages find_all_by_name_or_abbr: [state] end it "state_name is not nil and country does not have any states" do @@ -103,7 +103,7 @@ it "state is entered but country does not contain that state" do address.state = state - address.country = stub_model(Spree::Country, :states_required => true) + address.country = stub_model(Spree::Country, states_required: true) address.valid? expect(address.errors["state"]).to eq(['is invalid']) end @@ -111,7 +111,7 @@ it "both state and state_name are entered but country does not contain the state" do address.state = state address.state_name = 'maryland' - address.country = stub_model(Spree::Country, :states_required => true) + address.country = stub_model(Spree::Country, states_required: true) expect(address).to be_valid expect(address.state_id).to be_nil end @@ -124,7 +124,7 @@ end it "address_requires_state preference is false" do - Spree::Config.set :address_requires_state => false + Spree::Config.set address_requires_state: false address.state = nil address.state_name = nil expect(address).to be_valid @@ -246,22 +246,22 @@ context '#full_name' do context 'both first and last names are present' do - let(:address) { stub_model(Spree::Address, :firstname => 'Michael', :lastname => 'Jackson') } + let(:address) { stub_model(Spree::Address, firstname: 'Michael', lastname: 'Jackson') } specify { expect(address.full_name).to eq('Michael Jackson') } end context 'first name is blank' do - let(:address) { stub_model(Spree::Address, :firstname => nil, :lastname => 'Jackson') } + let(:address) { stub_model(Spree::Address, firstname: nil, lastname: 'Jackson') } specify { expect(address.full_name).to eq('Jackson') } end context 'last name is blank' do - let(:address) { stub_model(Spree::Address, :firstname => 'Michael', :lastname => nil) } + let(:address) { stub_model(Spree::Address, firstname: 'Michael', lastname: nil) } specify { expect(address.full_name).to eq('Michael') } end context 'both first and last names are blank' do - let(:address) { stub_model(Spree::Address, :firstname => nil, :lastname => nil) } + let(:address) { stub_model(Spree::Address, firstname: nil, lastname: nil) } specify { expect(address.full_name).to eq('') } end @@ -269,19 +269,19 @@ context '#state_text' do context 'state is blank' do - let(:address) { stub_model(Spree::Address, :state => nil, :state_name => 'virginia') } + let(:address) { stub_model(Spree::Address, state: nil, state_name: 'virginia') } specify { expect(address.state_text).to eq('virginia') } end context 'both name and abbr is present' do - let(:state) { stub_model(Spree::State, :name => 'virginia', :abbr => 'va') } - let(:address) { stub_model(Spree::Address, :state => state) } + let(:state) { stub_model(Spree::State, name: 'virginia', abbr: 'va') } + let(:address) { stub_model(Spree::Address, state: state) } specify { expect(address.state_text).to eq('va') } end context 'only name is present' do - let(:state) { stub_model(Spree::State, :name => 'virginia', :abbr => nil) } - let(:address) { stub_model(Spree::Address, :state => state) } + let(:state) { stub_model(Spree::State, name: 'virginia', abbr: nil) } + let(:address) { stub_model(Spree::Address, state: state) } specify { expect(address.state_text).to eq('virginia') } end end diff --git a/core/spec/models/spree/adjustment_spec.rb b/core/spec/models/spree/adjustment_spec.rb index 7404fcf7144..f8f92d1c916 100644 --- a/core/spec/models/spree/adjustment_spec.rb +++ b/core/spec/models/spree/adjustment_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' -describe Spree::Adjustment, :type => :model do +describe Spree::Adjustment, type: :model do let(:order) { Spree::Order.new } diff --git a/core/spec/models/spree/app_configuration_spec.rb b/core/spec/models/spree/app_configuration_spec.rb index fd2443af2b4..a9b5dda0c67 100644 --- a/core/spec/models/spree/app_configuration_spec.rb +++ b/core/spec/models/spree/app_configuration_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::AppConfiguration, :type => :model do +describe Spree::AppConfiguration, type: :model do let (:prefs) { Rails.application.config.spree.preferences } it "should be available from the environment" do diff --git a/core/spec/models/spree/asset_spec.rb b/core/spec/models/spree/asset_spec.rb index 0f400d872dc..5807501bede 100644 --- a/core/spec/models/spree/asset_spec.rb +++ b/core/spec/models/spree/asset_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Asset, :type => :model do +describe Spree::Asset, type: :model do describe "#viewable" do it "touches association" do product = create(:custom_product) diff --git a/core/spec/models/spree/calculator/flat_percent_item_total_spec.rb b/core/spec/models/spree/calculator/flat_percent_item_total_spec.rb index 404f38aa2c1..65e21f48270 100644 --- a/core/spec/models/spree/calculator/flat_percent_item_total_spec.rb +++ b/core/spec/models/spree/calculator/flat_percent_item_total_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Calculator::FlatPercentItemTotal, :type => :model do +describe Spree::Calculator::FlatPercentItemTotal, type: :model do let(:calculator) { Spree::Calculator::FlatPercentItemTotal.new } let(:line_item) { mock_model Spree::LineItem } diff --git a/core/spec/models/spree/calculator/flexi_rate_spec.rb b/core/spec/models/spree/calculator/flexi_rate_spec.rb index 1d720a814fa..2587e039b8f 100644 --- a/core/spec/models/spree/calculator/flexi_rate_spec.rb +++ b/core/spec/models/spree/calculator/flexi_rate_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Calculator::FlexiRate, :type => :model do +describe Spree::Calculator::FlexiRate, type: :model do let(:calculator) { Spree::Calculator::FlexiRate.new } let(:order) do @@ -15,27 +15,27 @@ end it "should compute amount correctly when first_item has a value" do - allow(calculator).to receive_messages :preferred_first_item => 1.0 + allow(calculator).to receive_messages preferred_first_item: 1.0 expect(calculator.compute(order).round(2)).to eq(1.0) end it "should compute amount correctly when additional_items has a value" do - allow(calculator).to receive_messages :preferred_additional_item => 1.0 + allow(calculator).to receive_messages preferred_additional_item: 1.0 expect(calculator.compute(order).round(2)).to eq(9.0) end it "should compute amount correctly when additional_items and first_item have values" do - allow(calculator).to receive_messages :preferred_first_item => 5.0, :preferred_additional_item => 1.0 + allow(calculator).to receive_messages preferred_first_item: 5.0, preferred_additional_item: 1.0 expect(calculator.compute(order).round(2)).to eq(14.0) end it "should compute amount correctly when additional_items and first_item have values AND max items has value" do - allow(calculator).to receive_messages :preferred_first_item => 5.0, :preferred_additional_item => 1.0, :preferred_max_items => 3 + allow(calculator).to receive_messages preferred_first_item: 5.0, preferred_additional_item: 1.0, preferred_max_items: 3 expect(calculator.compute(order).round(2)).to eq(7.0) end it "should allow creation of new object with all the attributes" do - Spree::Calculator::FlexiRate.new(:preferred_first_item => 1, :preferred_additional_item => 1, :preferred_max_items => 1) + Spree::Calculator::FlexiRate.new(preferred_first_item: 1, preferred_additional_item: 1, preferred_max_items: 1) end end end diff --git a/core/spec/models/spree/calculator/percent_on_line_item_spec.rb b/core/spec/models/spree/calculator/percent_on_line_item_spec.rb index 88f8aa095af..0a47c2c75cf 100644 --- a/core/spec/models/spree/calculator/percent_on_line_item_spec.rb +++ b/core/spec/models/spree/calculator/percent_on_line_item_spec.rb @@ -2,7 +2,7 @@ module Spree class Calculator - describe PercentOnLineItem, :type => :model do + describe PercentOnLineItem, type: :model do let(:line_item) { double("LineItem", amount: 100) } before { subject.preferred_percent = 15 } diff --git a/core/spec/models/spree/calculator/price_sack_spec.rb b/core/spec/models/spree/calculator/price_sack_spec.rb index d4105c50089..6e6aaaa6f36 100644 --- a/core/spec/models/spree/calculator/price_sack_spec.rb +++ b/core/spec/models/spree/calculator/price_sack_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Calculator::PriceSack, :type => :model do +describe Spree::Calculator::PriceSack, type: :model do let(:calculator) do calculator = Spree::Calculator::PriceSack.new calculator.preferred_minimal_amount = 5 @@ -10,7 +10,7 @@ end let(:order) { stub_model(Spree::Order) } - let(:shipment) { stub_model(Spree::Shipment, :amount => 10) } + let(:shipment) { stub_model(Spree::Shipment, amount: 10) } # Regression test for #714 and #739 it "computes with an order object" do diff --git a/core/spec/models/spree/calculator/refunds/default_refund_amount_spec.rb b/core/spec/models/spree/calculator/refunds/default_refund_amount_spec.rb index 11d89a0b23d..5945a8c3630 100644 --- a/core/spec/models/spree/calculator/refunds/default_refund_amount_spec.rb +++ b/core/spec/models/spree/calculator/refunds/default_refund_amount_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Calculator::Returns::DefaultRefundAmount, :type => :model do +describe Spree::Calculator::Returns::DefaultRefundAmount, type: :model do let(:order) { create(:order) } let(:line_item_quantity) { 2 } let(:item_price) { 100.0 } diff --git a/core/spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb b/core/spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb index a0e5323bff3..0b14c9ee833 100644 --- a/core/spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb +++ b/core/spec/models/spree/calculator/shipping/flat_percent_item_total_spec.rb @@ -2,9 +2,9 @@ module Spree module Calculator::Shipping - describe FlatPercentItemTotal, :type => :model do - let(:variant1) { build(:variant, :price => 10.11) } - let(:variant2) { build(:variant, :price => 20.2222) } + describe FlatPercentItemTotal, type: :model do + let(:variant1) { build(:variant, price: 10.11) } + let(:variant2) { build(:variant, price: 20.2222) } let(:line_item1) { build(:line_item, variant: variant1) } let(:line_item2) { build(:line_item, variant: variant2) } @@ -13,7 +13,7 @@ module Calculator::Shipping build(:stock_package, variants_contents: { variant1 => 2, variant2 => 1 }) end - subject { FlatPercentItemTotal.new(:preferred_flat_percent => 10) } + subject { FlatPercentItemTotal.new(preferred_flat_percent: 10) } it "should round result correctly" do expect(subject.compute(package)).to eq(4.04) diff --git a/core/spec/models/spree/calculator/shipping/flat_rate_spec.rb b/core/spec/models/spree/calculator/shipping/flat_rate_spec.rb index 41b84ed9c9b..280679564d3 100644 --- a/core/spec/models/spree/calculator/shipping/flat_rate_spec.rb +++ b/core/spec/models/spree/calculator/shipping/flat_rate_spec.rb @@ -2,8 +2,8 @@ module Spree module Calculator::Shipping - describe FlatRate, :type => :model do - subject { Calculator::Shipping::FlatRate.new(:preferred_amount => 4.00) } + describe FlatRate, type: :model do + subject { Calculator::Shipping::FlatRate.new(preferred_amount: 4.00) } it 'always returns the same rate' do expect(subject.compute(build(:stock_package_fulfilled))).to eql 4.00 diff --git a/core/spec/models/spree/calculator/shipping/flexi_rate_spec.rb b/core/spec/models/spree/calculator/shipping/flexi_rate_spec.rb index f4bda317135..0a83bd30e85 100644 --- a/core/spec/models/spree/calculator/shipping/flexi_rate_spec.rb +++ b/core/spec/models/spree/calculator/shipping/flexi_rate_spec.rb @@ -2,9 +2,9 @@ module Spree module Calculator::Shipping - describe FlexiRate, :type => :model do - let(:variant1) { build(:variant, :price => 10) } - let(:variant2) { build(:variant, :price => 20) } + describe FlexiRate, type: :model do + let(:variant1) { build(:variant, price: 10) } + let(:variant2) { build(:variant, price: 20) } let(:package) do build(:stock_package, variants_contents: { variant1 => 4, variant2 => 6 }) @@ -41,9 +41,9 @@ module Calculator::Shipping end it "should allow creation of new object with all the attributes" do - FlexiRate.new(:preferred_first_item => 1, - :preferred_additional_item => 1, - :preferred_max_items => 1) + FlexiRate.new(preferred_first_item: 1, + preferred_additional_item: 1, + preferred_max_items: 1) end end end diff --git a/core/spec/models/spree/calculator/shipping/per_item_spec.rb b/core/spec/models/spree/calculator/shipping/per_item_spec.rb index 91446f37e88..3cf1d751437 100644 --- a/core/spec/models/spree/calculator/shipping/per_item_spec.rb +++ b/core/spec/models/spree/calculator/shipping/per_item_spec.rb @@ -2,7 +2,7 @@ module Spree module Calculator::Shipping - describe PerItem, :type => :model do + describe PerItem, type: :model do let(:variant1) { build(:variant) } let(:variant2) { build(:variant) } @@ -10,7 +10,7 @@ module Calculator::Shipping build(:stock_package, variants_contents: { variant1 => 5, variant2 => 3 }) end - subject { PerItem.new(:preferred_amount => 10) } + subject { PerItem.new(preferred_amount: 10) } it "correctly calculates per item shipping" do expect(subject.compute(package).to_f).to eq(80) # 5 x 10 + 3 x 10 diff --git a/core/spec/models/spree/calculator/tiered_flat_rate_spec.rb b/core/spec/models/spree/calculator/tiered_flat_rate_spec.rb index 8c974ed8a7b..f542a0c6b17 100644 --- a/core/spec/models/spree/calculator/tiered_flat_rate_spec.rb +++ b/core/spec/models/spree/calculator/tiered_flat_rate_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Calculator::TieredFlatRate, :type => :model do +describe Spree::Calculator::TieredFlatRate, type: :model do let(:calculator) { Spree::Calculator::TieredFlatRate.new } describe "#valid?" do diff --git a/core/spec/models/spree/calculator/tiered_percent_spec.rb b/core/spec/models/spree/calculator/tiered_percent_spec.rb index 9b2bd4b45be..e873792d2ea 100644 --- a/core/spec/models/spree/calculator/tiered_percent_spec.rb +++ b/core/spec/models/spree/calculator/tiered_percent_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Calculator::TieredPercent, :type => :model do +describe Spree::Calculator::TieredPercent, type: :model do let(:calculator) { Spree::Calculator::TieredPercent.new } describe "#valid?" do diff --git a/core/spec/models/spree/calculator_spec.rb b/core/spec/models/spree/calculator_spec.rb index 6d68089472b..9d6eb540e24 100644 --- a/core/spec/models/spree/calculator_spec.rb +++ b/core/spec/models/spree/calculator_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -describe Spree::Calculator, :type => :model do +describe Spree::Calculator, type: :model do let(:order) { create(:order) } - let!(:line_item) { create(:line_item, :order => order) } - let(:shipment) { create(:shipment, :order => order, :stock_location => create(:stock_location_with_items)) } + let!(:line_item) { create(:line_item, order: order) } + let(:shipment) { create(:shipment, order: order, stock_location: create(:stock_location_with_items)) } context "with computable" do context "and compute methods stubbed out" do diff --git a/core/spec/models/spree/classification_spec.rb b/core/spec/models/spree/classification_spec.rb index 1ff5ea6bef1..d5dd520a4fa 100644 --- a/core/spec/models/spree/classification_spec.rb +++ b/core/spec/models/spree/classification_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Classification, :type => :model do + describe Classification, type: :model do # Regression test for #3494 it "cannot link the same taxon to the same product more than once" do product = create(:product) diff --git a/core/spec/models/spree/credit_card_spec.rb b/core/spec/models/spree/credit_card_spec.rb index 24908ed3222..ad1c2c84d6b 100644 --- a/core/spec/models/spree/credit_card_spec.rb +++ b/core/spec/models/spree/credit_card_spec.rb @@ -19,7 +19,7 @@ def self.payment_states before(:each) do @order = create(:order) - @payment = Spree::Payment.create(:amount => 100, :order => @order) + @payment = Spree::Payment.create(amount: 100, order: @order) @success_response = double('gateway_response', success?: true, authorization: '123', avs_result: { 'code' => 'avs-code' }) @fail_response = double('gateway_response', success?: false) diff --git a/core/spec/models/spree/exchange_spec.rb b/core/spec/models/spree/exchange_spec.rb index 66c895b09a9..d0c40d932f7 100644 --- a/core/spec/models/spree/exchange_spec.rb +++ b/core/spec/models/spree/exchange_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Exchange, :type => :model do + describe Exchange, type: :model do let(:order) { Spree::Order.new } let(:return_item_1) { build(:exchange_return_item) } diff --git a/core/spec/models/spree/gateway/bogus_simple.rb b/core/spec/models/spree/gateway/bogus_simple.rb index 1d632fce4b1..6eaccfd6521 100644 --- a/core/spec/models/spree/gateway/bogus_simple.rb +++ b/core/spec/models/spree/gateway/bogus_simple.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Gateway::BogusSimple, :type => :model do +describe Spree::Gateway::BogusSimple, type: :model do subject { Spree::Gateway::BogusSimple.new } diff --git a/core/spec/models/spree/gateway/bogus_spec.rb b/core/spec/models/spree/gateway/bogus_spec.rb index 89ca1dd045a..2c716a50932 100644 --- a/core/spec/models/spree/gateway/bogus_spec.rb +++ b/core/spec/models/spree/gateway/bogus_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Gateway::Bogus, :type => :model do + describe Gateway::Bogus, type: :model do let(:bogus) { create(:credit_card_payment_method) } let!(:cc) { create(:credit_card, payment_method: bogus, gateway_customer_profile_id: "BGS-RERTERT") } diff --git a/core/spec/models/spree/gateway_spec.rb b/core/spec/models/spree/gateway_spec.rb index c0c5b71e1b3..a5fbf6ddf9b 100644 --- a/core/spec/models/spree/gateway_spec.rb +++ b/core/spec/models/spree/gateway_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Gateway, :type => :model do +describe Spree::Gateway, type: :model do class Provider def initialize(options) end diff --git a/core/spec/models/spree/image_spec.rb b/core/spec/models/spree/image_spec.rb index f206d8a1017..5413e868b3e 100644 --- a/core/spec/models/spree/image_spec.rb +++ b/core/spec/models/spree/image_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Image, :type => :model do +describe Spree::Image, type: :model do describe 'callbacks' do it { is_expected.to callback(:find_dimensions).before(:save).if(:attachment_updated_at_changed?) } diff --git a/core/spec/models/spree/inventory_unit_spec.rb b/core/spec/models/spree/inventory_unit_spec.rb index d0090b6fe16..0ccb0c483d5 100644 --- a/core/spec/models/spree/inventory_unit_spec.rb +++ b/core/spec/models/spree/inventory_unit_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::InventoryUnit, :type => :model do +describe Spree::InventoryUnit, type: :model do let(:stock_location) { create(:stock_location_with_items) } let(:stock_item) { stock_location.stock_items.order(:id).first } diff --git a/core/spec/models/spree/option_type_spec.rb b/core/spec/models/spree/option_type_spec.rb index f34d8e75e79..10c4cb992f3 100644 --- a/core/spec/models/spree/option_type_spec.rb +++ b/core/spec/models/spree/option_type_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::OptionType, :type => :model do +describe Spree::OptionType, type: :model do context "touching" do it "should touch a product" do product_option_type = create(:product_option_type) diff --git a/core/spec/models/spree/order/address_spec.rb b/core/spec/models/spree/order/address_spec.rb index 9f95df5bb23..803a87900fe 100644 --- a/core/spec/models/spree/order/address_spec.rb +++ b/core/spec/models/spree/order/address_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Order, :type => :model do +describe Spree::Order, type: :model do let(:order) { Spree::Order.new } context 'validation' do diff --git a/core/spec/models/spree/order/adjustments_spec.rb b/core/spec/models/spree/order/adjustments_spec.rb index 690d88e4786..b79b2802112 100644 --- a/core/spec/models/spree/order/adjustments_spec.rb +++ b/core/spec/models/spree/order/adjustments_spec.rb @@ -13,7 +13,7 @@ before do # Don't care about available payment methods in this test - allow(persisted_order).to receive_messages(:has_available_payment => false) + allow(persisted_order).to receive_messages(has_available_payment: false) persisted_order.line_items << line_item create(:adjustment, amount: -line_item.amount, label: "Promotion", adjustable: line_item, order: persisted_order) persisted_order.state = 'delivery' diff --git a/core/spec/models/spree/order/callbacks_spec.rb b/core/spec/models/spree/order/callbacks_spec.rb index 43eecb3abac..6be61ebc9af 100644 --- a/core/spec/models/spree/order/callbacks_spec.rb +++ b/core/spec/models/spree/order/callbacks_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Order, :type => :model do +describe Spree::Order, type: :model do let(:order) { stub_model(Spree::Order) } before do Spree::Order.define_state_machine! @@ -19,10 +19,10 @@ context "#save" do context "when associated with a registered user" do - let(:user) { double(:user, :email => "test@example.com") } + let(:user) { double(:user, email: "test@example.com") } before do - allow(order).to receive_messages :user => user + allow(order).to receive_messages user: user end it "should assign the email address of the user" do diff --git a/core/spec/models/spree/order/checkout_spec.rb b/core/spec/models/spree/order/checkout_spec.rb index 4f53ec23f21..a548671ea5e 100644 --- a/core/spec/models/spree/order/checkout_spec.rb +++ b/core/spec/models/spree/order/checkout_spec.rb @@ -1,37 +1,37 @@ require 'spec_helper' require 'spree/testing_support/order_walkthrough' -describe Spree::Order, :type => :model do +describe Spree::Order, type: :model do let(:order) { Spree::Order.new } before { create(:store) } def assert_state_changed(order, from, to) - state_change_exists = order.state_changes.where(:previous_state => from, :next_state => to).exists? + state_change_exists = order.state_changes.where(previous_state: from, next_state: to).exists? assert state_change_exists, "Expected order to transition from #{from} to #{to}, but didn't." end context "with default state machine" do let(:transitions) do [ - { :address => :delivery }, - { :delivery => :payment }, - { :payment => :confirm }, - { :confirm => :complete }, - { :payment => :complete }, - { :delivery => :complete } + { address: :delivery }, + { delivery: :payment }, + { payment: :confirm }, + { confirm: :complete }, + { payment: :complete }, + { delivery: :complete } ] end it "has the following transitions" do transitions.each do |transition| - transition = Spree::Order.find_transition(:from => transition.keys.first, :to => transition.values.first) + transition = Spree::Order.find_transition(from: transition.keys.first, to: transition.values.first) expect(transition).not_to be_nil end end it "does not have a transition from delivery to confirm" do - transition = Spree::Order.find_transition(:from => :delivery, :to => :confirm) + transition = Spree::Order.find_transition(from: :delivery, to: :confirm) expect(transition).to be_nil end @@ -40,7 +40,7 @@ def assert_state_changed(order, from, to) end it '.remove_transition' do - options = {:from => transitions.first.keys.first, :to => transitions.first.values.first} + options = {from: transitions.first.keys.first, to: transitions.first.values.first} expect(Spree::Order).to receive_messages( removed_transitions: [], next_event_transitions: transitions.dup @@ -60,7 +60,7 @@ def assert_state_changed(order, from, to) end it "passes delivery state when transitioning from address over delivery to payment" do - allow(order).to receive_messages :payment_required? => true + allow(order).to receive_messages payment_required?: true order.state = "address" expect(order.passed_checkout_step?("delivery")).to be false order.state = "delivery" @@ -72,8 +72,8 @@ def assert_state_changed(order, from, to) context "#checkout_steps" do context "when confirmation not required" do before do - allow(order).to receive_messages :confirmation_required? => false - allow(order).to receive_messages :payment_required? => true + allow(order).to receive_messages confirmation_required?: false + allow(order).to receive_messages payment_required?: true end specify do @@ -83,8 +83,8 @@ def assert_state_changed(order, from, to) context "when confirmation required" do before do - allow(order).to receive_messages :confirmation_required? => true - allow(order).to receive_messages :payment_required? => true + allow(order).to receive_messages confirmation_required?: true + allow(order).to receive_messages payment_required?: true end specify do @@ -93,14 +93,14 @@ def assert_state_changed(order, from, to) end context "when payment not required" do - before { allow(order).to receive_messages :payment_required? => false } + before { allow(order).to receive_messages payment_required?: false } specify do expect(order.checkout_steps).to eq(%w(address delivery complete)) end end context "when payment required" do - before { allow(order).to receive_messages :payment_required? => true } + before { allow(order).to receive_messages payment_required?: true } specify do expect(order.checkout_steps).to eq(%w(address delivery payment complete)) end @@ -171,19 +171,19 @@ def assert_state_changed(order, from, to) before do order.state = 'address' allow(order).to receive(:has_available_payment) - shipment = FactoryGirl.create(:shipment, :order => order) + shipment = FactoryGirl.create(:shipment, order: order) order.email = "user@example.com" order.save! end it "updates totals" do - allow(order).to receive_messages(:ensure_available_shipping_rates => true) - line_item = FactoryGirl.create(:line_item, :price => 10, :adjustment_total => 10) + allow(order).to receive_messages(ensure_available_shipping_rates: true) + line_item = FactoryGirl.create(:line_item, price: 10, adjustment_total: 10) line_item.variant.update_attributes!(price: 10) order.line_items << line_item - tax_rate = create(:tax_rate, :tax_category => line_item.tax_category, :amount => 0.05) - allow(Spree::TaxRate).to receive_messages :match => [tax_rate] - FactoryGirl.create(:tax_adjustment, :adjustable => line_item, :source => tax_rate, order: order) + tax_rate = create(:tax_rate, tax_category: line_item.tax_category, amount: 0.05) + allow(Spree::TaxRate).to receive_messages match: [tax_rate] + FactoryGirl.create(:tax_adjustment, adjustable: line_item, source: tax_rate, order: order) order.email = "user@example.com" order.next! expect(order.adjustment_total).to eq(0.5) @@ -215,7 +215,7 @@ def assert_state_changed(order, from, to) end it "transitions to delivery" do - allow(order).to receive_messages(:ensure_available_shipping_rates => true) + allow(order).to receive_messages(ensure_available_shipping_rates: true) order.next! assert_state_changed(order, 'address', 'delivery') expect(order.state).to eq("delivery") @@ -223,7 +223,7 @@ def assert_state_changed(order, from, to) it "does not call persist_order_address if there is no address on the order" do # otherwise, it will crash - allow(order).to receive_messages(:ensure_available_shipping_rates => true) + allow(order).to receive_messages(ensure_available_shipping_rates: true) order.user = FactoryGirl.create(:user) order.save! @@ -233,7 +233,7 @@ def assert_state_changed(order, from, to) end it "calls persist_order_address on the order's user" do - allow(order).to receive_messages(:ensure_available_shipping_rates => true) + allow(order).to receive_messages(ensure_available_shipping_rates: true) order.user = FactoryGirl.create(:user) order.ship_address = FactoryGirl.create(:address) @@ -245,7 +245,7 @@ def assert_state_changed(order, from, to) end it "does not call persist_order_address on the order's user for a temporary address" do - allow(order).to receive_messages(:ensure_available_shipping_rates => true) + allow(order).to receive_messages(ensure_available_shipping_rates: true) order.user = FactoryGirl.create(:user) order.temporary_address = true @@ -258,7 +258,7 @@ def assert_state_changed(order, from, to) context "cannot transition to delivery" do context "with an existing shipment" do before do - line_item = FactoryGirl.create(:line_item, :price => 10) + line_item = FactoryGirl.create(:line_item, price: 10) order.line_items << line_item end @@ -320,7 +320,7 @@ def assert_state_changed(order, from, to) context "with payment required" do before do - allow(order).to receive_messages :payment_required? => true + allow(order).to receive_messages payment_required?: true end it "transitions to payment" do @@ -333,7 +333,7 @@ def assert_state_changed(order, from, to) context "without payment required" do before do - allow(order).to receive_messages :payment_required? => false + allow(order).to receive_messages payment_required?: false end it "transitions to complete" do @@ -387,7 +387,7 @@ def assert_state_changed(order, from, to) context "with confirmation required" do before do - allow(order).to receive_messages :confirmation_required? => true + allow(order).to receive_messages confirmation_required?: true end it "transitions to confirm" do @@ -400,8 +400,8 @@ def assert_state_changed(order, from, to) context "without confirmation required" do before do order.email = "spree@example.com" - allow(order).to receive_messages :confirmation_required? => false - allow(order).to receive_messages :payment_required? => true + allow(order).to receive_messages confirmation_required?: false + allow(order).to receive_messages payment_required?: true order.payments << FactoryGirl.create(:payment, state: payment_state, order: order) end @@ -453,7 +453,7 @@ def assert_state_changed(order, from, to) # Regression test for #2028 context "when payment is not required" do before do - allow(order).to receive_messages :payment_required? => false + allow(order).to receive_messages payment_required?: false end it "does not call process payments" do @@ -512,7 +512,7 @@ class SubclassedOrder < Spree::Order skip "should only call default transitions once when checkout_flow is redefined" do order = SubclassedOrder.new - allow(order).to receive_messages :payment_required? => true + allow(order).to receive_messages payment_required?: true expect(order).to receive(:process_payments!).once order.state = "payment" order.next! @@ -537,7 +537,7 @@ class SubclassedOrder < Spree::Order end it "should not keep old event transitions when checkout_flow is redefined" do - expect(Spree::Order.next_event_transitions).to eq([{:cart=>:payment}, {:payment=>:complete}]) + expect(Spree::Order.next_event_transitions).to eq([{cart: :payment}, {payment: :complete}]) end it "should not keep old events when checkout_flow is redefined" do @@ -590,7 +590,7 @@ class SubclassedOrder < Spree::Order end it "should maintain removed transitions" do - transition = Spree::Order.find_transition(:from => :delivery, :to => :confirm) + transition = Spree::Order.find_transition(from: :delivery, to: :confirm) expect(transition).to be_nil end @@ -642,7 +642,7 @@ class SubclassedOrder < Spree::Order end it "should maintain removed transitions" do - transition = Spree::Order.find_transition(:from => :delivery, :to => :confirm) + transition = Spree::Order.find_transition(from: :delivery, to: :confirm) expect(transition).to be_nil end diff --git a/core/spec/models/spree/order/currency_updater_spec.rb b/core/spec/models/spree/order/currency_updater_spec.rb index 9744e26e8c9..0e25cfdf5b3 100644 --- a/core/spec/models/spree/order/currency_updater_spec.rb +++ b/core/spec/models/spree/order/currency_updater_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Order, :type => :model do +describe Spree::Order, type: :model do context 'CurrencyUpdater' do context "when changing order currency" do let!(:line_item) { create(:line_item) } diff --git a/core/spec/models/spree/order/finalizing_spec.rb b/core/spec/models/spree/order/finalizing_spec.rb index 9bc8ae98e25..c23bdd9caf2 100644 --- a/core/spec/models/spree/order/finalizing_spec.rb +++ b/core/spec/models/spree/order/finalizing_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Order, :type => :model do +describe Spree::Order, type: :model do let(:order) { stub_model("Spree::Order") } before { create(:store) } @@ -63,7 +63,7 @@ end it "should not send duplicate confirmation emails" do - allow(order).to receive_messages(:confirmation_delivered? => true) + allow(order).to receive_messages(confirmation_delivered?: true) expect(Spree::OrderMailer).not_to receive(:confirm_email) order.finalize! end @@ -80,7 +80,7 @@ context "order is considered risky" do before do - allow(order).to receive_messages :is_risky? => true + allow(order).to receive_messages is_risky?: true end it "should change state to risky" do @@ -90,7 +90,7 @@ context "and order is approved" do before do - allow(order).to receive_messages :approved? => true + allow(order).to receive_messages approved?: true end it "should leave order in complete state" do @@ -102,7 +102,7 @@ context "order is not considered risky" do before do - allow(order).to receive_messages :is_risky? => false + allow(order).to receive_messages is_risky?: false end it "should set completed_at" do diff --git a/core/spec/models/spree/order/helpers_spec.rb b/core/spec/models/spree/order/helpers_spec.rb index 2a1064b986a..97b380be078 100644 --- a/core/spec/models/spree/order/helpers_spec.rb +++ b/core/spec/models/spree/order/helpers_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -describe Spree::Order, :type => :model do +describe Spree::Order, type: :model do let(:order) { stub_model(Spree::Order) } end \ No newline at end of file diff --git a/core/spec/models/spree/order/payment_spec.rb b/core/spec/models/spree/order/payment_spec.rb index 720781dc015..7dee59ea61d 100644 --- a/core/spec/models/spree/order/payment_spec.rb +++ b/core/spec/models/spree/order/payment_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Spree::Order, :type => :model do + describe Spree::Order, type: :model do let(:order) { stub_model(Spree::Order) } let(:updater) { Spree::OrderUpdater.new(order) } @@ -11,12 +11,12 @@ module Spree Spree::Config[:auto_capture] = true allow(order).to receive_message_chain(:line_items, :empty?).and_return(false) - allow(order).to receive_messages :total => 100 + allow(order).to receive_messages total: 100 end it 'processes all checkout payments' do - payment_1 = create(:payment, :amount => 50) - payment_2 = create(:payment, :amount => 50) + payment_1 = create(:payment, amount: 50) + payment_2 = create(:payment, amount: 50) allow(order).to receive(:unprocessed_payments).and_return([payment_1, payment_2]) order.process_payments! @@ -28,9 +28,9 @@ module Spree end it 'does not go over total for order' do - payment_1 = create(:payment, :amount => 50) - payment_2 = create(:payment, :amount => 50) - payment_3 = create(:payment, :amount => 50) + payment_1 = create(:payment, amount: 50) + payment_2 = create(:payment, amount: 50) + payment_3 = create(:payment, amount: 50) allow(order).to receive(:unprocessed_payments).and_return([payment_1, payment_2, payment_3]) order.process_payments! @@ -43,8 +43,8 @@ module Spree end it "does not use failed payments" do - payment_1 = create(:payment, :amount => 50) - payment_2 = create(:payment, :amount => 50, :state => 'failed') + payment_1 = create(:payment, amount: 50) + payment_2 = create(:payment, amount: 50, state: 'failed') allow(order).to receive(:pending_payments).and_return([payment_1]) expect(payment_2).not_to receive(:process!) @@ -63,14 +63,14 @@ module Spree persisted_order = Spree::Order.create credit_card_payment_method = create(:credit_card_payment_method) attributes = { - :payments_attributes => [ + payments_attributes: [ { - :payment_method_id => credit_card_payment_method.id, - :source_attributes => { - :name => "Ryan Bigg", - :number => "41111111111111111111", - :expiry => "01 / 15", - :verification_value => "123" + payment_method_id: credit_card_payment_method.id, + source_attributes: { + name: "Ryan Bigg", + number: "41111111111111111111", + expiry: "01 / 15", + verification_value: "123" } } ] @@ -113,12 +113,12 @@ module Spree before { expect(payment).to receive(:process!).and_raise(Spree::Core::GatewayError) } it "should return true when configured to allow checkout on gateway failures" do - Spree::Config.set :allow_checkout_on_gateway_error => true + Spree::Config.set allow_checkout_on_gateway_error: true expect(order.process_payments!).to be true end it "should return false when not configured to allow checkout on gateway failures" do - Spree::Config.set :allow_checkout_on_gateway_error => false + Spree::Config.set allow_checkout_on_gateway_error: false expect(order.process_payments!).to be false end end @@ -126,7 +126,7 @@ module Spree context "#authorize_payments!" do let(:payment) { stub_model(Spree::Payment) } - before { allow(order).to receive_messages :unprocessed_payments => [payment], :total => 10 } + before { allow(order).to receive_messages unprocessed_payments: [payment], total: 10 } subject { order.authorize_payments! } it "processes payments with attempt_authorization!" do @@ -139,7 +139,7 @@ module Spree context "#capture_payments!" do let(:payment) { stub_model(Spree::Payment) } - before { allow(order).to receive_messages :unprocessed_payments => [payment], :total => 10 } + before { allow(order).to receive_messages unprocessed_payments: [payment], total: 10 } subject { order.capture_payments! } it "processes payments with attempt_authorization!" do diff --git a/core/spec/models/spree/order/risk_assessment_spec.rb b/core/spec/models/spree/order/risk_assessment_spec.rb index 1bc5a8e43fa..049ab0a2dad 100644 --- a/core/spec/models/spree/order/risk_assessment_spec.rb +++ b/core/spec/models/spree/order/risk_assessment_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Order, :type => :model do +describe Spree::Order, type: :model do let(:order) { stub_model('Spree::Order') } describe ".is_risky?" do diff --git a/core/spec/models/spree/order/tax_spec.rb b/core/spec/models/spree/order/tax_spec.rb index 92ec95caaab..37b6a67025e 100644 --- a/core/spec/models/spree/order/tax_spec.rb +++ b/core/spec/models/spree/order/tax_spec.rb @@ -1,13 +1,13 @@ require 'spec_helper' module Spree - describe Spree::Order, :type => :model do + describe Spree::Order, type: :model do let(:order) { stub_model(Spree::Order) } context "#tax_zone" do let(:bill_address) { create :address } let(:ship_address) { create :address } - let(:order) { Spree::Order.create(:ship_address => ship_address, :bill_address => bill_address) } + let(:order) { Spree::Order.create(ship_address: ship_address, bill_address: bill_address) } let(:zone) { create :zone } context "when no zones exist" do @@ -16,8 +16,8 @@ module Spree end end - context "when :tax_using_ship_address => true" do - before { Spree::Config.set(:tax_using_ship_address => true) } + context "when tax_using_ship_address: true" do + before { Spree::Config.set(tax_using_ship_address: true) } it "should calculate using ship_address" do expect(Spree::Zone).to receive(:match).at_least(:once).with(ship_address) @@ -26,8 +26,8 @@ module Spree end end - context "when :tax_using_ship_address => false" do - before { Spree::Config.set(:tax_using_ship_address => false) } + context "when tax_using_ship_address: false" do + before { Spree::Config.set(tax_using_ship_address: false) } it "should calculate using bill_address" do expect(Spree::Zone).to receive(:match).at_least(:once).with(bill_address) @@ -38,12 +38,12 @@ module Spree context "when there is a default tax zone" do before do - @default_zone = create(:zone, :name => "foo_zone") - allow(Spree::Zone).to receive_messages :default_tax => @default_zone + @default_zone = create(:zone, name: "foo_zone") + allow(Spree::Zone).to receive_messages default_tax: @default_zone end context "when there is a matching zone" do - before { allow(Spree::Zone).to receive_messages(:match => zone) } + before { allow(Spree::Zone).to receive_messages(match: zone) } it "should return the matching zone" do expect(order.tax_zone).to eq(zone) @@ -51,7 +51,7 @@ module Spree end context "when there is no matching zone" do - before { allow(Spree::Zone).to receive_messages(:match => nil) } + before { allow(Spree::Zone).to receive_messages(match: nil) } it "should return the default tax zone" do expect(order.tax_zone).to eq(@default_zone) @@ -60,10 +60,10 @@ module Spree end context "when no default tax zone" do - before { allow(Spree::Zone).to receive_messages :default_tax => nil } + before { allow(Spree::Zone).to receive_messages default_tax: nil } context "when there is a matching zone" do - before { allow(Spree::Zone).to receive_messages(:match => zone) } + before { allow(Spree::Zone).to receive_messages(match: zone) } it "should return the matching zone" do expect(order.tax_zone).to eq(zone) @@ -71,7 +71,7 @@ module Spree end context "when there is no matching zone" do - before { allow(Spree::Zone).to receive_messages(:match => nil) } + before { allow(Spree::Zone).to receive_messages(match: nil) } it "should return nil" do expect(order.tax_zone).to be_nil diff --git a/core/spec/models/spree/order/totals_spec.rb b/core/spec/models/spree/order/totals_spec.rb index 35db1ff808b..877d96cf776 100644 --- a/core/spec/models/spree/order/totals_spec.rb +++ b/core/spec/models/spree/order/totals_spec.rb @@ -1,13 +1,13 @@ require 'spec_helper' module Spree - describe Order, :type => :model do + describe Order, type: :model do let(:order) { Order.create } let(:shirt) { create(:variant) } context "adds item to cart and activates promo" do let(:promotion) { Promotion.create name: 'Huhu' } - let(:calculator) { Calculator::FlatPercentItemTotal.new(:preferred_flat_percent => 10) } + let(:calculator) { Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10) } let!(:action) { Promotion::Actions::CreateAdjustment.create(promotion: promotion, calculator: calculator) } before { order.contents.add(shirt, 1) } diff --git a/core/spec/models/spree/order/updating_spec.rb b/core/spec/models/spree/order/updating_spec.rb index a5664ba0c84..04d85d9fa63 100644 --- a/core/spec/models/spree/order/updating_spec.rb +++ b/core/spec/models/spree/order/updating_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -describe Spree::Order, :type => :model do +describe Spree::Order, type: :model do let(:order) { create(:order) } context "#update_with_updater!" do - let(:line_items) { [mock_model(Spree::LineItem, :amount => 5) ]} + let(:line_items) { [mock_model(Spree::LineItem, amount: 5) ]} context "when there are update hooks" do before { Spree::Order.register_update_hook :foo } diff --git a/core/spec/models/spree/order/validations_spec.rb b/core/spec/models/spree/order/validations_spec.rb index f57eb95d78a..4f2be37f3fc 100644 --- a/core/spec/models/spree/order/validations_spec.rb +++ b/core/spec/models/spree/order/validations_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' module Spree - describe Spree::Order, :type => :model do + describe Spree::Order, type: :model do context "validations" do # Regression test for #2214 it "does not return two error messages when email is blank" do order = Spree::Order.new - allow(order).to receive_messages(:require_email => true) + allow(order).to receive_messages(require_email: true) order.valid? expect(order.errors[:email]).to eq(["can't be blank"]) end diff --git a/core/spec/models/spree/order_contents_spec.rb b/core/spec/models/spree/order_contents_spec.rb index 06b4c67db66..738b84bfc3e 100644 --- a/core/spec/models/spree/order_contents_spec.rb +++ b/core/spec/models/spree/order_contents_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::OrderContents, :type => :model do +describe Spree::OrderContents, type: :model do let(:order) { Spree::Order.create } let(:variant) { create(:variant) } @@ -56,7 +56,7 @@ context "running promotions" do let(:promotion) { create(:promotion) } - let(:calculator) { Spree::Calculator::FlatRate.new(:preferred_amount => 10) } + let(:calculator) { Spree::Calculator::FlatRate.new(preferred_amount: 10) } shared_context "discount changes order total" do before { subject.add(variant, 1) } @@ -97,7 +97,7 @@ ) end let(:variant) { create(:variant, price: 1000) } - let(:calculator) { Spree::Calculator::PercentOnLineItem.new(:preferred_percent => 50) } + let(:calculator) { Spree::Calculator::PercentOnLineItem.new(preferred_percent: 50) } let!(:action) { Spree::Promotion::Actions::CreateItemAdjustments.create(promotion: promotion, calculator: calculator) } it "should update included_tax_total" do diff --git a/core/spec/models/spree/order_spec.rb b/core/spec/models/spree/order_spec.rb index f97a9610315..bb3167208f4 100644 --- a/core/spec/models/spree/order_spec.rb +++ b/core/spec/models/spree/order_spec.rb @@ -6,13 +6,13 @@ def compute(computable) end end -describe Spree::Order, :type => :model do - let(:user) { stub_model(Spree::LegacyUser, :email => "spree@example.com") } - let(:order) { stub_model(Spree::Order, :user => user) } +describe Spree::Order, type: :model do + let(:user) { stub_model(Spree::LegacyUser, email: "spree@example.com") } + let(:order) { stub_model(Spree::Order, user: user) } before do create(:store) - allow(Spree::LegacyUser).to receive_messages(:current => mock_model(Spree::LegacyUser, :id => 123)) + allow(Spree::LegacyUser).to receive_messages(current: mock_model(Spree::LegacyUser, id: 123)) end describe '.scopes' do @@ -182,7 +182,7 @@ def compute(computable) end it "should not send duplicate confirmation emails" do - allow(order).to receive_messages(:confirmation_delivered? => true) + allow(order).to receive_messages(confirmation_delivered?: true) expect(Spree::OrderMailer).not_to receive(:confirm_email) order.finalize! end @@ -199,7 +199,7 @@ def compute(computable) context "order is considered risky" do before do - allow(order).to receive_messages :is_risky? => true + allow(order).to receive_messages is_risky?: true end it "should change state to risky" do @@ -209,7 +209,7 @@ def compute(computable) context "and order is approved" do before do - allow(order).to receive_messages :approved? => true + allow(order).to receive_messages approved?: true end it "should leave order in complete state" do @@ -221,9 +221,9 @@ def compute(computable) end context "insufficient_stock_lines" do - let(:line_item) { mock_model Spree::LineItem, :insufficient_stock? => true } + let(:line_item) { mock_model Spree::LineItem, insufficient_stock?: true } - before { allow(order).to receive_messages(:line_items => [line_item]) } + before { allow(order).to receive_messages(line_items: [line_item]) } it "should return line_item that has insufficient stock on hand" do expect(order.insufficient_stock_lines.size).to eq(1) @@ -272,11 +272,11 @@ def compute(computable) describe '#ensure_line_items_are_in_stock' do subject { order.ensure_line_items_are_in_stock } - let(:line_item) { mock_model Spree::LineItem, :insufficient_stock? => true } + let(:line_item) { mock_model Spree::LineItem, insufficient_stock?: true } before do allow(order).to receive(:restart_checkout_flow) - allow(order).to receive_messages(:line_items => [line_item]) + allow(order).to receive_messages(line_items: [line_item]) end it 'should restart checkout flow' do @@ -489,7 +489,7 @@ def compute(computable) order.payment_state = 'paid' expect(order.state_changes).to be_empty order.state_changed('payment') - state_change = order.state_changes.find_by(:name => 'payment') + state_change = order.state_changes.find_by(name: 'payment') expect(state_change.previous_state).to eq('balance_due') expect(state_change.next_state).to eq('paid') end @@ -506,27 +506,27 @@ def compute(computable) context "#available_payment_methods" do it "includes frontend payment methods" do payment_method = Spree::PaymentMethod.create!({ - :name => "Fake", - :active => true, - :display_on => "front_end", + name: "Fake", + active: true, + display_on: "front_end", }) expect(order.available_payment_methods).to include(payment_method) end it "includes 'both' payment methods" do payment_method = Spree::PaymentMethod.create!({ - :name => "Fake", - :active => true, - :display_on => "both", + name: "Fake", + active: true, + display_on: "both", }) expect(order.available_payment_methods).to include(payment_method) end it "does not include a payment method twice if display_on is blank" do payment_method = Spree::PaymentMethod.create!({ - :name => "Fake", - :active => true, - :display_on => "both", + name: "Fake", + active: true, + display_on: "both", }) expect(order.available_payment_methods.count).to eq(1) expect(order.available_payment_methods).to include(payment_method) @@ -536,7 +536,7 @@ def compute(computable) context "#apply_free_shipping_promotions" do it "calls out to the FreeShipping promotion handler" do shipment = double('Shipment') - allow(order).to receive_messages :shipments => [shipment] + allow(order).to receive_messages shipments: [shipment] expect(Spree::PromotionHandler::FreeShipping).to receive(:new).and_return(handler = double) expect(handler).to receive(:activate) @@ -551,17 +551,17 @@ def compute(computable) context "#products" do before :each do - @variant1 = mock_model(Spree::Variant, :product => "product1") - @variant2 = mock_model(Spree::Variant, :product => "product2") - @line_items = [mock_model(Spree::LineItem, :product => "product1", :variant => @variant1, :variant_id => @variant1.id, :quantity => 1), - mock_model(Spree::LineItem, :product => "product2", :variant => @variant2, :variant_id => @variant2.id, :quantity => 2)] - allow(order).to receive_messages(:line_items => @line_items) + @variant1 = mock_model(Spree::Variant, product: "product1") + @variant2 = mock_model(Spree::Variant, product: "product2") + @line_items = [mock_model(Spree::LineItem, product: "product1", variant: @variant1, variant_id: @variant1.id, quantity: 1), + mock_model(Spree::LineItem, product: "product2", variant: @variant2, variant_id: @variant2.id, quantity: 2)] + allow(order).to receive_messages(line_items: @line_items) end it "gets the quantity of a given variant" do expect(order.quantity_of(@variant1)).to eq(1) - @variant3 = mock_model(Spree::Variant, :product => "product3") + @variant3 = mock_model(Spree::Variant, product: "product3") expect(order.quantity_of(@variant3)).to eq(0) end @@ -729,27 +729,27 @@ def assert_expected_order_state let(:order) { Spree::Order.create } it "should be true for order in the 'complete' state" do - allow(order).to receive_messages(:complete? => true) + allow(order).to receive_messages(complete?: true) expect(order.can_ship?).to be true end it "should be true for order in the 'resumed' state" do - allow(order).to receive_messages(:resumed? => true) + allow(order).to receive_messages(resumed?: true) expect(order.can_ship?).to be true end it "should be true for an order in the 'awaiting return' state" do - allow(order).to receive_messages(:awaiting_return? => true) + allow(order).to receive_messages(awaiting_return?: true) expect(order.can_ship?).to be true end it "should be true for an order in the 'returned' state" do - allow(order).to receive_messages(:returned? => true) + allow(order).to receive_messages(returned?: true) expect(order.can_ship?).to be true end it "should be false if the order is neither in the 'complete' nor 'resumed' state" do - allow(order).to receive_messages(:resumed? => false, :complete? => false) + allow(order).to receive_messages(resumed?: false, complete?: false) expect(order.can_ship?).to be false end end @@ -766,20 +766,20 @@ def assert_expected_order_state context "#allow_checkout?" do it "should be true if there are line_items in the order" do - allow(order).to receive_message_chain(:line_items, :count => 1) + allow(order).to receive_message_chain(:line_items, count: 1) expect(order.checkout_allowed?).to be true end it "should be false if there are no line_items in the order" do - allow(order).to receive_message_chain(:line_items, :count => 0) + allow(order).to receive_message_chain(:line_items, count: 0) expect(order.checkout_allowed?).to be false end end context "#amount" do before do - @order = create(:order, :user => user) - @order.line_items = [create(:line_item, :price => 1.0, :quantity => 2), - create(:line_item, :price => 1.0, :quantity => 1)] + @order = create(:order, user: user) + @order.line_items = [create(:line_item, price: 1.0, quantity: 2), + create(:line_item, price: 1.0, quantity: 1)] end it "should return the correct lum sum of items" do expect(@order.amount).to eq(3.0) @@ -788,8 +788,8 @@ def assert_expected_order_state context "#backordered?" do it 'is backordered if one of the shipments is backordered' do - allow(order).to receive_messages(:shipments => [mock_model(Spree::Shipment, :backordered? => false), - mock_model(Spree::Shipment, :backordered? => true)]) + allow(order).to receive_messages(shipments: [mock_model(Spree::Shipment, backordered?: false), + mock_model(Spree::Shipment, backordered?: true)]) expect(order).to be_backordered end end @@ -812,7 +812,7 @@ def assert_expected_order_state context "#tax_total" do it "adds included tax and additional tax" do - allow(order).to receive_messages(:additional_tax_total => 10, :included_tax_total => 20) + allow(order).to receive_messages(additional_tax_total: 10, included_tax_total: 20) expect(order.tax_total).to eq 30 end diff --git a/core/spec/models/spree/payment_spec.rb b/core/spec/models/spree/payment_spec.rb index 2a5d03af8e3..d567fcd2237 100644 --- a/core/spec/models/spree/payment_spec.rb +++ b/core/spec/models/spree/payment_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' -describe Spree::Payment, :type => :model do +describe Spree::Payment, type: :model do let(:order) { Spree::Order.create } let(:refund_reason) { create(:refund_reason) } let(:gateway) do - gateway = Spree::Gateway::Bogus.new(:active => true) - allow(gateway).to receive_messages :source_required => true + gateway = Spree::Gateway::Bogus.new(active: true) + allow(gateway).to receive_messages source_required: true gateway end @@ -182,7 +182,7 @@ # Regression test for #4598 it "should allow payments with a gateway_customer_profile_id" do - allow(payment.source).to receive_messages :gateway_customer_profile_id => "customer_1" + allow(payment.source).to receive_messages gateway_customer_profile_id: "customer_1" expect(payment.payment_method).to receive(:supports?).with(payment.source).and_return(false) expect(payment).to receive(:started_processing!) payment.process! @@ -190,7 +190,7 @@ # Another regression test for #4598 it "should allow payments with a gateway_payment_profile_id" do - allow(payment.source).to receive_messages :gateway_payment_profile_id => "customer_1" + allow(payment.source).to receive_messages gateway_payment_profile_id: "customer_1" expect(payment.payment_method).to receive(:supports?).with(payment.source).and_return(false) expect(payment).to receive(:started_processing!) payment.process! @@ -206,10 +206,10 @@ end it "should call authorize on the gateway with the currency code" do - allow(payment).to receive_messages :currency => 'GBP' + allow(payment).to receive_messages currency: 'GBP' expect(payment.payment_method).to 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 @@ -369,7 +369,7 @@ context "if unsuccessful" do it "should not make payment complete" do - allow(gateway).to receive_messages :capture => failed_response + allow(gateway).to receive_messages capture: failed_response expect(payment).to receive(:failure) expect(payment).not_to receive(:complete) expect { payment.capture! }.to raise_error(Spree::Core::GatewayError) @@ -400,7 +400,7 @@ context "when profiles are supported" do it "should call payment_gateway.void with the payment's response_code" do - allow(gateway).to receive_messages :payment_profiles_supported? => true + allow(gateway).to receive_messages payment_profiles_supported?: true expect(gateway).to receive(:void).with('123', card, anything).and_return(success_response) payment.void_transaction! end @@ -408,14 +408,14 @@ context "when profiles are not supported" do it "should call payment_gateway.void with the payment's response_code" do - allow(gateway).to receive_messages :payment_profiles_supported? => false + allow(gateway).to receive_messages payment_profiles_supported?: false expect(gateway).to receive(:void).with('123', anything).and_return(success_response) payment.void_transaction! end end it "should log the response" do - expect(payment.log_entries).to receive(:create!).with(:details => anything) + expect(payment.log_entries).to receive(:create!).with(details: anything) payment.void_transaction! end @@ -430,7 +430,7 @@ context "if unsuccessful" do it "should not void the payment" do - allow(gateway).to receive_messages :void => failed_response + allow(gateway).to receive_messages void: failed_response expect(payment).not_to receive(:void) expect { payment.void_transaction! }.to raise_error(Spree::Core::GatewayError) end @@ -475,7 +475,7 @@ context "raises no error if source is not specified" do before do payment.source = nil - allow(payment.payment_method).to receive_messages(:source_required? => false) + allow(payment.payment_method).to receive_messages(source_required?: false) end specify do @@ -518,7 +518,7 @@ context "not completed payments" do it "doesn't update order payment total" do expect { - Spree::Payment.create(:amount => 100, :order => order) + Spree::Payment.create(amount: 100, order: order) }.not_to change { order.payment_total } end @@ -554,8 +554,8 @@ context "when profiles are supported" do before do - allow(gateway).to receive_messages :payment_profiles_supported? => true - allow(payment.source).to receive_messages :has_payment_profile? => false + allow(gateway).to receive_messages payment_profiles_supported?: true + allow(payment.source).to receive_messages has_payment_profile?: false end context "when there is an error connecting to the gateway" do @@ -565,10 +565,10 @@ 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.to raise_error(Spree::Core::GatewayError) end @@ -599,25 +599,25 @@ it "should create a payment profile" do expect(payment.payment_method).to receive :create_profile payment = Spree::Payment.create( - :amount => 100, - :order => order, - :source => card, - :payment_method => gateway + amount: 100, + order: order, + source: card, + payment_method: gateway ) end end end context "when profiles are not supported" do - before { allow(gateway).to receive_messages :payment_profiles_supported? => false } + before { allow(gateway).to receive_messages payment_profiles_supported?: false } it "should not create a payment profile" do expect(gateway).not_to receive :create_profile payment = Spree::Payment.create( - :amount => 100, - :order => order, - :source => card, - :payment_method => gateway + amount: 100, + order: order, + source: card, + payment_method: gateway ) end end @@ -626,13 +626,13 @@ describe "#build_source" do let(:params) do { - :amount => 100, - :payment_method => gateway, - :source_attributes => { - :expiry =>"01 / 99", - :number => '1234567890123', - :verification_value => '123', - :name => 'Spree Commerce' + amount: 100, + payment_method: gateway, + source_attributes: { + expiry:"01 / 99", + number: '1234567890123', + verification_value: '123', + name: 'Spree Commerce' } } end @@ -652,8 +652,8 @@ 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 @@ -684,7 +684,7 @@ # Regression test for #2216 describe "#gateway_options" do - before { allow(order).to receive_messages(:last_ip_address => "192.168.1.1") } + before { allow(order).to receive_messages(last_ip_address: "192.168.1.1") } it "contains an IP" do expect(payment.gateway_options[:ip]).to eq(order.last_ip_address) @@ -694,7 +694,7 @@ # Sets the payment's order to a different Ruby object entirely payment.order = Spree::Order.find(payment.order_id) email = 'foo@example.com' - order.update_attributes(:email => email) + order.update_attributes(email: email) expect(payment.gateway_options[:email]).to eq(email) end end @@ -774,7 +774,7 @@ context "when the locale uses a coma as a decimal separator" do before(:each) do - I18n.backend.store_translations(:fr, { :number => { :currency => { :format => { :delimiter => ' ', :separator => ',' } } } }) + I18n.backend.store_translations(:fr, { number: { currency: { format: { delimiter: ' ', separator: ',' } } } }) I18n.locale = :fr subject.amount = amount end diff --git a/core/spec/models/spree/preference_spec.rb b/core/spec/models/spree/preference_spec.rb index 2d9b9c1159f..833adc469be 100644 --- a/core/spec/models/spree/preference_spec.rb +++ b/core/spec/models/spree/preference_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Preference, :type => :model do +describe Spree::Preference, type: :model do it "should require a key" do @preference = Spree::Preference.new diff --git a/core/spec/models/spree/preferences/configuration_spec.rb b/core/spec/models/spree/preferences/configuration_spec.rb index 3a95cc14ea5..23d9bd8938c 100644 --- a/core/spec/models/spree/preferences/configuration_spec.rb +++ b/core/spec/models/spree/preferences/configuration_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' -describe Spree::Preferences::Configuration, :type => :model do +describe Spree::Preferences::Configuration, type: :model do before :all do class AppConfig < Spree::Preferences::Configuration - preference :color, :string, :default => :blue + preference :color, :string, default: :blue end @config = AppConfig.new end diff --git a/core/spec/models/spree/preferences/preferable_spec.rb b/core/spec/models/spree/preferences/preferable_spec.rb index cd02e0069a4..232befb07b9 100644 --- a/core/spec/models/spree/preferences/preferable_spec.rb +++ b/core/spec/models/spree/preferences/preferable_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Preferences::Preferable, :type => :model do +describe Spree::Preferences::Preferable, type: :model do before :all do class A @@ -15,7 +15,7 @@ def preferences @preferences ||= default_preferences end - preference :color, :string, :default => 'green' + preference :color, :string, default: 'green' end class B < A @@ -25,9 +25,9 @@ class B < A before :each do @a = A.new - allow(@a).to receive_messages(:persisted? => true) + allow(@a).to receive_messages(persisted?: true) @b = B.new - allow(@b).to receive_messages(:persisted? => true) + allow(@b).to receive_messages(persisted?: true) # ensure we're persisting as that is the default # @@ -150,7 +150,7 @@ class B < A context "converts boolean preferences to boolean values" do before do - A.preference :is_boolean, :boolean, :default => true + A.preference :is_boolean, :boolean, default: true end it "with strings" do @@ -255,8 +255,8 @@ class B < A context "converts any preferences to any values" do before do - A.preference :product_ids, :any, :default => [] - A.preference :product_attributes, :any, :default => {} + A.preference :product_ids, :any, default: [] + A.preference :product_attributes, :any, default: {} end it "with array" do @@ -267,8 +267,8 @@ class B < A it "with hash" do expect(@a.preferences[:product_attributes]).to eq({}) - @a.set_preference(:product_attributes, {:id => 1, :name => 2}) - expect(@a.preferences[:product_attributes]).to eq({:id => 1, :name => 2}) + @a.set_preference(:product_attributes, {id: 1, name: 2}) + expect(@a.preferences[:product_attributes]).to eq({id: 1, name: 2}) end end @@ -294,8 +294,8 @@ def self.down CreatePrefTest.migrate(:up) class PrefTest < Spree::Base - preference :pref_test_pref, :string, :default => 'abc' - preference :pref_test_any, :any, :default => [] + preference :pref_test_pref, :string, default: 'abc' + preference :pref_test_any, :any, default: [] end end @@ -338,7 +338,7 @@ class PrefTest < Spree::Base @pt.preferred_pref_test_pref = 'lmn' @pt.save! @pt.destroy - @pt1 = PrefTest.new(:col => 'aaaa') + @pt1 = PrefTest.new(col: 'aaaa') @pt1.id = @pt.id @pt1.save! expect(@pt1.get_preference(:pref_test_pref)).to eq('abc') diff --git a/core/spec/models/spree/preferences/scoped_store_spec.rb b/core/spec/models/spree/preferences/scoped_store_spec.rb index df5d48eef57..77ecc3a1a38 100644 --- a/core/spec/models/spree/preferences/scoped_store_spec.rb +++ b/core/spec/models/spree/preferences/scoped_store_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Preferences::ScopedStore, :type => :model do +describe Spree::Preferences::ScopedStore, type: :model do let(:scoped_store){ described_class.new(prefix, suffix) } subject{ scoped_store } let(:prefix){ nil } diff --git a/core/spec/models/spree/preferences/store_spec.rb b/core/spec/models/spree/preferences/store_spec.rb index 237e6add063..da1b23fc37e 100644 --- a/core/spec/models/spree/preferences/store_spec.rb +++ b/core/spec/models/spree/preferences/store_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Preferences::Store, :type => :model do +describe Spree::Preferences::Store, type: :model do before :each do @store = Spree::Preferences::StoreInstance.new end @@ -17,7 +17,7 @@ end it "will return db value when cache is emtpy and cache the db value" do - preference = Spree::Preference.where(:key => 'test').first_or_initialize + preference = Spree::Preference.where(key: 'test').first_or_initialize preference.value = '123' preference.save @@ -34,7 +34,7 @@ it "should return but not cache fallback value when persistence is disabled" do Rails.cache.clear - allow(@store).to receive_messages(:should_persist? => false) + allow(@store).to receive_messages(should_persist?: false) expect(@store.get(:test){ true }).to be true expect(Rails.cache.exist?(:test)).to be false end diff --git a/core/spec/models/spree/price_spec.rb b/core/spec/models/spree/price_spec.rb index ff796f77013..3f7bfda93fc 100644 --- a/core/spec/models/spree/price_spec.rb +++ b/core/spec/models/spree/price_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Price, :type => :model do +describe Spree::Price, type: :model do describe '#amount=' do let(:price) { Spree::Price.new } let(:amount) { '3,0A0' } diff --git a/core/spec/models/spree/product/scopes_spec.rb b/core/spec/models/spree/product/scopes_spec.rb index d14a4eecfef..e0ad37df104 100644 --- a/core/spec/models/spree/product/scopes_spec.rb +++ b/core/spec/models/spree/product/scopes_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe "Product scopes", :type => :model do +describe "Product scopes", type: :model do let!(:product) { create(:product) } describe '#available' do @@ -43,8 +43,8 @@ @taxonomy = create(:taxonomy) @root_taxon = @taxonomy.root - @parent_taxon = create(:taxon, :name => 'Parent', :taxonomy_id => @taxonomy.id, :parent => @root_taxon) - @child_taxon = create(:taxon, :name =>'Child 1', :taxonomy_id => @taxonomy.id, :parent => @parent_taxon) + @parent_taxon = create(:taxon, name: 'Parent', taxonomy_id: @taxonomy.id, parent: @root_taxon) + @child_taxon = create(:taxon, name:'Child 1', taxonomy_id: @taxonomy.id, parent: @parent_taxon) @parent_taxon.reload # Need to reload for descendents to show up product.taxons << @parent_taxon @@ -73,7 +73,7 @@ it 'after ordering changed' do [@child_taxon, other_taxon].each do |taxon| - Spree::Classification.find_by(:taxon => taxon, :product => product).insert_at(2) + Spree::Classification.find_by(taxon: taxon, product: product).insert_at(2) expect(Spree::Product.in_taxon(taxon)).to eq([product_2, product]) end end diff --git a/core/spec/models/spree/product_duplicator_spec.rb b/core/spec/models/spree/product_duplicator_spec.rb index 7557049272c..8857497155f 100644 --- a/core/spec/models/spree/product_duplicator_spec.rb +++ b/core/spec/models/spree/product_duplicator_spec.rb @@ -2,13 +2,13 @@ module Spree - describe Spree::ProductDuplicator, :type => :model do + describe Spree::ProductDuplicator, type: :model do let(:product) { create(:product, properties: [create(:property, name: "MyProperty")])} let!(:duplicator) { Spree::ProductDuplicator.new(product)} let(:image) { File.open(File.expand_path('../../../fixtures/thinking-cat.jpg', __FILE__)) } - let(:params) { {:viewable_id => product.master.id, :viewable_type => 'Spree::Variant', :attachment => image, :alt => "position 1", :position => 1} } + let(:params) { {viewable_id: product.master.id, viewable_type: 'Spree::Variant', attachment: image, alt: "position 1", position: 1} } before do Spree::Image.create(params) diff --git a/core/spec/models/spree/product_filter_spec.rb b/core/spec/models/spree/product_filter_spec.rb index c61c9ceb2fa..6cbca38aa72 100644 --- a/core/spec/models/spree/product_filter_spec.rb +++ b/core/spec/models/spree/product_filter_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' require 'spree/core/product_filters' -describe 'product filters', :type => :model do +describe 'product filters', type: :model do # Regression test for #1709 context 'finds products filtered by brand' do let(:product) { create(:product) } before do - property = Spree::Property.create!(:name => "brand", :presentation => "brand") + property = Spree::Property.create!(name: "brand", presentation: "brand") product.set_property("brand", "Nike") end diff --git a/core/spec/models/spree/product_property_spec.rb b/core/spec/models/spree/product_property_spec.rb index 67519693386..1d82396a69e 100644 --- a/core/spec/models/spree/product_property_spec.rb +++ b/core/spec/models/spree/product_property_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::ProductProperty, :type => :model do +describe Spree::ProductProperty, type: :model do context "touching" do it "should update product" do pp = create(:product_property) diff --git a/core/spec/models/spree/product_spec.rb b/core/spec/models/spree/product_spec.rb index 13d22fb66c3..a2f37890ce8 100644 --- a/core/spec/models/spree/product_spec.rb +++ b/core/spec/models/spree/product_spec.rb @@ -9,7 +9,7 @@ class Extension < Spree::Base end end -describe Spree::Product, :type => :model do +describe Spree::Product, type: :model do describe 'Associations' do it 'should have many promotions' do @@ -25,11 +25,11 @@ class Extension < Spree::Base context 'product instance' do let(:product) { create(:product) } - let(:variant) { create(:variant, :product => product) } + let(:variant) { create(:variant, product: product) } context '#duplicate' do before do - allow(product).to receive_messages :taxons => [create(:taxon)] + allow(product).to receive_messages taxons: [create(:taxon)] end it 'duplicates product' do @@ -100,7 +100,7 @@ class Extension < Spree::Base context "product has variants" do before do - create(:variant, :product => product) + create(:variant, product: product) end context "#destroy" do @@ -351,11 +351,11 @@ class Extension < Spree::Base # Regression test for #2455 it "should not overwrite properties' presentation names" do - Spree::Property.where(:name => 'foo').first_or_create!(:presentation => "Foo's Presentation Name") + Spree::Property.where(name: 'foo').first_or_create!(presentation: "Foo's Presentation Name") product.set_property('foo', 'value1') product.set_property('bar', 'value2') - expect(Spree::Property.where(:name => 'foo').first.presentation).to eq("Foo's Presentation Name") - expect(Spree::Property.where(:name => 'bar').first.presentation).to eq("bar") + expect(Spree::Property.where(name: 'foo').first.presentation).to eq("Foo's Presentation Name") + expect(Spree::Property.where(name: 'bar').first.presentation).to eq("bar") end # Regression test for #4416 @@ -400,7 +400,7 @@ def build_option_type_with_values(name, values) let(:prototype) do size = build_option_type_with_values("size", %w(Small Medium Large)) - create(:prototype, :name => "Size", :option_types => [ size ]) + create(:prototype, name: "Size", option_types: [ size ]) end let(:option_values_hash) do @@ -454,12 +454,12 @@ def build_option_type_with_values(name, values) context "#images" do let(:product) { create(:product) } let(:image) { File.open(File.expand_path('../../../fixtures/thinking-cat.jpg', __FILE__)) } - let(:params) { {:viewable_id => product.master.id, :viewable_type => 'Spree::Variant', :attachment => image, :alt => "position 2", :position => 2} } + let(:params) { {viewable_id: product.master.id, viewable_type: 'Spree::Variant', attachment: image, alt: "position 2", position: 2} } before do Spree::Image.create(params) - Spree::Image.create(params.merge({:alt => "position 1", :position => 1})) - Spree::Image.create(params.merge({:viewable_type => 'ThirdParty::Extension', :alt => "position 1", :position => 2})) + Spree::Image.create(params.merge({alt: "position 1", position: 1})) + Spree::Image.create(params.merge({viewable_type: 'ThirdParty::Extension', alt: "position 1", position: 2})) end it "only looks for variant images" do @@ -489,12 +489,12 @@ def build_option_type_with_values(name, values) it 'should be infinite if track_inventory_levels is false' do Spree::Config[:track_inventory_levels] = false - expect(build(:product, :variants_including_master => [build(:master_variant)]).total_on_hand).to eql(Float::INFINITY) + expect(build(:product, variants_including_master: [build(:master_variant)]).total_on_hand).to eql(Float::INFINITY) end it 'should be infinite if variant is on demand' do Spree::Config[:track_inventory_levels] = true - expect(build(:product, :variants_including_master => [build(:on_demand_master_variant)]).total_on_hand).to eql(Float::INFINITY) + expect(build(:product, variants_including_master: [build(:on_demand_master_variant)]).total_on_hand).to eql(Float::INFINITY) end it 'should return sum of stock items count_on_hand' do diff --git a/core/spec/models/spree/promotion/actions/create_item_adjustments_spec.rb b/core/spec/models/spree/promotion/actions/create_item_adjustments_spec.rb index e286cb0c953..62e9940f442 100644 --- a/core/spec/models/spree/promotion/actions/create_item_adjustments_spec.rb +++ b/core/spec/models/spree/promotion/actions/create_item_adjustments_spec.rb @@ -3,11 +3,11 @@ module Spree class Promotion module Actions - describe CreateItemAdjustments, :type => :model do + describe CreateItemAdjustments, type: :model do let(:order) { create(:order) } let(:promotion) { create(:promotion) } let(:action) { CreateItemAdjustments.new } - let!(:line_item) { create(:line_item, :order => order) } + let!(:line_item) { create(:line_item, order: order) } let(:payload) { { order: order, promotion: promotion } } before do @@ -21,7 +21,7 @@ module Actions # Regression test for #3966 context "when calculator computes 0" do before do - allow(action).to receive_messages :compute_amount => 0 + allow(action).to receive_messages compute_amount: 0 end it "does not create an adjustment when calculator returns 0" do @@ -33,7 +33,7 @@ module Actions context "when calculator returns a non-zero value" do before do promotion.promotion_actions = [action] - allow(action).to receive_messages :compute_amount => 10 + allow(action).to receive_messages compute_amount: 10 end it "creates adjustment with item as adjustable" do @@ -53,7 +53,7 @@ module Actions end context "with products rules" do - let!(:second_line_item) { create(:line_item, :order => order) } + let!(:second_line_item) { create(:line_item, order: order) } let(:rule) { double Spree::Promotion::Rules::Product } before do diff --git a/core/spec/models/spree/promotion/actions/free_shipping_spec.rb b/core/spec/models/spree/promotion/actions/free_shipping_spec.rb index f3fe52045c8..3f06d4062fa 100644 --- a/core/spec/models/spree/promotion/actions/free_shipping_spec.rb +++ b/core/spec/models/spree/promotion/actions/free_shipping_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Promotion::Actions::FreeShipping, :type => :model do +describe Spree::Promotion::Actions::FreeShipping, type: :model do let(:order) { create(:completed_order_with_totals) } let(:promotion) { create(:promotion) } let(:action) { Spree::Promotion::Actions::FreeShipping.create } diff --git a/core/spec/models/spree/promotion/rules/first_order_spec.rb b/core/spec/models/spree/promotion/rules/first_order_spec.rb index e2c58816b06..6326a63c996 100644 --- a/core/spec/models/spree/promotion/rules/first_order_spec.rb +++ b/core/spec/models/spree/promotion/rules/first_order_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' -describe Spree::Promotion::Rules::FirstOrder, :type => :model do +describe Spree::Promotion::Rules::FirstOrder, type: :model do let(:rule) { Spree::Promotion::Rules::FirstOrder.new } - let(:order) { mock_model(Spree::Order, :user => nil, :email => nil) } + let(:order) { mock_model(Spree::Order, user: nil, email: nil) } let(:user) { mock_model(Spree::LegacyUser) } context "without a user or email" do @@ -18,31 +18,31 @@ context "for a signed user" do context "with no completed orders" do before(:each) do - allow(user).to receive_message_chain(:orders, :complete => []) + allow(user).to receive_message_chain(:orders, complete: []) end specify do - allow(order).to receive_messages(:user => user) + allow(order).to receive_messages(user: user) expect(rule).to be_eligible(order) end it "should be eligible when user passed in payload data" do - expect(rule).to be_eligible(order, :user => user) + expect(rule).to be_eligible(order, user: user) end end context "with completed orders" do before(:each) do - allow(order).to receive_messages(:user => user) + allow(order).to receive_messages(user: user) end it "should be eligible when checked against first completed order" do - allow(user).to receive_message_chain(:orders, :complete => [order]) + allow(user).to receive_message_chain(:orders, complete: [order]) expect(rule).to be_eligible(order) end context "with another order" do - before { allow(user).to receive_message_chain(:orders, :complete => [mock_model(Spree::Order)]) } + before { allow(user).to receive_message_chain(:orders, complete: [mock_model(Spree::Order)]) } it { expect(rule).not_to be_eligible(order) } it "sets an error message" do rule.eligible?(order) @@ -55,14 +55,14 @@ context "for a guest user" do let(:email) { 'user@spreecommerce.com' } - before { allow(order).to receive_messages :email => 'user@spreecommerce.com' } + before { allow(order).to receive_messages email: 'user@spreecommerce.com' } context "with no other orders" do it { expect(rule).to be_eligible(order) } end context "with another order" do - before { allow(rule).to receive_messages(:orders_by_email => [mock_model(Spree::Order)]) } + before { allow(rule).to receive_messages(orders_by_email: [mock_model(Spree::Order)]) } it { expect(rule).not_to be_eligible(order) } it "sets an error message" do rule.eligible?(order) diff --git a/core/spec/models/spree/promotion/rules/item_total_spec.rb b/core/spec/models/spree/promotion/rules/item_total_spec.rb index a230452badd..7c726c20a36 100644 --- a/core/spec/models/spree/promotion/rules/item_total_spec.rb +++ b/core/spec/models/spree/promotion/rules/item_total_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Promotion::Rules::ItemTotal, :type => :model do +describe Spree::Promotion::Rules::ItemTotal, type: :model do let(:rule) { Spree::Promotion::Rules::ItemTotal.new } let(:order) { double(:order) } diff --git a/core/spec/models/spree/promotion/rules/one_use_per_user_spec.rb b/core/spec/models/spree/promotion/rules/one_use_per_user_spec.rb index d280919071f..e5f46f18109 100644 --- a/core/spec/models/spree/promotion/rules/one_use_per_user_spec.rb +++ b/core/spec/models/spree/promotion/rules/one_use_per_user_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Promotion::Rules::OneUsePerUser, :type => :model do +describe Spree::Promotion::Rules::OneUsePerUser, type: :model do let(:rule) { described_class.new } describe '#eligible?(order)' do diff --git a/core/spec/models/spree/promotion/rules/product_spec.rb b/core/spec/models/spree/promotion/rules/product_spec.rb index e2b4e7324dc..e3e2f2ac639 100644 --- a/core/spec/models/spree/promotion/rules/product_spec.rb +++ b/core/spec/models/spree/promotion/rules/product_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Promotion::Rules::Product, :type => :model do +describe Spree::Promotion::Rules::Product, type: :model do let(:rule) { Spree::Promotion::Rules::Product.new(rule_options) } let(:rule_options) { {} } @@ -8,7 +8,7 @@ let(:order) { Spree::Order.new } it "should be eligible if there are no products" do - allow(rule).to receive_messages(:eligible_products => []) + allow(rule).to receive_messages(eligible_products: []) expect(rule).to be_eligible(order) end @@ -20,8 +20,8 @@ let(:rule_options) { super().merge(preferred_match_policy: 'any') } it "should be eligible if any of the products is in eligible products" do - allow(order).to receive_messages(:products => [@product1, @product2]) - allow(rule).to receive_messages(:eligible_products => [@product2, @product3]) + allow(order).to receive_messages(products: [@product1, @product2]) + allow(rule).to receive_messages(eligible_products: [@product2, @product3]) expect(rule).to be_eligible(order) end @@ -43,8 +43,8 @@ let(:rule_options) { super().merge(preferred_match_policy: 'all') } it "should be eligible if all of the eligible products are ordered" do - allow(order).to receive_messages(:products => [@product3, @product2, @product1]) - allow(rule).to receive_messages(:eligible_products => [@product2, @product3]) + allow(order).to receive_messages(products: [@product3, @product2, @product1]) + allow(rule).to receive_messages(eligible_products: [@product2, @product3]) expect(rule).to be_eligible(order) end @@ -66,8 +66,8 @@ let(:rule_options) { super().merge(preferred_match_policy: 'none') } it "should be eligible if none of the order's products are in eligible products" do - allow(order).to receive_messages(:products => [@product1]) - allow(rule).to receive_messages(:eligible_products => [@product2, @product3]) + allow(order).to receive_messages(products: [@product1]) + allow(rule).to receive_messages(eligible_products: [@product2, @product3]) expect(rule).to be_eligible(order) end diff --git a/core/spec/models/spree/promotion/rules/taxon_spec.rb b/core/spec/models/spree/promotion/rules/taxon_spec.rb index 0fce153f12f..05fb80ef50b 100644 --- a/core/spec/models/spree/promotion/rules/taxon_spec.rb +++ b/core/spec/models/spree/promotion/rules/taxon_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Promotion::Rules::Taxon, :type => :model do +describe Spree::Promotion::Rules::Taxon, type: :model do let(:rule){ subject } context '#elegible?(order)' do diff --git a/core/spec/models/spree/promotion/rules/user_logged_in_spec.rb b/core/spec/models/spree/promotion/rules/user_logged_in_spec.rb index d903eb72784..7b607001133 100644 --- a/core/spec/models/spree/promotion/rules/user_logged_in_spec.rb +++ b/core/spec/models/spree/promotion/rules/user_logged_in_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Promotion::Rules::UserLoggedIn, :type => :model do +describe Spree::Promotion::Rules::UserLoggedIn, type: :model do let(:rule) { Spree::Promotion::Rules::UserLoggedIn.new } context "#eligible?(order)" do @@ -8,13 +8,13 @@ it "should be eligible if order has an associated user" do user = double('User') - allow(order).to receive_messages(:user => user) + allow(order).to receive_messages(user: user) expect(rule).to be_eligible(order) end context "when user is not logged in" do - before { allow(order).to receive_messages(:user => nil) } # better to be explicit here + before { allow(order).to receive_messages(user: nil) } # better to be explicit here it { expect(rule).not_to be_eligible(order) } it "sets an error message" do rule.eligible?(order) diff --git a/core/spec/models/spree/promotion/rules/user_spec.rb b/core/spec/models/spree/promotion/rules/user_spec.rb index e740ca15f73..b8cd957af7f 100644 --- a/core/spec/models/spree/promotion/rules/user_spec.rb +++ b/core/spec/models/spree/promotion/rules/user_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Promotion::Rules::User, :type => :model do +describe Spree::Promotion::Rules::User, type: :model do let(:rule) { Spree::Promotion::Rules::User.new } let(:test_user) { create :user } @@ -21,24 +21,24 @@ it "should be eligible if users include user placing the order" do user = mock_model(Spree::LegacyUser) users = [user, mock_model(Spree::LegacyUser)] - allow(rule).to receive_messages(:users => users) - allow(order).to receive_messages(:user => user) + allow(rule).to receive_messages(users: users) + allow(order).to receive_messages(user: user) expect(rule).to be_eligible(order) end it "should not be eligible if user placing the order is not listed" do - allow(order).to receive_messages(:user => mock_model(Spree::LegacyUser)) + allow(order).to receive_messages(user: mock_model(Spree::LegacyUser)) users = [mock_model(Spree::LegacyUser), mock_model(Spree::LegacyUser)] - allow(rule).to receive_messages(:users => users) + allow(rule).to receive_messages(users: users) expect(rule).not_to be_eligible(order) end # Regression test for #3885 it "can assign to user_ids" do - user1 = Spree::LegacyUser.create!(:email => "test1@example.com") - user2 = Spree::LegacyUser.create!(:email => "test2@example.com") + user1 = Spree::LegacyUser.create!(email: "test1@example.com") + user2 = Spree::LegacyUser.create!(email: "test2@example.com") expect { rule.user_ids = "#{user1.id}, #{user2.id}" }.not_to raise_error end end diff --git a/core/spec/models/spree/promotion_action_spec.rb b/core/spec/models/spree/promotion_action_spec.rb index a32206dde25..2268af40341 100644 --- a/core/spec/models/spree/promotion_action_spec.rb +++ b/core/spec/models/spree/promotion_action_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::PromotionAction, :type => :model do +describe Spree::PromotionAction, type: :model do it "should force developer to implement 'perform' method" do expect { MyAction.new.perform }.to raise_error(NameError) diff --git a/core/spec/models/spree/promotion_category_spec.rb b/core/spec/models/spree/promotion_category_spec.rb index e5efefbc762..da6cdd2391b 100644 --- a/core/spec/models/spree/promotion_category_spec.rb +++ b/core/spec/models/spree/promotion_category_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::PromotionCategory, :type => :model do +describe Spree::PromotionCategory, type: :model do describe 'validation' do let(:name) { 'Nom' } subject { Spree::PromotionCategory.new name: name } diff --git a/core/spec/models/spree/promotion_handler/cart_spec.rb b/core/spec/models/spree/promotion_handler/cart_spec.rb index 57b0f850178..ee726c9abde 100644 --- a/core/spec/models/spree/promotion_handler/cart_spec.rb +++ b/core/spec/models/spree/promotion_handler/cart_spec.rb @@ -2,7 +2,7 @@ module Spree module PromotionHandler - describe Cart, :type => :model do + describe Cart, type: :model do let(:line_item) { create(:line_item) } let(:order) { line_item.order } diff --git a/core/spec/models/spree/promotion_handler/coupon_spec.rb b/core/spec/models/spree/promotion_handler/coupon_spec.rb index a57807dea9a..d79955fd7b3 100644 --- a/core/spec/models/spree/promotion_handler/coupon_spec.rb +++ b/core/spec/models/spree/promotion_handler/coupon_spec.rb @@ -2,7 +2,7 @@ module Spree module PromotionHandler - describe Coupon, :type => :model do + describe Coupon, type: :model do let(:order) { double("Order", coupon_code: "10off").as_null_object } subject { Coupon.new(order) } @@ -47,14 +47,14 @@ module PromotionHandler end context "coupon code promotion doesnt exist" do - before { Promotion.create name: "promo", :code => nil } + before { Promotion.create name: "promo", code: nil } it "doesnt fetch any promotion" do expect(subject.promotion).to be_blank end context "with no actions defined" do - before { Promotion.create name: "promo", :code => "10off" } + before { Promotion.create name: "promo", code: "10off" } it "populates error message" do subject.apply @@ -64,7 +64,7 @@ module PromotionHandler end context "existing coupon code promotion" do - let!(:promotion) { Promotion.create name: "promo", :code => "10off" } + let!(:promotion) { Promotion.create name: "promo", code: "10off" } let!(:action) { Promotion::Actions::CreateItemAdjustments.create(promotion: promotion, calculator: calculator) } let(:calculator) { Calculator::FlatRate.new(preferred_amount: 10) } @@ -73,11 +73,11 @@ module PromotionHandler end context "with a per-item adjustment action" do - let(:order) { create(:order_with_line_items, :line_items_count => 3) } + let(:order) { create(:order_with_line_items, line_items_count: 3) } context "right coupon given" do context "with correct coupon code casing" do - before { allow(order).to receive_messages :coupon_code => "10off" } + before { allow(order).to receive_messages coupon_code: "10off" } it "successfully activates promo" do expect(order.total).to eq(130) @@ -100,7 +100,7 @@ module PromotionHandler # Regression test for #4211 context "with incorrect coupon code casing" do - before { allow(order).to receive_messages :coupon_code => "10OFF" } + before { allow(order).to receive_messages coupon_code: "10OFF" } it "successfully activates promo" do expect(order.total).to eq(130) subject.apply @@ -118,7 +118,7 @@ module PromotionHandler let!(:order) { Order.create } before do - allow(order).to receive_messages :coupon_code => "10off" + allow(order).to receive_messages coupon_code: "10off" calculator = Calculator::FlatRate.new(preferred_amount: 10) general_promo = Promotion.create name: "General Promo" general_action = Promotion::Actions::CreateItemAdjustments.create(promotion: general_promo, calculator: calculator) @@ -137,9 +137,9 @@ module PromotionHandler context "with a free-shipping adjustment action" do let!(:action) { Promotion::Actions::FreeShipping.create(promotion: promotion) } context "right coupon code given" do - let(:order) { create(:order_with_line_items, :line_items_count => 3) } + let(:order) { create(:order_with_line_items, line_items_count: 3) } - before { allow(order).to receive_messages :coupon_code => "10off" } + before { allow(order).to receive_messages coupon_code: "10off" } it "successfully activates promo" do expect(order.total).to eq(130) @@ -166,10 +166,10 @@ module PromotionHandler before do allow(order).to receive_messages({ - :coupon_code => "10off", + coupon_code: "10off", # These need to be here so that promotion adjustment "wins" - :item_total => 50, - :ship_total => 10 + item_total: 50, + ship_total: 10 }) end @@ -200,7 +200,7 @@ module PromotionHandler expect(coupon.successful?).to be true order_2 = create(:order) - allow(order_2).to receive_messages :coupon_code => "10off" + allow(order_2).to receive_messages coupon_code: "10off" coupon = Coupon.new(order_2) coupon.apply expect(coupon.successful?).to be false @@ -210,7 +210,7 @@ module PromotionHandler context "when the a new coupon is less good" do let!(:action_5) { Promotion::Actions::CreateAdjustment.create(promotion: promotion_5, calculator: calculator_5) } let(:calculator_5) { Calculator::FlatRate.new(preferred_amount: 5) } - let!(:promotion_5) { Promotion.create name: "promo", :code => "5off" } + let!(:promotion_5) { Promotion.create name: "promo", code: "5off" } it 'notifies of better deal' do subject.apply @@ -225,23 +225,23 @@ module PromotionHandler context "for an order with taxable line items" do before(:each) do @country = create(:country) - @zone = create(:zone, :name => "Country Zone", :default_tax => true, :zone_members => []) - @zone.zone_members.create(:zoneable => @country) - @category = Spree::TaxCategory.create :name => "Taxable Foo" + @zone = create(:zone, name: "Country Zone", default_tax: true, zone_members: []) + @zone.zone_members.create(zoneable: @country) + @category = Spree::TaxCategory.create name: "Taxable Foo" @rate1 = Spree::TaxRate.create( - :amount => 0.10, - :calculator => Spree::Calculator::DefaultTax.create, - :tax_category => @category, - :zone => @zone + amount: 0.10, + calculator: Spree::Calculator::DefaultTax.create, + tax_category: @category, + zone: @zone ) @order = Spree::Order.create! - allow(@order).to receive_messages :coupon_code => "10off" + allow(@order).to receive_messages coupon_code: "10off" end context "and the product price is less than promo discount" do before(:each) do 3.times do |i| - taxable = create(:product, :tax_category => @category, :price => 9.0) + taxable = create(:product, tax_category: @category, price: 9.0) @order.contents.add(taxable.master, 1) end end @@ -259,7 +259,7 @@ module PromotionHandler context "and the product price is greater than promo discount" do before(:each) do 3.times do |i| - taxable = create(:product, :tax_category => @category, :price => 11.0) + taxable = create(:product, tax_category: @category, price: 11.0) @order.contents.add(taxable.master, 2) end end @@ -276,15 +276,15 @@ module PromotionHandler end context "and multiple quantity per line item" do before(:each) do - twnty_off = Promotion.create name: "promo", :code => "20off" + twnty_off = Promotion.create name: "promo", code: "20off" twnty_off_calc = Calculator::FlatRate.new(preferred_amount: 20) Promotion::Actions::CreateItemAdjustments.create(promotion: twnty_off, calculator: twnty_off_calc) allow(@order).to receive(:coupon_code).and_call_original - allow(@order).to receive_messages :coupon_code => "20off" + allow(@order).to receive_messages coupon_code: "20off" 3.times do |i| - taxable = create(:product, :tax_category => @category, :price => 10.0) + taxable = create(:product, tax_category: @category, price: 10.0) @order.contents.add(taxable.master, 2) end end diff --git a/core/spec/models/spree/promotion_handler/page_spec.rb b/core/spec/models/spree/promotion_handler/page_spec.rb index 0ddc40a0f25..9c6b437f49f 100644 --- a/core/spec/models/spree/promotion_handler/page_spec.rb +++ b/core/spec/models/spree/promotion_handler/page_spec.rb @@ -2,13 +2,13 @@ module Spree module PromotionHandler - describe Page, :type => :model do - let(:order) { create(:order_with_line_items, :line_items_count => 1) } + describe Page, type: :model do + let(:order) { create(:order_with_line_items, line_items_count: 1) } - let(:promotion) { Promotion.create(name: "10% off", :path => '10off') } + let(:promotion) { Promotion.create(name: "10% off", path: '10off') } before do calculator = Calculator::FlatPercentItemTotal.new(preferred_flat_percent: 10) - action = Promotion::Actions::CreateItemAdjustments.create(:calculator => calculator) + action = Promotion::Actions::CreateItemAdjustments.create(calculator: calculator) promotion.actions << action end @@ -21,8 +21,8 @@ module PromotionHandler context "when promotion is expired" do before do promotion.update_columns( - :starts_at => 1.week.ago, - :expires_at => 1.day.ago + starts_at: 1.week.ago, + expires_at: 1.day.ago ) end diff --git a/core/spec/models/spree/promotion_rule_spec.rb b/core/spec/models/spree/promotion_rule_spec.rb index 71813370ce6..930c12706b8 100644 --- a/core/spec/models/spree/promotion_rule_spec.rb +++ b/core/spec/models/spree/promotion_rule_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Spree::PromotionRule, :type => :model do + describe Spree::PromotionRule, type: :model do class BadTestRule < Spree::PromotionRule; end diff --git a/core/spec/models/spree/promotion_spec.rb b/core/spec/models/spree/promotion_spec.rb index 1335f8e15f4..17e87fd8804 100644 --- a/core/spec/models/spree/promotion_spec.rb +++ b/core/spec/models/spree/promotion_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe Spree::Promotion, :type => :model do +describe Spree::Promotion, type: :model do let(:promotion) { Spree::Promotion.new } describe "validations" do before :each do - @valid_promotion = Spree::Promotion.new :name => "A promotion" + @valid_promotion = Spree::Promotion.new name: "A promotion" end it "valid_promotion is valid" do @@ -114,7 +114,7 @@ end describe "#destroy" do - let(:promotion) { Spree::Promotion.create(:name => "delete me") } + let(:promotion) { Spree::Promotion.create(name: "delete me") } before(:each) do promotion.actions << Spree::Promotion::Actions::CreateAdjustment.new @@ -133,7 +133,7 @@ end describe "#save" do - let(:promotion) { Spree::Promotion.create(:name => "delete me") } + let(:promotion) { Spree::Promotion.create(name: "delete me") } before(:each) do promotion.actions << Spree::Promotion::Actions::CreateAdjustment.new @@ -158,9 +158,9 @@ promotion.promotion_actions = [@action1, @action2] promotion.created_at = 2.days.ago - @user = stub_model(Spree::LegacyUser, :email => "spree@example.com") + @user = stub_model(Spree::LegacyUser, email: "spree@example.com") @order = Spree::Order.create user: @user - @payload = { :order => @order, :user => @user } + @payload = { order: @order, user: @user } end it "should check path if present" do @@ -220,10 +220,10 @@ it "should have its usage limit exceeded" do promotion.usage_limit = 2 - allow(promotion).to receive_messages(:adjusted_credits_count => 2) + allow(promotion).to receive_messages(adjusted_credits_count: 2) expect(promotion.usage_limit_exceeded?(promotable)).to be true - allow(promotion).to receive_messages(:adjusted_credits_count => 3) + allow(promotion).to receive_messages(adjusted_credits_count: 3) expect(promotion.usage_limit_exceeded?(promotable)).to be true end end @@ -261,7 +261,7 @@ it "should not be expired if usage limit is not exceeded" do promotion.usage_limit = 2 - allow(promotion).to receive_messages(:credits_count => 1) + allow(promotion).to receive_messages(credits_count: 1) expect(promotion).not_to be_expired end end @@ -277,7 +277,7 @@ let!(:action) do calculator = Spree::Calculator::FlatRate.new - action_params = { :promotion => promotion, :calculator => calculator } + action_params = { promotion: promotion, calculator: calculator } action = Spree::Promotion::Actions::CreateAdjustment.create(action_params) promotion.actions << action action @@ -309,7 +309,7 @@ context "#adjusted_credits_count" do let(:order) { create :order } let(:line_item) { create :line_item, order: order } - let(:promotion) { Spree::Promotion.create name: "promo", :code => "10off" } + let(:promotion) { Spree::Promotion.create name: "promo", code: "10off" } let(:order_action) { action = Spree::Promotion::Actions::CreateAdjustment.create(calculator: Spree::Calculator::FlatPercentItemTotal.new) promotion.actions << action @@ -322,20 +322,20 @@ } let(:order_adjustment) do Spree::Adjustment.create!( - :source => order_action, - :amount => 10, - :adjustable => order, - :order => order, - :label => "Promotional adjustment" + source: order_action, + amount: 10, + adjustable: order, + order: order, + label: "Promotional adjustment" ) end let(:item_adjustment) do Spree::Adjustment.create!( - :source => item_action, - :amount => 10, - :adjustable => line_item, - :order => order, - :label => "Promotional adjustment" + source: item_action, + amount: 10, + adjustable: line_item, + order: order, + label: "Promotional adjustment" ) end @@ -425,7 +425,7 @@ end it "true if there are no applicable rules" do - promotion.promotion_rules = [stub_model(Spree::PromotionRule, :eligible? => true, :applicable? => false)] + promotion.promotion_rules = [stub_model(Spree::PromotionRule, eligible?: true, applicable?: false)] allow(promotion.promotion_rules).to receive(:for).and_return([]) expect(promotion.eligible_rules(promotable)).to eq [] end @@ -473,14 +473,14 @@ end context "with 'any' match policy" do - let(:promotion) { Spree::Promotion.create(:name => "Promo", :match_policy => 'any') } + let(:promotion) { Spree::Promotion.create(name: "Promo", match_policy: 'any') } let(:promotable) { double('Promotable') } it "should have eligible rules if any of the rules are eligible" do - allow_any_instance_of(Spree::PromotionRule).to receive_messages(:applicable? => true) - true_rule = Spree::PromotionRule.create(:promotion => promotion) - allow(true_rule).to receive_messages(:eligible? => true) - allow(promotion).to receive_messages(:rules => [true_rule]) + allow_any_instance_of(Spree::PromotionRule).to receive_messages(applicable?: true) + true_rule = Spree::PromotionRule.create(promotion: promotion) + allow(true_rule).to receive_messages(eligible?: true) + allow(promotion).to receive_messages(rules: [true_rule]) allow(promotion).to receive_message_chain(:rules, :for).and_return([true_rule]) expect(promotion.eligible_rules(promotable)).to eq [true_rule] end @@ -565,7 +565,7 @@ # admin form posts the code and path as empty string describe "normalize blank values for code & path" do it "will save blank value as nil value instead" do - promotion = Spree::Promotion.create(:name => "A promotion", :code => "", :path => "") + promotion = Spree::Promotion.create(name: "A promotion", code: "", path: "") expect(promotion.code).to be_nil expect(promotion.path).to be_nil end @@ -574,7 +574,7 @@ # Regression test for #4081 describe "#with_coupon_code" do context "and code stored in uppercase" do - let!(:promotion) { create(:promotion, :code => "MY-COUPON-123") } + let!(:promotion) { create(:promotion, code: "MY-COUPON-123") } it "finds the code with lowercase" do expect(Spree::Promotion.with_coupon_code("my-coupon-123")).to eql promotion end diff --git a/core/spec/models/spree/property_spec.rb b/core/spec/models/spree/property_spec.rb index 999afaea9d2..d5d3fce80c3 100644 --- a/core/spec/models/spree/property_spec.rb +++ b/core/spec/models/spree/property_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -describe Spree::Property, :type => :model do +describe Spree::Property, type: :model do end diff --git a/core/spec/models/spree/prototype_spec.rb b/core/spec/models/spree/prototype_spec.rb index 16fff45391d..bb7bf476d4c 100644 --- a/core/spec/models/spree/prototype_spec.rb +++ b/core/spec/models/spree/prototype_spec.rb @@ -1,5 +1,5 @@ require 'spec_helper' -describe Spree::Prototype, :type => :model do +describe Spree::Prototype, type: :model do end diff --git a/core/spec/models/spree/refund_spec.rb b/core/spec/models/spree/refund_spec.rb index 4b54222dbfe..f304c01ca8c 100644 --- a/core/spec/models/spree/refund_spec.rb +++ b/core/spec/models/spree/refund_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Refund, :type => :model do +describe Spree::Refund, type: :model do describe 'create' do let(:amount) { 100.0 } diff --git a/core/spec/models/spree/reimbursement/credit_spec.rb b/core/spec/models/spree/reimbursement/credit_spec.rb index 34873999f3b..c456fbe1d9b 100644 --- a/core/spec/models/spree/reimbursement/credit_spec.rb +++ b/core/spec/models/spree/reimbursement/credit_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Reimbursement::Credit, :type => :model do + describe Reimbursement::Credit, type: :model do context 'class methods' do describe '.total_amount_reimbursed_for' do subject { Spree::Reimbursement::Credit.total_amount_reimbursed_for(reimbursement) } diff --git a/core/spec/models/spree/reimbursement/reimbursement_type_engine_spec.rb b/core/spec/models/spree/reimbursement/reimbursement_type_engine_spec.rb index 5844c83b971..2ce3cca9601 100644 --- a/core/spec/models/spree/reimbursement/reimbursement_type_engine_spec.rb +++ b/core/spec/models/spree/reimbursement/reimbursement_type_engine_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Reimbursement::ReimbursementTypeEngine, :type => :model do + describe Reimbursement::ReimbursementTypeEngine, type: :model do describe '#calculate_reimbursement_types' do let(:return_item) { create(:return_item) } let(:return_items) { [ return_item ] } diff --git a/core/spec/models/spree/reimbursement/reimbursement_type_validator_spec.rb b/core/spec/models/spree/reimbursement/reimbursement_type_validator_spec.rb index b86b1029432..005ef83f4bc 100644 --- a/core/spec/models/spree/reimbursement/reimbursement_type_validator_spec.rb +++ b/core/spec/models/spree/reimbursement/reimbursement_type_validator_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe Reimbursement::ReimbursementTypeValidator, :type => :model do + describe Reimbursement::ReimbursementTypeValidator, type: :model do class DummyClass include Spree::Reimbursement::ReimbursementTypeValidator diff --git a/core/spec/models/spree/reimbursement_performer_spec.rb b/core/spec/models/spree/reimbursement_performer_spec.rb index c237a3e68a0..d5c4b80189b 100644 --- a/core/spec/models/spree/reimbursement_performer_spec.rb +++ b/core/spec/models/spree/reimbursement_performer_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::ReimbursementPerformer, :type => :model do +describe Spree::ReimbursementPerformer, type: :model do let(:reimbursement) { create(:reimbursement, return_items_count: 1) } let(:return_item) { reimbursement.return_items.first } let(:reimbursement_type) { double("ReimbursementType") } diff --git a/core/spec/models/spree/reimbursement_tax_calculator_spec.rb b/core/spec/models/spree/reimbursement_tax_calculator_spec.rb index 38bbac6643a..905e67444fe 100644 --- a/core/spec/models/spree/reimbursement_tax_calculator_spec.rb +++ b/core/spec/models/spree/reimbursement_tax_calculator_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::ReimbursementTaxCalculator, :type => :model do +describe Spree::ReimbursementTaxCalculator, type: :model do let!(:tax_rate) { nil } diff --git a/core/spec/models/spree/reimbursement_type/credit_spec.rb b/core/spec/models/spree/reimbursement_type/credit_spec.rb index 4b46c28abbc..1702d2026c5 100644 --- a/core/spec/models/spree/reimbursement_type/credit_spec.rb +++ b/core/spec/models/spree/reimbursement_type/credit_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe ReimbursementType::Credit, :type => :model do + describe ReimbursementType::Credit, type: :model do let(:reimbursement) { create(:reimbursement, return_items_count: 1) } let(:return_item) { reimbursement.return_items.first } let(:payment) { reimbursement.order.payments.first } diff --git a/core/spec/models/spree/reimbursement_type/exchange_spec.rb b/core/spec/models/spree/reimbursement_type/exchange_spec.rb index ed3cd90381f..2264f112594 100644 --- a/core/spec/models/spree/reimbursement_type/exchange_spec.rb +++ b/core/spec/models/spree/reimbursement_type/exchange_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe ReimbursementType::Exchange, :type => :model do + describe ReimbursementType::Exchange, type: :model do describe '.reimburse' do let(:reimbursement) { create(:reimbursement, return_items_count: 1) } let(:return_items) { reimbursement.return_items } diff --git a/core/spec/models/spree/reimbursement_type/original_payment_spec.rb b/core/spec/models/spree/reimbursement_type/original_payment_spec.rb index 08384bef4ca..366343d9571 100644 --- a/core/spec/models/spree/reimbursement_type/original_payment_spec.rb +++ b/core/spec/models/spree/reimbursement_type/original_payment_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe ReimbursementType::OriginalPayment, :type => :model do + describe ReimbursementType::OriginalPayment, type: :model do let(:reimbursement) { create(:reimbursement, return_items_count: 1) } let(:return_item) { reimbursement.return_items.first } let(:payment) { reimbursement.order.payments.first } diff --git a/core/spec/models/spree/return_authorization_spec.rb b/core/spec/models/spree/return_authorization_spec.rb index 2c2c0d95a98..288420ba54a 100644 --- a/core/spec/models/spree/return_authorization_spec.rb +++ b/core/spec/models/spree/return_authorization_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::ReturnAuthorization, :type => :model do +describe Spree::ReturnAuthorization, type: :model do let(:order) { create(:shipped_order) } let(:stock_location) { create(:stock_location) } let(:rma_reason) { create(:return_authorization_reason) } diff --git a/core/spec/models/spree/return_item/eligibility_validator/default_spec.rb b/core/spec/models/spree/return_item/eligibility_validator/default_spec.rb index cf463319f17..fb820efdc53 100644 --- a/core/spec/models/spree/return_item/eligibility_validator/default_spec.rb +++ b/core/spec/models/spree/return_item/eligibility_validator/default_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::ReturnItem::EligibilityValidator::Default, :type => :model do +describe Spree::ReturnItem::EligibilityValidator::Default, type: :model do let(:return_item) { create(:return_item) } let(:validator) { Spree::ReturnItem::EligibilityValidator::Default.new(return_item) } diff --git a/core/spec/models/spree/return_item/eligibility_validator/rma_required_spec.rb b/core/spec/models/spree/return_item/eligibility_validator/rma_required_spec.rb index bee343e3e79..3abca7039b2 100644 --- a/core/spec/models/spree/return_item/eligibility_validator/rma_required_spec.rb +++ b/core/spec/models/spree/return_item/eligibility_validator/rma_required_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::ReturnItem::EligibilityValidator::RMARequired, :type => :model do +describe Spree::ReturnItem::EligibilityValidator::RMARequired, type: :model do let(:return_item) { create(:return_item) } let(:validator) { Spree::ReturnItem::EligibilityValidator::RMARequired.new(return_item) } diff --git a/core/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb b/core/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb index e8341b04029..1ea9ac0860c 100644 --- a/core/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb +++ b/core/spec/models/spree/return_item/eligibility_validator/time_since_purchase_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::ReturnItem::EligibilityValidator::TimeSincePurchase, :type => :model do +describe Spree::ReturnItem::EligibilityValidator::TimeSincePurchase, type: :model do let(:inventory_unit) { create(:inventory_unit, order: create(:shipped_order)) } let(:return_item) { create(:return_item, inventory_unit: inventory_unit) } let(:validator) { Spree::ReturnItem::EligibilityValidator::TimeSincePurchase.new(return_item) } diff --git a/core/spec/models/spree/return_item/exchange_variant_eligibility/same_option_value_spec.rb b/core/spec/models/spree/return_item/exchange_variant_eligibility/same_option_value_spec.rb index 70f368298ad..ef2b2447d15 100644 --- a/core/spec/models/spree/return_item/exchange_variant_eligibility/same_option_value_spec.rb +++ b/core/spec/models/spree/return_item/exchange_variant_eligibility/same_option_value_spec.rb @@ -2,7 +2,7 @@ module Spree module ReturnItem::ExchangeVariantEligibility - describe SameOptionValue, :type => :model do + describe SameOptionValue, type: :model do describe ".eligible_variants" do let(:color_option_type) { create(:option_type, name: "color") } let(:waist_option_type) { create(:option_type, name: "waist") } diff --git a/core/spec/models/spree/return_item/exchange_variant_eligibility/same_product_spec.rb b/core/spec/models/spree/return_item/exchange_variant_eligibility/same_product_spec.rb index d5d06454e3d..3c29a546cdd 100644 --- a/core/spec/models/spree/return_item/exchange_variant_eligibility/same_product_spec.rb +++ b/core/spec/models/spree/return_item/exchange_variant_eligibility/same_product_spec.rb @@ -2,7 +2,7 @@ module Spree module ReturnItem::ExchangeVariantEligibility - describe SameProduct, :type => :model do + describe SameProduct, type: :model do describe ".eligible_variants" do context "product has no variants" do diff --git a/core/spec/models/spree/return_item_spec.rb b/core/spec/models/spree/return_item_spec.rb index 7bfc9d01d5c..aea568905be 100644 --- a/core/spec/models/spree/return_item_spec.rb +++ b/core/spec/models/spree/return_item_spec.rb @@ -8,7 +8,7 @@ end end -describe Spree::ReturnItem, :type => :model do +describe Spree::ReturnItem, type: :model do all_reception_statuses = Spree::ReturnItem.state_machines[:reception_status].states.map(&:name).map(&:to_s) all_acceptance_statuses = Spree::ReturnItem.state_machines[:acceptance_status].states.map(&:name).map(&:to_s) diff --git a/core/spec/models/spree/returns_calculator_spec.rb b/core/spec/models/spree/returns_calculator_spec.rb index 58c31216977..97451eb78cd 100644 --- a/core/spec/models/spree/returns_calculator_spec.rb +++ b/core/spec/models/spree/returns_calculator_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe ReturnsCalculator, :type => :model do + describe ReturnsCalculator, type: :model do let(:return_item) { build(:return_item) } subject { ReturnsCalculator.new } diff --git a/core/spec/models/spree/shipment_spec.rb b/core/spec/models/spree/shipment_spec.rb index 7b883c09875..65e67154804 100644 --- a/core/spec/models/spree/shipment_spec.rb +++ b/core/spec/models/spree/shipment_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require 'benchmark' -describe Spree::Shipment, :type => :model do +describe Spree::Shipment, type: :model do let(:order) { mock_model Spree::Order, backordered?: false, canceled?: false, can_ship?: true, @@ -727,7 +727,7 @@ def perform() true end context "state changes" do before do # Must be stubbed so transition can succeed - allow(order).to receive_messages :paid? => true + allow(order).to receive_messages paid?: true end it "are logged to the database" do diff --git a/core/spec/models/spree/shipping_calculator_spec.rb b/core/spec/models/spree/shipping_calculator_spec.rb index 4874e60107f..b111cb4e86d 100644 --- a/core/spec/models/spree/shipping_calculator_spec.rb +++ b/core/spec/models/spree/shipping_calculator_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' module Spree - describe ShippingCalculator, :type => :model do - let(:variant1) { build(:variant, :price => 10) } - let(:variant2) { build(:variant, :price => 20) } + describe ShippingCalculator, type: :model do + let(:variant1) { build(:variant, price: 10) } + let(:variant2) { build(:variant, price: 20) } let(:package) do build(:stock_package, variants_contents: { variant1 => 2, variant2 => 1 }) diff --git a/core/spec/models/spree/shipping_category_spec.rb b/core/spec/models/spree/shipping_category_spec.rb index 9fcd9ae81d3..b6e2d199d19 100644 --- a/core/spec/models/spree/shipping_category_spec.rb +++ b/core/spec/models/spree/shipping_category_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::ShippingCategory, :type => :model do +describe Spree::ShippingCategory, type: :model do describe '#validations' do it 'should have a valid factory' do diff --git a/core/spec/models/spree/shipping_method_spec.rb b/core/spec/models/spree/shipping_method_spec.rb index 9ae671efae8..2335466eb90 100644 --- a/core/spec/models/spree/shipping_method_spec.rb +++ b/core/spec/models/spree/shipping_method_spec.rb @@ -3,7 +3,7 @@ class DummyShippingCalculator < Spree::ShippingCalculator end -describe Spree::ShippingMethod, :type => :model do +describe Spree::ShippingMethod, type: :model do let(:shipping_method){ create(:shipping_method) } context 'calculators' do @@ -25,7 +25,7 @@ class DummyShippingCalculator < Spree::ShippingCalculator let!(:shipping_method) { create(:shipping_method) } let!(:shipment) do shipment = create(:shipment) - shipment.shipping_rates.create!(:shipping_method => shipping_method) + shipment.shipping_rates.create!(shipping_method: shipping_method) shipment end diff --git a/core/spec/models/spree/state_spec.rb b/core/spec/models/spree/state_spec.rb index 233a81db919..17764038ebb 100644 --- a/core/spec/models/spree/state_spec.rb +++ b/core/spec/models/spree/state_spec.rb @@ -13,7 +13,7 @@ end it "can find a state by name or abbr" do - state = create(:state, :name => "California", :abbr => "CA") + state = create(:state, name: "California", abbr: "CA") expect(Spree::State.find_all_by_name_or_abbr("California")).to include(state) expect(Spree::State.find_all_by_name_or_abbr("CA")).to include(state) end diff --git a/core/spec/models/spree/stock/availability_validator_spec.rb b/core/spec/models/spree/stock/availability_validator_spec.rb index 6e89871a0de..a5086ef5464 100644 --- a/core/spec/models/spree/stock/availability_validator_spec.rb +++ b/core/spec/models/spree/stock/availability_validator_spec.rb @@ -2,7 +2,7 @@ module Spree module Stock - describe AvailabilityValidator, :type => :model do + describe AvailabilityValidator, type: :model do let!(:line_item) { double(quantity: 5, variant_id: 1, variant: double.as_null_object, errors: double('errors'), inventory_units: []) } subject { described_class.new } diff --git a/core/spec/models/spree/stock/coordinator_spec.rb b/core/spec/models/spree/stock/coordinator_spec.rb index 07af886f642..4ae75b2c406 100644 --- a/core/spec/models/spree/stock/coordinator_spec.rb +++ b/core/spec/models/spree/stock/coordinator_spec.rb @@ -2,7 +2,7 @@ module Spree module Stock - describe Coordinator, :type => :model do + describe Coordinator, type: :model do let(:order) { create(:order_with_line_items) } subject { Coordinator.new(order) } diff --git a/core/spec/models/spree/stock/differentiator_spec.rb b/core/spec/models/spree/stock/differentiator_spec.rb index 643ca133bc3..0f57a2f65c7 100644 --- a/core/spec/models/spree/stock/differentiator_spec.rb +++ b/core/spec/models/spree/stock/differentiator_spec.rb @@ -2,7 +2,7 @@ module Spree module Stock - describe Differentiator, :type => :model do + describe Differentiator, type: :model do let(:variant1) { mock_model(Variant) } let(:variant2) { mock_model(Variant) } diff --git a/core/spec/models/spree/stock/estimator_spec.rb b/core/spec/models/spree/stock/estimator_spec.rb index 346b2290b7f..df227b55dab 100644 --- a/core/spec/models/spree/stock/estimator_spec.rb +++ b/core/spec/models/spree/stock/estimator_spec.rb @@ -2,7 +2,7 @@ module Spree module Stock - describe Estimator, :type => :model do + describe Estimator, type: :model do let!(:shipping_method) { create(:shipping_method) } let(:package) { build(:stock_package, contents: inventory_units.map { |i| ContentItem.new(inventory_unit) }) } let(:order) { build(:order_with_line_items) } @@ -12,13 +12,13 @@ module Stock context "#shipping rates" do before(:each) do - shipping_method.zones.first.members.create(:zoneable => order.ship_address.country) + shipping_method.zones.first.members.create(zoneable: order.ship_address.country) allow_any_instance_of(ShippingMethod).to receive_message_chain(:calculator, :available?).and_return(true) allow_any_instance_of(ShippingMethod).to receive_message_chain(:calculator, :compute).and_return(4.00) - allow_any_instance_of(ShippingMethod).to receive_message_chain(:calculator, :preferences).and_return({:currency => currency}) + allow_any_instance_of(ShippingMethod).to receive_message_chain(:calculator, :preferences).and_return({currency: currency}) allow_any_instance_of(ShippingMethod).to receive_message_chain(:calculator, :marked_for_destruction?) - allow(package).to receive_messages(:shipping_methods => [shipping_method]) + allow(package).to receive_messages(shipping_methods: [shipping_method]) end let(:currency) { "USD" } diff --git a/core/spec/models/spree/stock/inventory_unit_builder_spec.rb b/core/spec/models/spree/stock/inventory_unit_builder_spec.rb index d37587879d0..bbe77cc1b45 100644 --- a/core/spec/models/spree/stock/inventory_unit_builder_spec.rb +++ b/core/spec/models/spree/stock/inventory_unit_builder_spec.rb @@ -2,7 +2,7 @@ module Spree module Stock - describe InventoryUnitBuilder, :type => :model do + describe InventoryUnitBuilder, type: :model do let(:line_item_1) { build(:line_item) } let(:line_item_2) { build(:line_item, quantity: 2) } let(:order) { build(:order, line_items: [line_item_1, line_item_2]) } diff --git a/core/spec/models/spree/stock/package_spec.rb b/core/spec/models/spree/stock/package_spec.rb index e06291d8816..660ffa6f2b6 100644 --- a/core/spec/models/spree/stock/package_spec.rb +++ b/core/spec/models/spree/stock/package_spec.rb @@ -2,7 +2,7 @@ module Spree module Stock - describe Package, :type => :model do + describe Package, type: :model do let(:variant) { build(:variant, weight: 25.0) } let(:stock_location) { build(:stock_location) } let(:order) { build(:order) } diff --git a/core/spec/models/spree/stock/packer_spec.rb b/core/spec/models/spree/stock/packer_spec.rb index a25f3ae3a85..90e8acc6cdf 100644 --- a/core/spec/models/spree/stock/packer_spec.rb +++ b/core/spec/models/spree/stock/packer_spec.rb @@ -2,7 +2,7 @@ module Spree module Stock - describe Packer, :type => :model do + describe Packer, type: :model do let(:inventory_units) { [InventoryUnit.new(variant: create(:variant))] } let(:stock_location) { create(:stock_location) } diff --git a/core/spec/models/spree/stock/prioritizer_spec.rb b/core/spec/models/spree/stock/prioritizer_spec.rb index d92ee075b93..e05d2d2a17f 100644 --- a/core/spec/models/spree/stock/prioritizer_spec.rb +++ b/core/spec/models/spree/stock/prioritizer_spec.rb @@ -2,7 +2,7 @@ module Spree module Stock - describe Prioritizer, :type => :model do + describe Prioritizer, type: :model do let(:order) { mock_model(Order) } let(:stock_location) { build(:stock_location) } let(:variant) { build(:variant) } diff --git a/core/spec/models/spree/stock/splitter/backordered_spec.rb b/core/spec/models/spree/stock/splitter/backordered_spec.rb index 97d9bde96a9..9005f737e01 100644 --- a/core/spec/models/spree/stock/splitter/backordered_spec.rb +++ b/core/spec/models/spree/stock/splitter/backordered_spec.rb @@ -3,7 +3,7 @@ module Spree module Stock module Splitter - describe Backordered, :type => :model do + describe Backordered, type: :model do let(:variant) { build(:variant) } let(:packer) { build(:stock_packer) } diff --git a/core/spec/models/spree/stock/splitter/base_spec.rb b/core/spec/models/spree/stock/splitter/base_spec.rb index ad64d10c709..db072ea3596 100644 --- a/core/spec/models/spree/stock/splitter/base_spec.rb +++ b/core/spec/models/spree/stock/splitter/base_spec.rb @@ -3,7 +3,7 @@ module Spree module Stock module Splitter - describe Base, :type => :model do + describe Base, type: :model do let(:packer) { build(:stock_packer) } it 'continues to splitter chain' do diff --git a/core/spec/models/spree/stock/splitter/shipping_category_spec.rb b/core/spec/models/spree/stock/splitter/shipping_category_spec.rb index f87ae811dd2..0c42a684913 100644 --- a/core/spec/models/spree/stock/splitter/shipping_category_spec.rb +++ b/core/spec/models/spree/stock/splitter/shipping_category_spec.rb @@ -3,7 +3,7 @@ module Spree module Stock module Splitter - describe ShippingCategory, :type => :model do + describe ShippingCategory, type: :model do let(:variant1) { create(:variant) } let(:variant2) { create(:variant) } diff --git a/core/spec/models/spree/stock_item_spec.rb b/core/spec/models/spree/stock_item_spec.rb index 46ccc738b34..55141a91395 100644 --- a/core/spec/models/spree/stock_item_spec.rb +++ b/core/spec/models/spree/stock_item_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::StockItem, :type => :model do +describe Spree::StockItem, type: :model do let(:stock_location) { create(:stock_location_with_items) } subject { stock_location.stock_items.order(:id).first } @@ -73,7 +73,7 @@ let(:inventory_unit_2) { double('InventoryUnit2') } before do - allow(subject).to receive_messages(:backordered_inventory_units => [inventory_unit, inventory_unit_2]) + allow(subject).to receive_messages(backordered_inventory_units: [inventory_unit, inventory_unit_2]) subject.update_column(:count_on_hand, -2) end @@ -94,7 +94,7 @@ end context "adds new items" do - before { allow(subject).to receive_messages(:backordered_inventory_units => [inventory_unit, inventory_unit_2]) } + before { allow(subject).to receive_messages(backordered_inventory_units: [inventory_unit, inventory_unit_2]) } it "fills existing backorders" do expect(inventory_unit).to receive(:fill_backorder) @@ -132,7 +132,7 @@ end context "adds new items" do - before { allow(subject).to receive_messages(:backordered_inventory_units => [inventory_unit, inventory_unit_2]) } + before { allow(subject).to receive_messages(backordered_inventory_units: [inventory_unit, inventory_unit_2]) } it "fills existing backorders" do expect(inventory_unit).to receive(:fill_backorder) diff --git a/core/spec/models/spree/stock_location_spec.rb b/core/spec/models/spree/stock_location_spec.rb index 22878ae411a..27b705719f1 100644 --- a/core/spec/models/spree/stock_location_spec.rb +++ b/core/spec/models/spree/stock_location_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe StockLocation, :type => :model do + describe StockLocation, type: :model do subject { create(:stock_location_with_items, backorderable_default: true) } let(:stock_item) { subject.stock_items.order(:id).first } let(:variant) { stock_item.variant } @@ -132,14 +132,14 @@ module Spree end it 'can be deactivated' do - create(:stock_location, :active => true) - create(:stock_location, :active => false) + create(:stock_location, active: true) + create(:stock_location, active: false) expect(Spree::StockLocation.active.count).to eq 1 end it 'ensures only one stock location is default at a time' do - first = create(:stock_location, :active => true, :default => true) - second = create(:stock_location, :active => true, :default => true) + first = create(:stock_location, active: true, default: true) + second = create(:stock_location, active: true, default: true) expect(first.reload.default).to eq false expect(second.reload.default).to eq true diff --git a/core/spec/models/spree/stock_movement_spec.rb b/core/spec/models/spree/stock_movement_spec.rb index 5abc7242f6c..2ffdcc803c7 100644 --- a/core/spec/models/spree/stock_movement_spec.rb +++ b/core/spec/models/spree/stock_movement_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::StockMovement, :type => :model do +describe Spree::StockMovement, type: :model do describe 'Constants' do describe 'QUANTITY_LIMITS[:max]' do diff --git a/core/spec/models/spree/stock_transfer_spec.rb b/core/spec/models/spree/stock_transfer_spec.rb index 23f94b942dd..3ec2f396e64 100644 --- a/core/spec/models/spree/stock_transfer_spec.rb +++ b/core/spec/models/spree/stock_transfer_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' module Spree - describe StockTransfer, :type => :model do + describe StockTransfer, type: :model do let(:destination_location) { create(:stock_location_with_items) } let(:source_location) { create(:stock_location_with_items) } let(:stock_item) { source_location.stock_items.order(:id).first } diff --git a/core/spec/models/spree/store_spec.rb b/core/spec/models/spree/store_spec.rb index ba2e9d55525..9740bb093db 100644 --- a/core/spec/models/spree/store_spec.rb +++ b/core/spec/models/spree/store_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Store, :type => :model do +describe Spree::Store, type: :model do describe ".by_url" do let!(:store) { create(:store, url: "website1.com\nwww.subdomain.com") } diff --git a/core/spec/models/spree/tax_category_spec.rb b/core/spec/models/spree/tax_category_spec.rb index 7041470c937..9ca70b2c65e 100644 --- a/core/spec/models/spree/tax_category_spec.rb +++ b/core/spec/models/spree/tax_category_spec.rb @@ -15,7 +15,7 @@ end it "should undefault the previous default tax category" do - new_tax_category.update_attributes({:is_default => true}) + new_tax_category.update_attributes({is_default: true}) expect(new_tax_category.is_default).to be true tax_category.reload diff --git a/core/spec/models/spree/tax_rate_spec.rb b/core/spec/models/spree/tax_rate_spec.rb index 0290cc53fc0..e44fd713600 100644 --- a/core/spec/models/spree/tax_rate_spec.rb +++ b/core/spec/models/spree/tax_rate_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::TaxRate, :type => :model do +describe Spree::TaxRate, type: :model do context "match" do let(:order) { create(:order) } let(:country) { create(:country) } @@ -8,67 +8,67 @@ let(:calculator) { Spree::Calculator::FlatRate.new } it "should return an empty array when tax_zone is nil" do - allow(order).to receive_messages :tax_zone => nil + allow(order).to receive_messages tax_zone: nil expect(Spree::TaxRate.match(order.tax_zone)).to eq([]) end context "when no rate zones match the tax zone" do before do - Spree::TaxRate.create(:amount => 1, :zone => create(:zone)) + Spree::TaxRate.create(amount: 1, zone: create(:zone)) end context "when there is no default tax zone" do before do - @zone = create(:zone, :name => "Country Zone", :default_tax => false, :zone_members => []) - @zone.zone_members.create(:zoneable => country) + @zone = create(:zone, name: "Country Zone", default_tax: false, zone_members: []) + @zone.zone_members.create(zoneable: country) end it "should return an empty array" do - allow(order).to receive_messages :tax_zone => @zone + allow(order).to receive_messages tax_zone: @zone expect(Spree::TaxRate.match(order.tax_zone)).to eq([]) end it "should return the rate that matches the rate zone" do rate = Spree::TaxRate.create( - :amount => 1, - :zone => @zone, - :tax_category => tax_category, - :calculator => calculator + amount: 1, + zone: @zone, + tax_category: tax_category, + calculator: calculator ) - allow(order).to receive_messages :tax_zone => @zone + allow(order).to receive_messages tax_zone: @zone expect(Spree::TaxRate.match(order.tax_zone)).to eq([rate]) end it "should return all rates that match the rate zone" do rate1 = Spree::TaxRate.create( - :amount => 1, - :zone => @zone, - :tax_category => tax_category, - :calculator => calculator + amount: 1, + zone: @zone, + tax_category: tax_category, + calculator: calculator ) rate2 = Spree::TaxRate.create( - :amount => 2, - :zone => @zone, - :tax_category => tax_category, - :calculator => Spree::Calculator::FlatRate.new + amount: 2, + zone: @zone, + tax_category: tax_category, + calculator: Spree::Calculator::FlatRate.new ) - allow(order).to receive_messages :tax_zone => @zone + allow(order).to receive_messages tax_zone: @zone expect(Spree::TaxRate.match(order.tax_zone)).to match_array([rate1, rate2]) end context "when the tax_zone is contained within a rate zone" do before do - sub_zone = create(:zone, :name => "State Zone", :zone_members => []) - sub_zone.zone_members.create(:zoneable => create(:state, :country => country)) - allow(order).to receive_messages :tax_zone => sub_zone + sub_zone = create(:zone, name: "State Zone", zone_members: []) + sub_zone.zone_members.create(zoneable: create(:state, country: country)) + allow(order).to receive_messages tax_zone: sub_zone @rate = Spree::TaxRate.create( - :amount => 1, - :zone => @zone, - :tax_category => tax_category, - :calculator => calculator + amount: 1, + zone: @zone, + tax_category: tax_category, + calculator: calculator ) end @@ -80,24 +80,24 @@ context "when there is a default tax zone" do before do - @zone = create(:zone, :name => "Country Zone", :default_tax => true, :zone_members => []) - @zone.zone_members.create(:zoneable => country) + @zone = create(:zone, name: "Country Zone", default_tax: true, zone_members: []) + @zone.zone_members.create(zoneable: country) end let(:included_in_price) { false } let!(:rate) do - Spree::TaxRate.create(:amount => 1, - :zone => @zone, - :tax_category => tax_category, - :calculator => calculator, - :included_in_price => included_in_price) + Spree::TaxRate.create(amount: 1, + zone: @zone, + tax_category: tax_category, + calculator: calculator, + included_in_price: included_in_price) end subject { Spree::TaxRate.match(order.tax_zone) } context "when the order has the same tax zone" do before do - allow(order).to receive_messages :tax_zone => @zone + allow(order).to receive_messages tax_zone: @zone end context "when the tax is not a VAT" do @@ -112,7 +112,7 @@ context "when the order has a different tax zone" do before do - allow(order).to receive_messages :tax_zone => create(:zone, :name => "Other Zone") + allow(order).to receive_messages tax_zone: create(:zone, name: "Other Zone") end context "when the tax is a VAT" do @@ -139,23 +139,23 @@ let(:order) { stub_model(Spree::Order) } let(:tax_category_1) { stub_model(Spree::TaxCategory) } let(:tax_category_2) { stub_model(Spree::TaxCategory) } - let(:rate_1) { stub_model(Spree::TaxRate, :tax_category => tax_category_1) } - let(:rate_2) { stub_model(Spree::TaxRate, :tax_category => tax_category_2) } + let(:rate_1) { stub_model(Spree::TaxRate, tax_category: tax_category_1) } + let(:rate_2) { stub_model(Spree::TaxRate, tax_category: tax_category_2) } context "with line items" do let(:line_item) do stub_model(Spree::LineItem, - :price => 10.0, - :quantity => 1, - :tax_category => tax_category_1, - :variant => stub_model(Spree::Variant) + price: 10.0, + quantity: 1, + tax_category: tax_category_1, + variant: stub_model(Spree::Variant) ) end let(:line_items) { [line_item] } before do - allow(Spree::TaxRate).to receive_messages :match => [rate_1, rate_2] + allow(Spree::TaxRate).to receive_messages match: [rate_1, rate_2] end it "should apply adjustments for two tax rates to the order" do @@ -185,10 +185,10 @@ end context "with shipments" do - let(:shipments) { [stub_model(Spree::Shipment, :cost => 10.0, :tax_category => tax_category_1)] } + let(:shipments) { [stub_model(Spree::Shipment, cost: 10.0, tax_category: tax_category_1)] } before do - allow(Spree::TaxRate).to receive_messages :match => [rate_1, rate_2] + allow(Spree::TaxRate).to receive_messages match: [rate_1, rate_2] end it "should apply adjustments for two tax rates to the order" do @@ -380,25 +380,25 @@ describe "#adjust" do before do @country = create(:country) - @zone = create(:zone, :name => "Country Zone", :default_tax => true, :zone_members => []) - @zone.zone_members.create(:zoneable => @country) - @category = Spree::TaxCategory.create :name => "Taxable Foo" - @category2 = Spree::TaxCategory.create(:name => "Non Taxable") + @zone = create(:zone, name: "Country Zone", default_tax: true, zone_members: []) + @zone.zone_members.create(zoneable: @country) + @category = Spree::TaxCategory.create name: "Taxable Foo" + @category2 = Spree::TaxCategory.create(name: "Non Taxable") @rate1 = Spree::TaxRate.create( - :amount => 0.10, - :calculator => Spree::Calculator::DefaultTax.create, - :tax_category => @category, - :zone => @zone + amount: 0.10, + calculator: Spree::Calculator::DefaultTax.create, + tax_category: @category, + zone: @zone ) @rate2 = Spree::TaxRate.create( - :amount => 0.05, - :calculator => Spree::Calculator::DefaultTax.create, - :tax_category => @category, - :zone => @zone + amount: 0.05, + calculator: Spree::Calculator::DefaultTax.create, + tax_category: @category, + zone: @zone ) @order = Spree::Order.create! - @taxable = create(:product, :tax_category => @category) - @nontaxable = create(:product, :tax_category => @category2) + @taxable = create(:product, tax_category: @category) + @nontaxable = create(:product, tax_category: @category2) end context "not taxable line item " do @@ -462,10 +462,10 @@ context "when order's zone does not match default zone, is not included in the default zone, AND does not match the rate's zone" do before do - @new_zone = create(:zone, :name => "New Zone", :default_tax => false) - @new_country = create(:country, :name => "New Country") - @new_zone.zone_members.create(:zoneable => @new_country) - @order.ship_address = create(:address, :country => @new_country) + @new_zone = create(:zone, name: "New Zone", default_tax: false) + @new_country = create(:country, name: "New Country") + @new_zone.zone_members.create(zoneable: @new_country) + @order.ship_address = create(:address, country: @new_country) @order.save @order.reload end @@ -483,7 +483,7 @@ context "when price does not include tax" do before do - allow(@order).to receive_messages :tax_zone => @zone + allow(@order).to receive_messages tax_zone: @zone [@rate1, @rate2].each do |rate| rate.included_in_price = false rate.zone = @zone @@ -524,7 +524,7 @@ end describe 'when the tax zone is removed' do - before { allow(@order).to receive_messages :tax_zone => nil } + before { allow(@order).to receive_messages tax_zone: nil } it 'does not apply any adjustments' do Spree::TaxRate.adjust(@order, @order.line_items) diff --git a/core/spec/models/spree/taxon_spec.rb b/core/spec/models/spree/taxon_spec.rb index 4a63124c131..b2ee0b89e7d 100644 --- a/core/spec/models/spree/taxon_spec.rb +++ b/core/spec/models/spree/taxon_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' -describe Spree::Taxon, :type => :model do - let(:taxon) { FactoryGirl.build(:taxon, :name => "Ruby on Rails") } +describe Spree::Taxon, type: :model do + let(:taxon) { FactoryGirl.build(:taxon, name: "Ruby on Rails") } describe '#to_param' do subject { super().to_param } @@ -35,7 +35,7 @@ end context "with parent taxon" do - let(:parent) { FactoryGirl.build(:taxon, :permalink => "brands") } + let(:parent) { FactoryGirl.build(:taxon, permalink: "brands") } before { allow(taxon).to receive_messages parent: parent } it "should set permalink correctly when taxon has parent" do @@ -79,7 +79,7 @@ let(:taxonomy) { create(:taxonomy) } it "does not error out" do - expect { taxonomy.root.children.unscoped.where(:name => "Some name").first_or_create }.not_to raise_error + expect { taxonomy.root.children.unscoped.where(name: "Some name").first_or_create }.not_to raise_error end end end diff --git a/core/spec/models/spree/taxonomy_spec.rb b/core/spec/models/spree/taxonomy_spec.rb index 1aae5a0d871..1e2d691fc0c 100644 --- a/core/spec/models/spree/taxonomy_spec.rb +++ b/core/spec/models/spree/taxonomy_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe Spree::Taxonomy, :type => :model do +describe Spree::Taxonomy, type: :model do context "#destroy" do before do @taxonomy = create(:taxonomy) @root_taxon = @taxonomy.root - @child_taxon = create(:taxon, :taxonomy_id => @taxonomy.id, :parent => @root_taxon) + @child_taxon = create(:taxon, taxonomy_id: @taxonomy.id, parent: @root_taxon) end it "should destroy all associated taxons" do diff --git a/core/spec/models/spree/tracker_spec.rb b/core/spec/models/spree/tracker_spec.rb index 879fe857f78..0ecadaab2b5 100644 --- a/core/spec/models/spree/tracker_spec.rb +++ b/core/spec/models/spree/tracker_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Tracker, :type => :model do +describe Spree::Tracker, type: :model do describe "current" do before(:each) { @tracker = create(:tracker) } diff --git a/core/spec/models/spree/variant_spec.rb b/core/spec/models/spree/variant_spec.rb index c61c119c861..0752ff6fb76 100644 --- a/core/spec/models/spree/variant_spec.rb +++ b/core/spec/models/spree/variant_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Spree::Variant, :type => :model do +describe Spree::Variant, type: :model do let!(:variant) { create(:variant) } let(:master_variant) { create(:master_variant) } @@ -44,7 +44,7 @@ it "propagate to stock items" do expect_any_instance_of(Spree::StockLocation).not_to receive(:propagate_variant) - product.variants.create(:name => "Foobar") + product.variants.create(name: "Foobar") end end @@ -173,7 +173,7 @@ context "product has other variants" do describe "option value accessors" do before { - @multi_variant = FactoryGirl.create :variant, :product => variant.product + @multi_variant = FactoryGirl.create :variant, product: variant.product variant.product.reload } @@ -205,7 +205,7 @@ context "product has other variants" do describe "option value accessors" do before { - @multi_variant = create(:variant, :product => variant.product) + @multi_variant = create(:variant, product: variant.product) variant.product.reload } @@ -282,7 +282,7 @@ describe '.price_in' do before do - variant.prices << create(:price, :variant => variant, :currency => "EUR", :amount => 33.33) + variant.prices << create(:price, variant: variant, currency: "EUR", amount: 33.33) end subject { variant.price_in(currency).display_amount } @@ -313,7 +313,7 @@ describe '.amount_in' do before do - variant.prices << create(:price, :variant => variant, :currency => "EUR", :amount => 33.33) + variant.prices << create(:price, variant: variant, currency: "EUR", amount: 33.33) end subject { variant.amount_in(currency) } diff --git a/core/spec/models/spree/zone_spec.rb b/core/spec/models/spree/zone_spec.rb index 9e3f6ad6d43..db77ec323d8 100644 --- a/core/spec/models/spree/zone_spec.rb +++ b/core/spec/models/spree/zone_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Spree::Zone, :type => :model do +describe Spree::Zone, type: :model do context "#match" do let(:country_zone) { create(:zone, kind: 'country') } diff --git a/frontend/app/controllers/spree/content_controller.rb b/frontend/app/controllers/spree/content_controller.rb index 4552edac8d1..75dbf7ab7c6 100644 --- a/frontend/app/controllers/spree/content_controller.rb +++ b/frontend/app/controllers/spree/content_controller.rb @@ -4,16 +4,16 @@ class ContentController < Spree::StoreController before_action { render_404 if params[:path] =~ /(\.|\\)/ } after_action :fire_visited_path, only: :show - rescue_from ActionView::MissingTemplate, :with => :render_404 + rescue_from ActionView::MissingTemplate, with: :render_404 respond_to :html def show - render :action => params[:path] + render action: params[:path] end def cvv - render :layout => false + render layout: false end def fire_visited_path diff --git a/frontend/app/controllers/spree/orders_controller.rb b/frontend/app/controllers/spree/orders_controller.rb index edeeb73987a..7e6c43f7886 100644 --- a/frontend/app/controllers/spree/orders_controller.rb +++ b/frontend/app/controllers/spree/orders_controller.rb @@ -1,7 +1,7 @@ module Spree class OrdersController < Spree::StoreController before_action :check_authorization - rescue_from ActiveRecord::RecordNotFound, :with => :render_404 + rescue_from ActiveRecord::RecordNotFound, with: :render_404 helper 'spree/products', 'spree/orders' respond_to :html @@ -76,7 +76,7 @@ def empty def accurate_title if @order && @order.completed? - Spree.t(:order_number, :number => @order.number) + Spree.t(:order_number, number: @order.number) else Spree.t(:shopping_cart) end diff --git a/frontend/app/controllers/spree/products_controller.rb b/frontend/app/controllers/spree/products_controller.rb index 80598a0c3a1..e09b945ec34 100644 --- a/frontend/app/controllers/spree/products_controller.rb +++ b/frontend/app/controllers/spree/products_controller.rb @@ -3,7 +3,7 @@ class ProductsController < Spree::StoreController before_action :load_product, only: :show before_action :load_taxon, only: :index - rescue_from ActiveRecord::RecordNotFound, :with => :render_404 + rescue_from ActiveRecord::RecordNotFound, with: :render_404 helper 'spree/taxons' respond_to :html diff --git a/frontend/app/helpers/spree/frontend_helper.rb b/frontend/app/helpers/spree/frontend_helper.rb index aae2401347d..dfe1098f5a7 100644 --- a/frontend/app/helpers/spree/frontend_helper.rb +++ b/frontend/app/helpers/spree/frontend_helper.rb @@ -73,7 +73,7 @@ def link_to_cart(text = nil) css_class = 'full' end - link_to text.html_safe, spree.cart_path, :class => "cart-info #{css_class}" + link_to text.html_safe, spree.cart_path, class: "cart-info #{css_class}" end # helper to determine if its appropriate to show the store menu diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb index 32223344909..42125d65b99 100755 --- a/frontend/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_first_page.html.erb @@ -8,6 +8,6 @@ -%> <% unless current_page.first? %>
      • - <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %> + <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, remote: remote %>
      • <% end %> diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb index 1a689eceff9..4a5c43421f8 100755 --- a/frontend/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_last_page.html.erb @@ -8,6 +8,6 @@ -%> <% unless current_page.last? %> <% end %> diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb index 257f4056afd..be785d3725a 100755 --- a/frontend/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_next_page.html.erb @@ -8,6 +8,6 @@ -%> <% unless current_page.last? %>
      • - <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %> + <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, rel: 'next', remote: remote %>
      • <% end %> diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_page.html.erb index 6de202a5fb0..de555d108d3 100755 --- a/frontend/app/views/kaminari/twitter-bootstrap-3/_page.html.erb +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_page.html.erb @@ -8,5 +8,5 @@ remote: data-remote -%>
      • - <%= link_to page, url, opts = {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %> + <%= link_to page, url, opts = {remote: remote, rel: page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
      • diff --git a/frontend/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb b/frontend/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb index ee018569b66..d57e271ad33 100755 --- a/frontend/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb +++ b/frontend/app/views/kaminari/twitter-bootstrap-3/_prev_page.html.erb @@ -8,6 +8,6 @@ -%> <% unless current_page.first? %> <% end %> diff --git a/frontend/app/views/spree/address/_form.html.erb b/frontend/app/views/spree/address/_form.html.erb index 87732b7d62d..677b7e306a7 100644 --- a/frontend/app/views/spree/address/_form.html.erb +++ b/frontend/app/views/spree/address/_form.html.erb @@ -5,42 +5,42 @@ <%= form.label :firstname do %> <%= Spree.t(:first_name) %>* <% end %> - <%= form.text_field :firstname, :class => 'form-control required' %> + <%= form.text_field :firstname, class: 'form-control required' %>

        > <%= form.label :lastname do %> <%= Spree.t(:last_name) %>* <% end %> - <%= form.text_field :lastname, :class => 'form-control required' %> + <%= form.text_field :lastname, class: 'form-control required' %>

        <% if Spree::Config[:company] %>

        > <%= form.label :company, Spree.t(:company) %> - <%= form.text_field :company, :class => 'form-control' %> + <%= form.text_field :company, class: 'form-control' %>

        <% end %>

        > <%= form.label :address1 do %> <%= Spree.t(:street_address) %>* <% end %> - <%= form.text_field :address1, :class => 'form-control required' %> + <%= form.text_field :address1, class: 'form-control required' %>

        > <%= form.label :address2, Spree.t(:street_address_2) %> - <%= form.text_field :address2, :class => 'form-control' %> + <%= form.text_field :address2, class: 'form-control' %>

        > <%= form.label :city do %> <%= Spree.t(:city) %>* <% end %> - <%= form.text_field :city, :class => 'form-control required' %> + <%= form.text_field :city, class: 'form-control required' %>

        > <%= form.label :country_id do %> <%= Spree.t(:country) %>* <% end %> > - <%= form.collection_select :country_id, available_countries, :id, :name, {}, {:class => 'form-control required'} %> + <%= form.collection_select :country_id, available_countries, :id, :name, {}, {class: 'form-control required'} %>

        @@ -54,17 +54,17 @@ <%== state_elements = [ form.collection_select(:state_id, address.country.states, :id, :name, - {:include_blank => true}, - {:class => have_states ? 'form-control required' : 'form-control hidden', - :disabled => !have_states}) + + {include_blank: true}, + {class: have_states ? 'form-control required' : 'form-control hidden', + disabled: !have_states}) + form.text_field(:state_name, - :class => !have_states ? 'form-control required' : 'form-control hidden', - :disabled => have_states) + class: !have_states ? 'form-control required' : 'form-control hidden', + disabled: have_states) ].join.gsub('"', "'").gsub("\n", "") %>

        <% end %> @@ -72,18 +72,18 @@ <%= form.label :zipcode do %> <%= Spree.t(:zip) %><% if address.require_zipcode? %>*<% end %> <% end %> - <%= form.text_field :zipcode, :class => "form-control #{'required' if address.require_zipcode?}" %> + <%= form.text_field :zipcode, class: "form-control #{'required' if address.require_zipcode?}" %>

        > <%= form.label :phone do %> <%= Spree.t(:phone) %><% if address.require_phone? %>*<% end %> <% end %> - <%= form.phone_field :phone, :class => "form-control #{'required' if address.require_phone?}" %> + <%= form.phone_field :phone, class: "form-control #{'required' if address.require_phone?}" %>

        <% if Spree::Config[:alternative_shipping_phone] %>

        > <%= form.label :alternative_phone, Spree.t(:alternative_phone) %> - <%= form.phone_field :alternative_phone, :class => 'form-control' %> + <%= form.phone_field :alternative_phone, class: 'form-control' %>

        <% end %> diff --git a/frontend/app/views/spree/checkout/_address.html.erb b/frontend/app/views/spree/checkout/_address.html.erb index 231ac7a8c63..866b07215ef 100644 --- a/frontend/app/views/spree/checkout/_address.html.erb +++ b/frontend/app/views/spree/checkout/_address.html.erb @@ -6,7 +6,7 @@

        <%= Spree.t(:billing_address) %>

        - <%= render :partial => 'spree/address/form', :locals => { :form => bill_form, :address_type => 'billing', :address => @order.bill_address } %> + <%= render partial: 'spree/address/form', locals: { form: bill_form, address_type: 'billing', address: @order.bill_address } %>
        <% end %> @@ -20,12 +20,12 @@

        - <%= label_tag :order_use_billing, :id => 'use_billing' do %> + <%= label_tag :order_use_billing, id: 'use_billing' do %> <%= check_box_tag 'order[use_billing]', '1', @order.shipping_eq_billing_address? %> <%= Spree.t(:use_billing_address) %> <% end %>

        - <%= render :partial => 'spree/address/form', :locals => { :form => ship_form, :address_type => 'shipping', :address => @order.ship_address } %> + <%= render partial: 'spree/address/form', locals: { form: ship_form, address_type: 'shipping', address: @order.ship_address } %>
        <% end %> @@ -33,7 +33,7 @@
        - <%= submit_tag Spree.t(:save_and_continue), :class => 'btn btn-lg btn-success' %> + <%= submit_tag Spree.t(:save_and_continue), class: 'btn btn-lg btn-success' %> <% if try_spree_current_user %>     diff --git a/frontend/app/views/spree/checkout/_confirm.html.erb b/frontend/app/views/spree/checkout/_confirm.html.erb index 4df54297a4e..a94ad55722d 100755 --- a/frontend/app/views/spree/checkout/_confirm.html.erb +++ b/frontend/app/views/spree/checkout/_confirm.html.erb @@ -3,11 +3,11 @@

        <%= Spree.t(:confirm) %>

        - <%= render :partial => 'spree/shared/order_details', :locals => { :order => @order } %> + <%= render partial: 'spree/shared/order_details', locals: { order: @order } %>
        - <%= submit_tag Spree.t(:place_order), :class => 'btn btn-lg btn-success' %> + <%= submit_tag Spree.t(:place_order), class: 'btn btn-lg btn-success' %>
        diff --git a/frontend/app/views/spree/checkout/_delivery.html.erb b/frontend/app/views/spree/checkout/_delivery.html.erb index 39bea68e2e7..8171b80b5be 100644 --- a/frontend/app/views/spree/checkout/_delivery.html.erb +++ b/frontend/app/views/spree/checkout/_delivery.html.erb @@ -88,7 +88,7 @@ <% if Spree::Config[:shipping_instructions] %>

        <%= Spree.t(:shipping_instructions) %>

        - <%= form.text_area :special_instructions, :cols => 40, :rows => 4, :class => "form-control" %> + <%= form.text_area :special_instructions, cols: 40, rows: 4, class: "form-control" %>

        <% end %> @@ -97,5 +97,5 @@
        - <%= submit_tag Spree.t(:save_and_continue), :class => 'btn btn-lg btn-success' %> + <%= submit_tag Spree.t(:save_and_continue), class: 'btn btn-lg btn-success' %>
        diff --git a/frontend/app/views/spree/checkout/_payment.html.erb b/frontend/app/views/spree/checkout/_payment.html.erb index c26783ba056..abb90af15c2 100644 --- a/frontend/app/views/spree/checkout/_payment.html.erb +++ b/frontend/app/views/spree/checkout/_payment.html.erb @@ -42,7 +42,7 @@
      • <% end %> @@ -52,7 +52,7 @@ <% @order.available_payment_methods.each do |method| %>
      • - <%= render :partial => "spree/checkout/payment/#{method.method_type}", :locals => { :payment_method => method } %> + <%= render partial: "spree/checkout/payment/#{method.method_type}", locals: { payment_method: method } %>
      • <% end %> @@ -60,7 +60,7 @@

        <%= form.label :coupon_code %> - <%= form.text_field :coupon_code, :class => 'form-control' %> + <%= form.text_field :coupon_code, class: 'form-control' %>

        diff --git a/frontend/app/views/spree/checkout/payment/_gateway.html.erb b/frontend/app/views/spree/checkout/payment/_gateway.html.erb index abef2cf4a8f..34f5f9b46e4 100644 --- a/frontend/app/views/spree/checkout/payment/_gateway.html.erb +++ b/frontend/app/views/spree/checkout/payment/_gateway.html.erb @@ -1,20 +1,20 @@
        - <%= image_tag 'credit_cards/credit_card.gif', :id => 'credit-card-image', :class => 'pull-right', :width => '170', :height => '28' %> + <%= image_tag 'credit_cards/credit_card.gif', id: 'credit-card-image', class: 'pull-right', width: '170', height: '28' %> <% param_prefix = "payment_source[#{payment_method.id}]" %>

        <%= label_tag "name_on_card_#{payment_method.id}" do %> <%= Spree.t(:name_on_card) %>* <% end %> - <%= text_field_tag "#{param_prefix}[name]", "#{@order.bill_address_firstname} #{@order.bill_address_lastname}", { id: "name_on_card_#{payment_method.id}", :class => 'form-control required'} %> + <%= text_field_tag "#{param_prefix}[name]", "#{@order.bill_address_firstname} #{@order.bill_address_lastname}", { id: "name_on_card_#{payment_method.id}", class: 'form-control required'} %>

        <%= label_tag "card_number" do %> <%= Spree.t(:card_number) %>* <% end %> - <% options_hash = Rails.env.production? ? {:autocomplete => 'off'} : {} %> - <%= text_field_tag "#{param_prefix}[number]", '', options_hash.merge(:id => 'card_number', :class => 'form-control required cardNumber', :size => 19, :maxlength => 19, :autocomplete => "off") %> + <% options_hash = Rails.env.production? ? {autocomplete: 'off'} : {} %> + <%= text_field_tag "#{param_prefix}[number]", '', options_hash.merge(id: 'card_number', class: 'form-control required cardNumber', size: 19, maxlength: 19, autocomplete: "off") %>  

        <%= label_tag "card_code" do %> <%= Spree.t(:card_code) %>* <% end %> - <%= text_field_tag "#{param_prefix}[verification_value]", '', options_hash.merge(:id => 'card_code', :class => 'form-control required cardCode', :size => 5) %> - <%= link_to "(#{Spree.t(:what_is_this)})", spree.content_path('cvv'), :target => '_blank', "data-hook" => "cvv_link", :id => "cvv_link" %> + <%= text_field_tag "#{param_prefix}[verification_value]", '', options_hash.merge(id: 'card_code', class: 'form-control required cardCode', size: 5) %> + <%= link_to "(#{Spree.t(:what_is_this)})", spree.content_path('cvv'), target: '_blank', "data-hook" => "cvv_link", id: "cvv_link" %>
        - <%= hidden_field_tag "#{param_prefix}[cc_type]", '', :id => "cc_type", :class => 'ccType' %> + <%= hidden_field_tag "#{param_prefix}[cc_type]", '', id: "cc_type", class: 'ccType' %> diff --git a/frontend/app/views/spree/home/index.html.erb b/frontend/app/views/spree/home/index.html.erb index a79dcd918ab..7e3efbb9204 100644 --- a/frontend/app/views/spree/home/index.html.erb +++ b/frontend/app/views/spree/home/index.html.erb @@ -1,12 +1,12 @@ <% content_for :sidebar do %>
        - <%= render :partial => 'spree/shared/taxonomies' %> + <%= render partial: 'spree/shared/taxonomies' %>
        <% end %>
        <% cache(cache_key_for_products) do %> - <%= render :partial => 'spree/shared/products', :locals => { :products => @products } %> + <%= render partial: 'spree/shared/products', locals: { products: @products } %> <% end %>
        diff --git a/frontend/app/views/spree/orders/_adjustment_row.html.erb b/frontend/app/views/spree/orders/_adjustment_row.html.erb index 3306bc6f96b..49863727ba5 100644 --- a/frontend/app/views/spree/orders/_adjustment_row.html.erb +++ b/frontend/app/views/spree/orders/_adjustment_row.html.erb @@ -2,7 +2,7 @@ <% end %> diff --git a/frontend/app/views/spree/orders/_adjustments.html.erb b/frontend/app/views/spree/orders/_adjustments.html.erb index 38c351028ba..28930fb0c8a 100644 --- a/frontend/app/views/spree/orders/_adjustments.html.erb +++ b/frontend/app/views/spree/orders/_adjustments.html.erb @@ -6,12 +6,12 @@ <% if @order.line_item_adjustments.exists? %> <% @order.line_item_adjustments.promotion.eligible.group_by(&:label).each do |label, adjustments| %> - <%= render "spree/orders/adjustment_row", :label => label, :adjustments => adjustments, :type => Spree.t(:promotion) %> + <%= render "spree/orders/adjustment_row", label: label, adjustments: adjustments, type: Spree.t(:promotion) %> <% end %> <% end %> <% @order.all_adjustments.tax.eligible.group_by(&:label).each do |label, adjustments| %> - <%= render "spree/orders/adjustment_row", :label => label, :adjustments => adjustments, :type => Spree.t(:tax) %> + <%= render "spree/orders/adjustment_row", label: label, adjustments: adjustments, type: Spree.t(:tax) %> <% end %> <% @order.shipments.each do |shipment| %> @@ -24,6 +24,6 @@ <% end %> <% @order.adjustments.eligible.group_by(&:label).each do |label, adjustments| %> - <%= render "spree/orders/adjustment_row", :label => label, :adjustments => adjustments, :type => Spree.t(:adjustment) %> + <%= render "spree/orders/adjustment_row", label: label, adjustments: adjustments, type: Spree.t(:adjustment) %> <% end %> diff --git a/frontend/app/views/spree/products/_properties.html.erb b/frontend/app/views/spree/products/_properties.html.erb index d8584b9f447..bd0048f637c 100644 --- a/frontend/app/views/spree/products/_properties.html.erb +++ b/frontend/app/views/spree/products/_properties.html.erb @@ -3,7 +3,7 @@
        <%= sort_link @search,:name, Spree.t(:name), :title => 'zones_order_by_name_title' %><%= sort_link @search,:name, Spree.t(:name), title: 'zones_order_by_name_title' %> - <%= sort_link @search,:description, Spree.t(:description), {}, {:title => 'zones_order_by_description_title'} %> + <%= sort_link @search,:description, Spree.t(:description), {}, {title: 'zones_order_by_description_title'} %> <%= Spree.t(:default_tax_zone) %> <%= zone.description %> <%= zone.default_tax? ? Spree.t(:say_yes) : Spree.t(:say_no) %> - <%= link_to_edit(zone, :no_text => true) if can? :edit, zone %> - <%= link_to_delete(zone, :no_text => true) if can? :delete, zone %> + <%= link_to_edit(zone, no_text: true) if can? :edit, zone %> + <%= link_to_delete(zone, no_text: true) if can? :delete, zone %>
        <%= type %>: <%= label %>
        -
        <%= Spree::Money.new(adjustments.sum(&:amount), :currency => @order.currency) %>
        +
        <%= Spree::Money.new(adjustments.sum(&:amount), currency: @order.currency) %>
        <% @product_properties.each do |product_property| %> - <% css_class = cycle('even', 'odd', :name => "properties") %> + <% css_class = cycle('even', 'odd', name: "properties") %> diff --git a/frontend/app/views/spree/products/index.html.erb b/frontend/app/views/spree/products/index.html.erb index 1df9f7cc721..285c8c96f7e 100644 --- a/frontend/app/views/spree/products/index.html.erb +++ b/frontend/app/views/spree/products/index.html.erb @@ -2,9 +2,9 @@ <% content_for :sidebar do %>
        <% if "spree/products" == params[:controller] && @taxon %> - <%= render :partial => 'spree/shared/filters' %> + <%= render partial: 'spree/shared/filters' %> <% else %> - <%= render :partial => 'spree/shared/taxonomies' %> + <%= render partial: 'spree/shared/taxonomies' %> <% end %>
        <% end %> @@ -15,13 +15,13 @@ <% if @products.empty? %>
        <%= Spree.t(:no_products_found) %>
        <% else %> - <%= render :partial => 'spree/shared/products', :locals => { :products => @products, :taxon => @taxon } %> + <%= render partial: 'spree/shared/products', locals: { products: @products, taxon: @taxon } %> <% end %> <% else %>
        <% cache(cache_key_for_products) do %> - <%= render :partial => 'spree/shared/products', :locals => { :products => @products, :taxon => @taxon } %> + <%= render partial: 'spree/shared/products', locals: { products: @products, taxon: @taxon } %> <% end %>
        <% end %> diff --git a/frontend/app/views/spree/products/show.html.erb b/frontend/app/views/spree/products/show.html.erb index 4e00ae4e7b9..e3b8e11b828 100644 --- a/frontend/app/views/spree/products/show.html.erb +++ b/frontend/app/views/spree/products/show.html.erb @@ -7,20 +7,20 @@
        - <%= product_image(@product, :itemprop => "image") %> + <%= product_image(@product, itemprop: "image") %>
        - <%= render :partial => 'thumbnails' %> + <%= render partial: 'thumbnails' %>
        - <%= render :partial => 'properties' %> + <%= render partial: 'properties' %>
        - <%= render :partial => 'promotions' %> + <%= render partial: 'promotions' %>
        @@ -35,12 +35,12 @@
        - <%= render :partial => 'cart_form' %> + <%= render partial: 'cart_form' %>
        - <%= render :partial => 'taxons' %> + <%= render partial: 'taxons' %>
        diff --git a/frontend/app/views/spree/shared/_error_messages.html.erb b/frontend/app/views/spree/shared/_error_messages.html.erb index d35f74faddb..ed8f296e5c6 100644 --- a/frontend/app/views/spree/shared/_error_messages.html.erb +++ b/frontend/app/views/spree/shared/_error_messages.html.erb @@ -1,6 +1,6 @@ <% if target && target.errors.any? %>
        -

        <%= Spree.t(:errors_prohibited_this_record_from_being_saved, :count => target.errors.count) %>:

        +

        <%= Spree.t(:errors_prohibited_this_record_from_being_saved, count: target.errors.count) %>:

        <%= Spree.t(:there_were_problems_with_the_following_fields) %>:

          <% target.errors.full_messages.each do |msg| %> diff --git a/frontend/app/views/spree/shared/_filters.html.erb b/frontend/app/views/spree/shared/_filters.html.erb index d4013ccdfb5..fc1661bfd31 100644 --- a/frontend/app/views/spree/shared/_filters.html.erb +++ b/frontend/app/views/spree/shared/_filters.html.erb @@ -1,7 +1,7 @@ <% filters = @taxon ? @taxon.applicable_filters : [Spree::Core::ProductFilters.all_taxons] %> <% unless filters.empty? %> - <%= form_tag '', :method => :get, :id => 'sidebar_products_search' do %> + <%= form_tag '', method: :get, id: 'sidebar_products_search' do %> <%= hidden_field_tag 'per_page', params[:per_page] %> <% filters.each do |filter| %> <% labels = filter[:labels] || filter[:conds].map {|m,c| [m,m]} %> @@ -23,6 +23,6 @@
        <% end %> - <%= submit_tag Spree.t(:search), :name => nil, :class => 'btn btn-primary' %> + <%= submit_tag Spree.t(:search), name: nil, class: 'btn btn-primary' %> <% end %> <% end %> diff --git a/frontend/app/views/spree/shared/_header.html.erb b/frontend/app/views/spree/shared/_header.html.erb index 38039de96e7..51c162a19a8 100644 --- a/frontend/app/views/spree/shared/_header.html.erb +++ b/frontend/app/views/spree/shared/_header.html.erb @@ -5,11 +5,11 @@ - <%= render :partial => 'spree/shared/nav_bar' %> + <%= render partial: 'spree/shared/nav_bar' %>
        - <%= render :partial => 'spree/shared/main_nav_bar' if store_menu? %> + <%= render partial: 'spree/shared/main_nav_bar' if store_menu? %>
        diff --git a/frontend/app/views/spree/shared/_login.html.erb b/frontend/app/views/spree/shared/_login.html.erb index 343f351294d..17189445ce6 100755 --- a/frontend/app/views/spree/shared/_login.html.erb +++ b/frontend/app/views/spree/shared/_login.html.erb @@ -1,10 +1,10 @@ -<%= form_for Spree::User.new, :as => :spree_user, :url => spree.create_new_session_path do |f| %> +<%= form_for Spree::User.new, as: :spree_user, url: spree.create_new_session_path do |f| %>
        - <%= f.email_field :email, :class => 'form-control', :tabindex => 1, :placeholder => Spree.t(:email) %> + <%= f.email_field :email, class: 'form-control', tabindex: 1, placeholder: Spree.t(:email) %>
        - <%= f.password_field :password, :class => 'form-control', :tabindex => 2, :placeholder => Spree.t(:password) %> + <%= f.password_field :password, class: 'form-control', tabindex: 2, placeholder: Spree.t(:password) %>
        - <%= f.submit Spree.t(:login), :class => 'btn btn-lg btn-success btn-block', :tabindex => 3 %> + <%= f.submit Spree.t(:login), class: 'btn btn-lg btn-success btn-block', tabindex: 3 %>
        <% end %> \ No newline at end of file diff --git a/frontend/app/views/spree/shared/_nav_bar.html.erb b/frontend/app/views/spree/shared/_nav_bar.html.erb index e398a411d9b..4c863c82d44 100644 --- a/frontend/app/views/spree/shared/_nav_bar.html.erb +++ b/frontend/app/views/spree/shared/_nav_bar.html.erb @@ -1,7 +1,7 @@ diff --git a/frontend/app/views/spree/shared/_search.html.erb b/frontend/app/views/spree/shared/_search.html.erb index 69d1969d8f4..541241ad88e 100644 --- a/frontend/app/views/spree/shared/_search.html.erb +++ b/frontend/app/views/spree/shared/_search.html.erb @@ -1,6 +1,6 @@ <% @taxons = @taxon && @taxon.parent ? @taxon.parent.children : Spree::Taxon.roots %> -<%= form_tag spree.products_path, :method => :get, class: "navbar-form" do %> +<%= form_tag spree.products_path, method: :get, class: "navbar-form" do %>
        <% cache(cache_key_for_taxons) do %> <%= select_tag :taxon, @@ -10,7 +10,7 @@ <% end %>
        - <%= search_field_tag :keywords, params[:keywords], :placeholder => Spree.t(:search), class: "form-control" %> + <%= search_field_tag :keywords, params[:keywords], placeholder: Spree.t(:search), class: "form-control" %>
        - <%= submit_tag Spree.t(:search), :name => nil, class: "btn btn-success" %> + <%= submit_tag Spree.t(:search), name: nil, class: "btn btn-success" %> <% end %> diff --git a/frontend/app/views/spree/shared/_taxonomies.html.erb b/frontend/app/views/spree/shared/_taxonomies.html.erb index c4bbc5ec00e..a527230e4e0 100644 --- a/frontend/app/views/spree/shared/_taxonomies.html.erb +++ b/frontend/app/views/spree/shared/_taxonomies.html.erb @@ -3,7 +3,7 @@
        <%= product_property.property.presentation %> <%= product_property.value %>