Fix new rubocop warnings

This commit is contained in:
Tom Hughes 2022-09-09 22:36:39 +01:00
parent f7e168b8e1
commit 9cd96bd452
7 changed files with 9 additions and 9 deletions

View file

@ -26,7 +26,7 @@ class PreferencesController < ApplicationController
flash[:notice] = { :partial => "preferences/update_success_flash" }
redirect_to preferences_path
else
flash[:error] = t ".failure"
flash.now[:error] = t ".failure"
render :edit
end
end

View file

@ -36,7 +36,7 @@ class ProfilesController < ApplicationController
flash[:notice] = t ".success"
redirect_to user_path(current_user)
else
flash[:error] = t ".failure"
flash.now[:error] = t ".failure"
render :edit
end
end

View file

@ -28,7 +28,7 @@ class ReportsController < ApplicationController
redirect_to helpers.reportable_url(@report.issue.reportable), :notice => t(".successful_report")
else
flash[:notice] = t(".provide_details")
flash.now[:notice] = t(".provide_details")
render :action => "new"
end
end

View file

@ -183,7 +183,7 @@ class UserMailer < ApplicationMailer
end
def attach_project_logo
attachments.inline["logo.png"] = File.read(Rails.root.join("app/assets/images/osm_logo_30.png"))
attachments.inline["logo.png"] = Rails.root.join("app/assets/images/osm_logo_30.png").read
end
def attach_user_avatar(user)
@ -199,7 +199,7 @@ class UserMailer < ApplicationMailer
avatar.blob.download
end
else
File.read(Rails.root.join("app/assets/images/avatar_small.png"))
Rails.root.join("app/assets/images/avatar_small.png").read
end
end

View file

@ -2,7 +2,7 @@
# Otherwise, admins might not be aware that they are now silently ignored
# and major problems could occur
# rubocop:disable Rails/Output, Rails/Exit
if File.exist?(Rails.root.join("config/application.yml"))
if Rails.root.join("config/application.yml").exist?
puts "The config/application.yml file is no longer supported."
puts ""
puts "Default settings are now found in config/settings.yml and you"

View file

@ -19,7 +19,7 @@ class Country
def self.load_countries
countries = {}
xml = REXML::Document.new(File.read(Rails.root.join("config/countries.xml")))
xml = REXML::Document.new(Rails.root.join("config/countries.xml").read)
xml.elements.each("geonames/country") do |ele|
code = ele.get_text("countryCode").to_s

View file

@ -166,14 +166,14 @@ class TraceTest < ActiveSupport::TestCase
end
def test_large_picture
picture = File.read(Rails.root.join("test/gpx/fixtures/a.gif"), :mode => "rb")
picture = Rails.root.join("test/gpx/fixtures/a.gif").read(:mode => "rb")
trace = create(:trace, :fixture => "a")
assert_equal picture, trace.large_picture
end
def test_icon_picture
picture = File.read(Rails.root.join("test/gpx/fixtures/a_icon.gif"), :mode => "rb")
picture = Rails.root.join("test/gpx/fixtures/a_icon.gif").read(:mode => "rb")
trace = create(:trace, :fixture => "a")
assert_equal picture, trace.icon_picture