Fix rubocop Rails.root.path complaints (#5114)
This commit is contained in:
parent
89f6f00cbd
commit
70e1ffbbc3
16 changed files with 27 additions and 29 deletions
|
|
@ -31,7 +31,7 @@ module PracticalDeveloper
|
|||
# config.time_zone = 'Central Time (US & Canada)'
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||
# config.i18n.load_path += Dir[Rails.root.join("my/locales/*.{rb,yml}").to_s]
|
||||
# config.i18n.default_locale = :de
|
||||
|
||||
config.autoload_paths += Dir["#{config.root}/app/labor/"]
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ Rails.application.configure do
|
|||
config.consider_all_requests_local = true
|
||||
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
if Rails.root.join("tmp", "caching-dev.txt").exist?
|
||||
if Rails.root.join("tmp/caching-dev.txt").exist?
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
config.cache_store = :memory_store
|
||||
|
|
@ -85,7 +85,7 @@ Rails.application.configure do
|
|||
domain: "localhost:3000"
|
||||
}
|
||||
|
||||
config.action_mailer.preview_path = Rails.root.join("spec", "mailers", "previews")
|
||||
config.action_mailer.preview_path = Rails.root.join("spec/mailers/previews")
|
||||
|
||||
# Raises error for missing translations
|
||||
# config.action_view.raise_on_missing_translations = true
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ Rails.application.config.assets.precompile += %w[favicon.ico]
|
|||
# If you do not want to move existing images and fonts from your Rails app
|
||||
# you could also consider creating symlinks there that point to the original
|
||||
# rails directories. In that case, you would not add these paths here.
|
||||
# Rails.application.config.assets.paths << Rails.root.join("client", "assets", "stylesheets")
|
||||
# Rails.application.config.assets.paths << Rails.root.join("client", "assets", "images")
|
||||
# Rails.application.config.assets.paths << Rails.root.join("client", "assets", "fonts")
|
||||
# Rails.application.config.assets.paths << Rails.root.join("client/assets/stylesheets")
|
||||
# Rails.application.config.assets.paths << Rails.root.join("client/assets/images")
|
||||
# Rails.application.config.assets.paths << Rails.root.join("client/assets/fonts")
|
||||
# Rails.application.config.assets.precompile += %w( generated/server-bundle.js )
|
||||
|
||||
Rails.application.config.assets.precompile += %w[minimal.css]
|
||||
|
|
@ -30,4 +30,4 @@ Rails.application.config.assets.precompile += %w[s3_direct_upload.js]
|
|||
Rails.application.config.assets.precompile += %w[classified_listings.css]
|
||||
Rails.application.config.assets.precompile += %w[lib/xss.js]
|
||||
Rails.application.config.assets.precompile += %w[lib/pulltorefresh.js]
|
||||
Rails.application.config.assets.precompile += %w[internal.js]
|
||||
Rails.application.config.assets.precompile += %w[internal.js]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
# Liquid gem is evoked, hence the need for the fix below.
|
||||
|
||||
Rails.application.config.to_prepare do
|
||||
Dir.glob(Rails.root.join("app", "liquid_tags", "*.rb")).sort.each do |filename|
|
||||
Dir.glob(Rails.root.join("app/liquid_tags/*.rb")).sort.each do |filename|
|
||||
require_dependency filename
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
if Rails.env.development? || Rails.env.test?
|
||||
Rails.application.config.to_prepare do
|
||||
Dir.glob(Rails.root.join("app", "lib", "reverse_markdown", "converters", "*.rb")).sort.each do |filename|
|
||||
Dir.glob(Rails.root.join("app/lib/reverse_markdown/converters/*.rb")).sort.each do |filename|
|
||||
require_dependency filename
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ User.clear_index!
|
|||
user = User.create!(
|
||||
name: name = Faker::Name.unique.name,
|
||||
summary: Faker::Lorem.paragraph_by_chars(number: 199, supplemental: false),
|
||||
profile_image: File.open(Rails.root.join("app", "assets", "images", "#{rand(1..40)}.png")),
|
||||
profile_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")),
|
||||
website_url: Faker::Internet.url,
|
||||
twitter_username: Faker::Internet.username(specifier: name),
|
||||
email_comment_notifications: false,
|
||||
|
|
@ -118,7 +118,7 @@ end
|
|||
|
||||
Rails.logger.info "6. Creating Podcasts"
|
||||
|
||||
image_file = Rails.root.join("spec", "support", "fixtures", "images", "image1.jpeg")
|
||||
image_file = Rails.root.join("spec/support/fixtures/images/image1.jpeg")
|
||||
|
||||
podcast_objects = [
|
||||
{
|
||||
|
|
@ -228,7 +228,7 @@ Rails.logger.info "10. Creating Badges"
|
|||
Badge.create!(
|
||||
title: Faker::Lorem.word,
|
||||
description: Faker::Lorem.sentence,
|
||||
badge_image: File.open(Rails.root.join("app", "assets", "images", "#{rand(1..40)}.png")),
|
||||
badge_image: File.open(Rails.root.join("app/assets/images/#{rand(1..40)}.png")),
|
||||
)
|
||||
|
||||
Rails.logger.info "11. Creating FeedbackMessages"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
FactoryBot.define do
|
||||
image_path = Rails.root.join("spec", "support", "fixtures", "images", "image1.jpeg")
|
||||
image_path = Rails.root.join("spec/support/fixtures/images/image1.jpeg")
|
||||
|
||||
factory :badge do
|
||||
title { Faker::Book.title + " #{rand(1000)}" }
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ FactoryBot.define do
|
|||
factory :organization do
|
||||
name { Faker::Company.name }
|
||||
summary { Faker::Hipster.paragraph(sentence_count: 1)[0..150] }
|
||||
profile_image { File.open(Rails.root.join("app", "assets", "images", "android-icon-36x36.png")) }
|
||||
profile_image { File.open(Rails.root.join("app/assets/images/android-icon-36x36.png")) }
|
||||
nav_image { Faker::Avatar.image }
|
||||
url { Faker::Internet.url }
|
||||
slug { generate :slug }
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
FactoryBot.define do
|
||||
sequence(:podcast_slug) { |n| "slug-#{n}" }
|
||||
|
||||
image_path = Rails.root.join("spec", "support", "fixtures", "images", "image1.jpeg")
|
||||
image_path = Rails.root.join("spec/support/fixtures/images/image1.jpeg")
|
||||
|
||||
factory :podcast do
|
||||
title { Faker::Beer.name }
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ FactoryBot.define do
|
|||
sequence(:twitter_username) { |n| "twitter#{n}" }
|
||||
sequence(:github_username) { |n| "github#{n}" }
|
||||
|
||||
image_path = Rails.root.join("spec", "support", "fixtures", "images", "image1.jpeg")
|
||||
image_path = Rails.root.join("spec/support/fixtures/images/image1.jpeg")
|
||||
|
||||
factory :user do
|
||||
name { Faker::Name.name }
|
||||
|
|
|
|||
|
|
@ -199,7 +199,6 @@ RSpec.describe Comment, type: :model do
|
|||
end
|
||||
|
||||
it "is converted to deleted if the comment is deleted" do
|
||||
|
||||
comment.deleted = true
|
||||
expect(comment.title).to eq("[deleted]")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ require "test_prof/recipes/rspec/sample"
|
|||
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
||||
# require only the support files necessary.
|
||||
|
||||
Dir[Rails.root.join("spec", "support", "**", "*.rb")].each { |f| require f }
|
||||
Dir[Rails.root.join("spec", "system", "shared_examples", "**", "*.rb")].each { |f| require f }
|
||||
Dir[Rails.root.join("spec", "models", "shared_examples", "**", "*.rb")].each { |f| require f }
|
||||
Dir[Rails.root.join("spec", "jobs", "shared_examples", "**", "*.rb")].each { |f| require f }
|
||||
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||
Dir[Rails.root.join("spec/system/shared_examples/**/*.rb")].each { |f| require f }
|
||||
Dir[Rails.root.join("spec/models/shared_examples/**/*.rb")].each { |f| require f }
|
||||
Dir[Rails.root.join("spec/jobs/shared_examples/**/*.rb")].each { |f| require f }
|
||||
|
||||
# Checks for pending migrations before tests are run.
|
||||
# If you are not using ActiveRecord, you can remove this line.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require "rails_helper"
|
|||
|
||||
RSpec.describe "Admin::Podcasts", type: :request do
|
||||
let(:super_admin) { create(:user, :super_admin) }
|
||||
let(:image_file) { Rails.root.join("spec", "support", "fixtures", "images", "image1.jpeg") }
|
||||
let(:image_file) { Rails.root.join("spec/support/fixtures/images/image1.jpeg") }
|
||||
|
||||
before do
|
||||
sign_in super_admin
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ RSpec.describe "ImageUploads", type: :request do
|
|||
let(:headers) { { "Content-Type": "application/json", Accept: "application/json" } }
|
||||
let(:image) do
|
||||
Rack::Test::UploadedFile.new(
|
||||
Rails.root.join("spec", "support", "fixtures", "images", "image1.jpeg"),
|
||||
Rails.root.join("spec/support/fixtures/images/image1.jpeg"),
|
||||
"image/jpeg",
|
||||
)
|
||||
end
|
||||
|
|
@ -14,7 +14,7 @@ RSpec.describe "ImageUploads", type: :request do
|
|||
let(:cache) { Rails.cache }
|
||||
let(:bad_image) do
|
||||
Rack::Test::UploadedFile.new(
|
||||
Rails.root.join("spec", "support", "fixtures", "images", "bad-image.jpg"),
|
||||
Rails.root.join("spec/support/fixtures/images/bad-image.jpg"),
|
||||
"image/jpeg",
|
||||
)
|
||||
end
|
||||
|
|
@ -51,8 +51,7 @@ RSpec.describe "ImageUploads", type: :request do
|
|||
|
||||
it "supports upload of more than one image at a time" do
|
||||
image2 = Rack::Test::UploadedFile.new(
|
||||
Rails.root.join("spec", "support", "fixtures", "images", "image2.jpeg"),
|
||||
"image/jpeg",
|
||||
Rails.root.join("spec/support/fixtures/images/image2.jpeg"), "image/jpeg"
|
||||
)
|
||||
post "/image_uploads", headers: headers, params: { image: [image, image2] }
|
||||
|
||||
|
|
@ -87,7 +86,7 @@ RSpec.describe "ImageUploads", type: :request do
|
|||
it "raises error with too many uploads" do
|
||||
upload = proc do
|
||||
Rack::Test::UploadedFile.new(
|
||||
Rails.root.join("spec", "support", "fixtures", "images", "images1.jpeg"), "image/jpeg"
|
||||
Rails.root.join("spec/support/fixtures/images/images1.jpeg"), "image/jpeg"
|
||||
)
|
||||
end
|
||||
expect do
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ RSpec.describe "UserOrganization", type: :request do
|
|||
before do
|
||||
sign_in user
|
||||
org_params = build(:organization).attributes
|
||||
org_params["profile_image"] = Rack::Test::UploadedFile.new(Rails.root.join("app", "assets", "images", "android-icon-36x36.png"), "image/jpeg")
|
||||
org_params["profile_image"] = Rack::Test::UploadedFile.new(Rails.root.join("app/assets/images/android-icon-36x36.png"), "image/jpeg")
|
||||
post "/organizations", params: { organization: org_params }
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ RSpec.describe "Organization setting page(/settings/organization)", type: :syste
|
|||
fill_in "organization[slug]", with: "Organization"
|
||||
attach_file(
|
||||
"organization_profile_image",
|
||||
Rails.root.join("app", "assets", "images", "android-icon-36x36.png"),
|
||||
Rails.root.join("app/assets/images/android-icon-36x36.png"),
|
||||
)
|
||||
fill_in "Text color (hex)", with: "#ffffff"
|
||||
fill_in "Background color (hex)", with: "#000000"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue