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 -%>
<%= 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 %> | <% 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| %> <% 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 @@
- <%= Spree.t(:current_promotion_usage, :count => @promotion.credits_count) %> + <%= Spree.t(:current_promotion_usage, count: @promotion.credits_count) %>
<% end %><%= 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 @@