mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-12 23:27:48 +00:00
Fix cops StringConcatenation
This commit is contained in:
@@ -37,7 +37,7 @@ module Admin
|
||||
|
||||
def obfuscated_secret_key
|
||||
key = Stripe.api_key
|
||||
key.first(8) + "****" + key.last(4)
|
||||
"#{key.first(8)}****#{key.last(4)}"
|
||||
end
|
||||
|
||||
def settings_params
|
||||
|
||||
@@ -31,7 +31,7 @@ module EnterprisesHelper
|
||||
|
||||
def enterprises_options(enterprises)
|
||||
enterprises.map { |enterprise|
|
||||
[enterprise.name + ": " + enterprise.address.address1 + ", " + enterprise.address.city,
|
||||
["#{enterprise.name}: #{enterprise.address.address1}, #{enterprise.address.city}",
|
||||
enterprise.id.to_i]
|
||||
}
|
||||
end
|
||||
|
||||
@@ -108,7 +108,7 @@ module Spree
|
||||
|
||||
object.preferences.keys.map { |key|
|
||||
preference_label = form.label("preferred_#{key}",
|
||||
Spree.t(key.to_s.gsub("_from_list", "")) + ": ")
|
||||
"#{Spree.t(key.to_s.gsub('_from_list', ''))}: ")
|
||||
preference_field = preference_field_for(
|
||||
form,
|
||||
"preferred_#{key}",
|
||||
@@ -120,7 +120,7 @@ module Spree
|
||||
|
||||
def link_to_add_fields(name, target, options = {})
|
||||
name = '' if options[:no_text]
|
||||
css_classes = options[:class] ? options[:class] + " spree_add_fields" : "spree_add_fields"
|
||||
css_classes = options[:class] ? "#{options[:class]} spree_add_fields" : "spree_add_fields"
|
||||
link_to_with_icon('icon-plus',
|
||||
name,
|
||||
'javascript:',
|
||||
|
||||
@@ -25,7 +25,7 @@ module Spree
|
||||
@user = user
|
||||
I18n.with_locale valid_locale(@user) do
|
||||
mail(to: user.email,
|
||||
subject: t(:welcome_to) + ' ' + Spree::Config[:site_name])
|
||||
subject: "#{t(:welcome_to)} #{Spree::Config[:site_name]}")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ class Enterprise < ApplicationRecord
|
||||
def category
|
||||
# Make this crazy logic human readable so we can argue about it sanely.
|
||||
cat = is_primary_producer ? "producer_" : "non_producer_"
|
||||
cat << ("sells_" + sells)
|
||||
cat << ("sells_#{sells}")
|
||||
|
||||
# Map backend cases to front end cases.
|
||||
case cat
|
||||
@@ -510,7 +510,7 @@ class Enterprise < ApplicationRecord
|
||||
end
|
||||
|
||||
def correct_whatsapp_url(phone_number)
|
||||
phone_number && ("https://wa.me/" + phone_number.tr('+ ', ''))
|
||||
phone_number && "https://wa.me/#{phone_number.tr('+ ', '')}"
|
||||
end
|
||||
|
||||
def correct_instagram_url(url)
|
||||
|
||||
@@ -30,7 +30,7 @@ module Spree
|
||||
|
||||
def expiry=(expiry)
|
||||
self[:month], self[:year] = expiry.split(" / ")
|
||||
self[:year] = "20" + self[:year]
|
||||
self[:year] = "20#{self[:year]}"
|
||||
end
|
||||
|
||||
def number=(num)
|
||||
|
||||
@@ -118,7 +118,7 @@ module Spree
|
||||
end
|
||||
|
||||
def self.clean_name
|
||||
i18n_key = "spree.admin.payment_methods.providers." + name.demodulize.downcase
|
||||
i18n_key = "spree.admin.payment_methods.providers.#{name.demodulize.downcase}"
|
||||
I18n.t(i18n_key)
|
||||
end
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ module Api
|
||||
producer_shop: "map_003-producer-shop.svg",
|
||||
producer: "map_001-producer-only.svg",
|
||||
}
|
||||
"/map_icons/" + (icons[enterprise.category] || "map_001-producer-only.svg")
|
||||
"/map_icons/#{icons[enterprise.category] || 'map_001-producer-only.svg'}"
|
||||
end
|
||||
|
||||
# Choose regular icon font for enterprises.
|
||||
|
||||
@@ -21,7 +21,7 @@ module Api
|
||||
producer_shop: "map_003-producer-shop.svg",
|
||||
producer: "map_001-producer-only.svg",
|
||||
}
|
||||
"/map_icons/" + (icons[enterprise.category] || "map_001-producer-only.svg")
|
||||
"/map_icons/#{icons[enterprise.category] || 'map_001-producer-only.svg'}"
|
||||
end
|
||||
|
||||
def icon_font
|
||||
|
||||
@@ -59,7 +59,7 @@ class EmbeddedPageService
|
||||
def set_logout_redirect
|
||||
return unless enterprise_slug
|
||||
|
||||
@session[:shopfront_redirect] = '/' + enterprise_slug + '/shop?embedded_shopfront=true'
|
||||
@session[:shopfront_redirect] = "/#{enterprise_slug}/shop?embedded_shopfront=true"
|
||||
end
|
||||
|
||||
def enterprise_slug
|
||||
|
||||
@@ -22,7 +22,7 @@ module Spree
|
||||
include CanCan::ControllerAdditions
|
||||
include Spree::Core::ControllerHelpers::Auth
|
||||
|
||||
prepend_view_path Rails.root + "app/views"
|
||||
prepend_view_path "#{Rails.root}app/views"
|
||||
append_view_path File.expand_path("../../../app/views", File.dirname(__FILE__))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,11 +9,11 @@ module Spree
|
||||
instance_variable_set "@#{name}", Set.new
|
||||
|
||||
create_method( :"#{name}=" ) { |val|
|
||||
instance_variable_set( "@" + name, val)
|
||||
instance_variable_set( "@#{name}", val)
|
||||
}
|
||||
|
||||
create_method(name.to_sym) do
|
||||
instance_variable_get( "@" + name )
|
||||
instance_variable_get( "@#{name}" )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@ module Spree
|
||||
before { allow(li).to receive(:product) { p } }
|
||||
|
||||
context "when full_name starts with the product name" do
|
||||
before { allow(li).to receive(:full_name) { p.name + " - something" } }
|
||||
before { allow(li).to receive(:full_name) { "#{p.name} - something" } }
|
||||
|
||||
it "does not show the product name twice" do
|
||||
expect(li.product_and_full_name).to eq('product - something')
|
||||
|
||||
@@ -11,7 +11,7 @@ module Spree
|
||||
context '#duplicate' do
|
||||
it 'duplicates product' do
|
||||
clone = product.duplicate
|
||||
expect(clone.name).to eq 'COPY OF ' + product.name
|
||||
expect(clone.name).to eq "COPY OF #{product.name}"
|
||||
expect(clone.sku).to eq ""
|
||||
expect(clone.image).to eq product.image
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ RSpec.describe EmbeddedPageService do
|
||||
expect(session[:embedded_shopfront]).to eq true
|
||||
expect(session[:embedding_domain]).to eq 'embedding-enterprise.com'
|
||||
expect(session[:shopfront_redirect])
|
||||
.to eq '/' + enterprise_slug + '/shop?embedded_shopfront=true'
|
||||
.to eq "/#{enterprise_slug}/shop?embedded_shopfront=true"
|
||||
end
|
||||
|
||||
it "publicly reports that embedded layout should be used" do
|
||||
@@ -58,7 +58,7 @@ RSpec.describe EmbeddedPageService do
|
||||
expect(session[:embedded_shopfront]).to eq true
|
||||
expect(session[:embedding_domain]).to eq 'embedding-enterprise.com'
|
||||
expect(session[:shopfront_redirect])
|
||||
.to eq '/' + enterprise_slug + '/shop?embedded_shopfront=true'
|
||||
.to eq "/#{enterprise_slug}/shop?embedded_shopfront=true"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ module Features
|
||||
"select.flatpickr-monthDropdown-months").value.to_i + 1
|
||||
year = find(".flatpickr-calendar.open .flatpickr-current-month " \
|
||||
".numInputWrapper .cur-year").value
|
||||
month.to_s + " " + year.to_s
|
||||
"#{month} #{year}"
|
||||
end
|
||||
|
||||
def pick_datetime(calendar_selector, datetime_selector)
|
||||
|
||||
@@ -690,7 +690,7 @@ RSpec.describe '
|
||||
end
|
||||
|
||||
it "checks error when creating product image with unsupported format" do
|
||||
unsupported_image_file_path = Rails.root + "README.md"
|
||||
unsupported_image_file_path = "#{Rails.root}README.md"
|
||||
product = create(:simple_product, supplier: @supplier2)
|
||||
|
||||
image = white_logo_file
|
||||
|
||||
Reference in New Issue
Block a user