Skip to content

Commit b0be6f0

Browse files
committed
Fix Style/ExpandPathArguments cop
1 parent bd54ec4 commit b0be6f0

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

Gemfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
source "https://rubygems.org"
2-
version_file = File.expand_path("../.rails-version", __FILE__)
2+
version_file = File.expand_path('.rails-version', __dir__)
33
RAILS_VERSION = ENV['RAILS_VERSION'] || (File.exist?(version_file) && File.read(version_file).chomp) || ""
44

55
gemspec
66

7-
rspec_dependencies_gemfile = File.expand_path("../Gemfile-rspec-dependencies", __FILE__)
7+
rspec_dependencies_gemfile = File.expand_path('Gemfile-rspec-dependencies', __dir__)
88
eval_gemfile rspec_dependencies_gemfile
99

1010
gem 'yard', '~> 0.8.7', require: false
@@ -60,8 +60,8 @@ gem "rubyzip", '~> 1.2'
6060

6161
gem 'rubocop', '~> 0.79.0'
6262

63-
custom_gemfile = File.expand_path("../Gemfile-custom", __FILE__)
63+
custom_gemfile = File.expand_path('Gemfile-custom', __dir__)
6464
eval_gemfile custom_gemfile if File.exist?(custom_gemfile)
6565

66-
rails_dependencies_gemfile = File.expand_path("../Gemfile-rails-dependencies", __FILE__)
66+
rails_dependencies_gemfile = File.expand_path('Gemfile-rails-dependencies', __dir__)
6767
eval_gemfile rails_dependencies_gemfile

example_app_generator/generate_action_mailer_specs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'active_support'
22
require 'active_support/core_ext/module'
33

4-
using_source_path(File.expand_path('..', __FILE__)) do
4+
using_source_path(File.expand_path(__dir__)) do
55
# Comment out the default mailer stuff
66
comment_lines 'config/environments/development.rb', /action_mailer/
77
comment_lines 'config/environments/test.rb', /action_mailer/

example_app_generator/generate_app.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'nokogiri'
22

3-
rspec_rails_repo_path = File.expand_path("../../", __FILE__)
3+
rspec_rails_repo_path = File.expand_path('..', __dir__)
44
rspec_dependencies_gemfile = File.join(rspec_rails_repo_path, 'Gemfile-rspec-dependencies')
55
rails_dependencies_gemfile = File.join(rspec_rails_repo_path, 'Gemfile-rails-dependencies')
66
bundle_install_path = File.join(rspec_rails_repo_path, '..', 'bundle')

example_app_generator/generate_stuff.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'rspec/rails/feature_check'
22

3-
DEFAULT_SOURCE_PATH = File.expand_path('..', __FILE__)
3+
DEFAULT_SOURCE_PATH = File.expand_path(__dir__)
44

55
module ExampleAppHooks
66
module AR
@@ -96,7 +96,7 @@ def using_source_path(path)
9696
generate('rspec:feature gadget')
9797
generate('controller things custom_action')
9898

99-
using_source_path(File.expand_path('..', __FILE__)) do
99+
using_source_path(File.expand_path(__dir__)) do
100100
# rspec-core loads files alphabetically, so we want this to be the first one
101101
copy_file 'spec/features/model_mocks_integration_spec.rb'
102102
end
@@ -124,7 +124,7 @@ def using_source_path(path)
124124

125125
# Use the absolute path so we can load it without active record too
126126
apply File.join(DEFAULT_SOURCE_PATH, 'generate_action_mailer_specs.rb')
127-
using_source_path(File.expand_path('..', __FILE__)) do
127+
using_source_path(File.expand_path(__dir__)) do
128128
# rspec-core loads files alphabetically, so we want this to be the first one
129129
copy_file 'spec/__verify_fixture_load_order_spec.rb'
130130
end

example_app_generator/no_active_record/lib/rails/generators/in_memory/model/model_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
module InMemory
55
module Generators
66
class ModelGenerator < ::Rspec::Generators::Base
7-
source_root File.expand_path('../templates', __FILE__)
7+
source_root File.expand_path('templates', __dir__)
88

99
desc "Creates a Fake ActiveRecord acting model"
1010
argument :attributes,

example_app_generator/spec/support/default_preview_path

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require_file_stub 'config/environment' do
1717
require_file_stub 'config/application' do
1818
require_file_stub 'config/boot' do
1919
# Set up gems listed in the Gemfile.
20-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
20+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2121
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
2222
end
2323

rspec-rails.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- encoding: utf-8 -*-
2-
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2+
$LOAD_PATH.unshift File.expand_path('lib', __dir__)
33
require "rspec/rails/version"
44

55
Gem::Specification.new do |s|

spec/support/generators.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Macros
66
# Tell the generator where to put its output (what it thinks of as
77
# Rails.root)
88
def set_default_destination
9-
destination File.expand_path("../../../tmp", __FILE__)
9+
destination File.expand_path('../../tmp', __dir__)
1010
end
1111

1212
def setup_default_destination

yard/template/default/layout/html/setup.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Docs suggest I don't need this, but ...
2-
YARD::Server::Commands::StaticFileCommand::STATIC_PATHS << File.expand_path("../../../fulldoc/html/", __FILE__)
2+
YARD::Server::Commands::StaticFileCommand::STATIC_PATHS << File.expand_path('../../fulldoc/html', __dir__)
33

44
def stylesheets
55
super + ['css/rspec.css']

0 commit comments

Comments
 (0)