From 1559a20b06afb5be4f94c5f0cdc965e1a13afc7a Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Mon, 18 Oct 2021 18:40:01 +0200 Subject: [PATCH] refactor: use __dir__ in File.expand_path __dir__ is nice, and available. --- README.malayalam.md | 2 +- Rakefile | 2 +- rack-protection/Rakefile | 2 +- rack-protection/rack-protection.gemspec | 2 +- rack-protection/spec/spec_helper.rb | 2 +- sinatra-contrib/Rakefile | 2 +- sinatra-contrib/lib/sinatra/runner.rb | 4 ++-- sinatra-contrib/sinatra-contrib.gemspec | 2 +- sinatra-contrib/spec/config_file_spec.rb | 2 +- sinatra-contrib/spec/content_for_spec.rb | 4 ++-- sinatra-contrib/spec/namespace_spec.rb | 4 ++-- sinatra-contrib/spec/reloader_spec.rb | 4 ++-- sinatra.gemspec | 2 +- test/asciidoctor_test.rb | 2 +- test/base_test.rb | 2 +- test/builder_test.rb | 2 +- test/coffee_test.rb | 2 +- test/compile_test.rb | 2 +- test/creole_test.rb | 2 +- test/delegator_test.rb | 2 +- test/encoding_test.rb | 2 +- test/erb_test.rb | 2 +- test/extensions_test.rb | 2 +- test/filter_test.rb | 2 +- test/haml_test.rb | 2 +- test/helpers_test.rb | 2 +- test/integration/app.rb | 2 +- test/integration_async_helper.rb | 2 +- test/integration_async_test.rb | 4 ++-- test/integration_helper.rb | 6 +++--- test/integration_test.rb | 4 ++-- test/liquid_test.rb | 2 +- test/mapped_error_test.rb | 2 +- test/markaby_test.rb | 2 +- test/markdown_test.rb | 2 +- test/mediawiki_test.rb | 2 +- test/middleware_test.rb | 2 +- test/nokogiri_test.rb | 2 +- test/rabl_test.rb | 2 +- test/rack_test.rb | 2 +- test/radius_test.rb | 2 +- test/rdoc_test.rb | 2 +- test/readme_test.rb | 2 +- test/request_test.rb | 2 +- test/response_test.rb | 2 +- test/result_test.rb | 2 +- test/route_added_hook_test.rb | 2 +- test/routing_test.rb | 2 +- test/sass_test.rb | 2 +- test/scss_test.rb | 2 +- test/server_test.rb | 2 +- test/settings_test.rb | 2 +- test/sinatra_test.rb | 2 +- test/slim_test.rb | 2 +- test/static_test.rb | 2 +- test/streaming_test.rb | 2 +- test/templates_test.rb | 2 +- test/textile_test.rb | 2 +- test/wlang_test.rb | 2 +- test/yajl_test.rb | 2 +- 60 files changed, 68 insertions(+), 68 deletions(-) diff --git a/README.malayalam.md b/README.malayalam.md index 874a11c2..1c1deea6 100644 --- a/README.malayalam.md +++ b/README.malayalam.md @@ -404,7 +404,7 @@ end ```ruby -set :public_folder, File.dirname(__FILE__) + '/static' +set :public_folder, __dir__ + '/static' ``` URL ഇളിൽ ഡയറക്ടറി പാത ഉണ്ടാകില്ല . A file diff --git a/Rakefile b/Rakefile index 3209d364..8979eaff 100644 --- a/Rakefile +++ b/Rakefile @@ -9,7 +9,7 @@ task :spec => :test CLEAN.include "**/*.rbc" def source_version - @source_version ||= File.read(File.expand_path("../VERSION", __FILE__)).strip + @source_version ||= File.read(File.expand_path("VERSION", __dir__)).strip end def prev_feature diff --git a/rack-protection/Rakefile b/rack-protection/Rakefile index 5bab1699..8ed2e47b 100644 --- a/rack-protection/Rakefile +++ b/rack-protection/Rakefile @@ -1,5 +1,5 @@ # encoding: utf-8 -$LOAD_PATH.unshift File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift File.expand_path('lib', __dir__) begin require 'bundler' diff --git a/rack-protection/rack-protection.gemspec b/rack-protection/rack-protection.gemspec index 817649d4..8970546c 100644 --- a/rack-protection/rack-protection.gemspec +++ b/rack-protection/rack-protection.gemspec @@ -1,4 +1,4 @@ -version = File.read(File.expand_path("../../VERSION", __FILE__)).strip +version = File.read(File.expand_path("../VERSION", __dir__)).strip Gem::Specification.new do |s| # general infos diff --git a/rack-protection/spec/spec_helper.rb b/rack-protection/spec/spec_helper.rb index 625187d8..1d4445fe 100644 --- a/rack-protection/spec/spec_helper.rb +++ b/rack-protection/spec/spec_helper.rb @@ -2,7 +2,7 @@ require 'rack/protection' require 'rack/test' require 'rack' -Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f } +Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f } # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. diff --git a/sinatra-contrib/Rakefile b/sinatra-contrib/Rakefile index 1ec39dd9..53f99e89 100644 --- a/sinatra-contrib/Rakefile +++ b/sinatra-contrib/Rakefile @@ -1,4 +1,4 @@ -$LOAD_PATH.unshift File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift File.expand_path('lib', __dir__) require 'open-uri' require 'yaml' require 'sinatra/contrib/version' diff --git a/sinatra-contrib/lib/sinatra/runner.rb b/sinatra-contrib/lib/sinatra/runner.rb index c1c59cc1..4e967aae 100644 --- a/sinatra-contrib/lib/sinatra/runner.rb +++ b/sinatra-contrib/lib/sinatra/runner.rb @@ -28,7 +28,7 @@ module Sinatra # # class Runner < Sinatra::Runner # def app_file - # File.expand_path("../server.rb", __FILE__) + # File.expand_path("server.rb", __dir__) # end # end # @@ -49,7 +49,7 @@ module Sinatra # For an example, check https://github.com/apotonick/roar/blob/master/test/integration/runner.rb class Runner def app_file - File.expand_path("../server.rb", __FILE__) + File.expand_path("server.rb", __dir__) end def run diff --git a/sinatra-contrib/sinatra-contrib.gemspec b/sinatra-contrib/sinatra-contrib.gemspec index f8d0c61b..ba3e121a 100644 --- a/sinatra-contrib/sinatra-contrib.gemspec +++ b/sinatra-contrib/sinatra-contrib.gemspec @@ -1,6 +1,6 @@ # -*- encoding: utf-8 -*- -version = File.read(File.expand_path("../../VERSION", __FILE__)).strip +version = File.read(File.expand_path("../VERSION", __dir__)).strip Gem::Specification.new do |s| s.name = "sinatra-contrib" diff --git a/sinatra-contrib/spec/config_file_spec.rb b/sinatra-contrib/spec/config_file_spec.rb index 05384509..8b0cf44d 100644 --- a/sinatra-contrib/spec/config_file_spec.rb +++ b/sinatra-contrib/spec/config_file_spec.rb @@ -4,7 +4,7 @@ describe Sinatra::ConfigFile do def config_file(*args, &block) mock_app do register Sinatra::ConfigFile - set :root, File.expand_path('../config_file', __FILE__) + set :root, File.expand_path('config_file', __dir__) instance_eval(&block) if block config_file(*args) end diff --git a/sinatra-contrib/spec/content_for_spec.rb b/sinatra-contrib/spec/content_for_spec.rb index d1b0540f..ed15b77b 100644 --- a/sinatra-contrib/spec/content_for_spec.rb +++ b/sinatra-contrib/spec/content_for_spec.rb @@ -4,7 +4,7 @@ describe Sinatra::ContentFor do subject do Sinatra.new do helpers Sinatra::ContentFor - set :views, File.expand_path("../content_for", __FILE__) + set :views, File.expand_path("content_for", __dir__) end.new! end @@ -215,7 +215,7 @@ describe Sinatra::ContentFor do mock_app do helpers Sinatra::ContentFor set inner, :layout_engine => outer - set :views, File.expand_path("../content_for", __FILE__) + set :views, File.expand_path("content_for", __dir__) get('/:view') { render(inner, params[:view].to_sym) } get('/:layout/:view') do render inner, params[:view].to_sym, :layout => params[:layout].to_sym diff --git a/sinatra-contrib/spec/namespace_spec.rb b/sinatra-contrib/spec/namespace_spec.rb index 7d833d18..5242781c 100644 --- a/sinatra-contrib/spec/namespace_spec.rb +++ b/sinatra-contrib/spec/namespace_spec.rb @@ -661,10 +661,10 @@ describe Sinatra::Namespace do specify 'can use a custom views directory' do mock_app do - set :views, File.expand_path('../namespace', __FILE__) + set :views, File.expand_path('namespace', __dir__) send(verb, '/') { erb :foo } namespace('/foo') do - set :views, File.expand_path('../namespace/nested', __FILE__) + set :views, File.expand_path('namespace/nested', __dir__) send(verb) { erb :foo } end end diff --git a/sinatra-contrib/spec/reloader_spec.rb b/sinatra-contrib/spec/reloader_spec.rb index 4b5e2035..e7569062 100644 --- a/sinatra-contrib/spec/reloader_spec.rb +++ b/sinatra-contrib/spec/reloader_spec.rb @@ -4,7 +4,7 @@ require 'fileutils' describe Sinatra::Reloader do # Returns the temporary directory. def tmp_dir - File.expand_path('../../tmp', __FILE__) + File.expand_path('../tmp', __dir__) end # Returns the path of the Sinatra application file created by @@ -48,7 +48,7 @@ describe Sinatra::Reloader do options[:parent] ||= 'Sinatra::Base' update_file(app_file_path) do |f| - template_path = File.expand_path('../reloader/app.rb.erb', __FILE__) + template_path = File.expand_path('reloader/app.rb.erb', __dir__) template = Tilt.new(template_path, nil, :trim => '<>') f.write template.render(Object.new, options) end diff --git a/sinatra.gemspec b/sinatra.gemspec index af5ad16b..e742856a 100644 --- a/sinatra.gemspec +++ b/sinatra.gemspec @@ -1,4 +1,4 @@ -version = File.read(File.expand_path("../VERSION", __FILE__)).strip +version = File.read(File.expand_path("VERSION", __dir__)).strip Gem::Specification.new 'sinatra', version do |s| s.description = "Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort." diff --git a/test/asciidoctor_test.rb b/test/asciidoctor_test.rb index 666c217d..9a296f46 100644 --- a/test/asciidoctor_test.rb +++ b/test/asciidoctor_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'asciidoctor' diff --git a/test/base_test.rb b/test/base_test.rb index 6f9101fb..00ca61cf 100644 --- a/test/base_test.rb +++ b/test/base_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class BaseTest < Minitest::Test describe 'Sinatra::Base subclasses' do diff --git a/test/builder_test.rb b/test/builder_test.rb index bf376caf..0729537c 100644 --- a/test/builder_test.rb +++ b/test/builder_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'builder' diff --git a/test/coffee_test.rb b/test/coffee_test.rb index 25f0367c..16b9ac64 100644 --- a/test/coffee_test.rb +++ b/test/coffee_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'coffee-script' diff --git a/test/compile_test.rb b/test/compile_test.rb index 097cc143..794f2846 100644 --- a/test/compile_test.rb +++ b/test/compile_test.rb @@ -1,5 +1,5 @@ # I like coding: UTF-8 -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class CompileTest < Minitest::Test def self.parses pattern, example, expected_params, mtype = :sinatra, mopts = {} diff --git a/test/creole_test.rb b/test/creole_test.rb index ad54ba51..ce4aa44a 100644 --- a/test/creole_test.rb +++ b/test/creole_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'creole' diff --git a/test/delegator_test.rb b/test/delegator_test.rb index daf2c46d..52ce1594 100644 --- a/test/delegator_test.rb +++ b/test/delegator_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class DelegatorTest < Minitest::Test class Mirror diff --git a/test/encoding_test.rb b/test/encoding_test.rb index d6415d11..28ead0a0 100644 --- a/test/encoding_test.rb +++ b/test/encoding_test.rb @@ -1,5 +1,5 @@ # encoding: UTF-8 -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) require 'erb' class BaseTest < Minitest::Test diff --git a/test/erb_test.rb b/test/erb_test.rb index 86d722d2..e8e73cef 100644 --- a/test/erb_test.rb +++ b/test/erb_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class ERBTest < Minitest::Test def engine diff --git a/test/extensions_test.rb b/test/extensions_test.rb index b0d7e845..bb58e966 100644 --- a/test/extensions_test.rb +++ b/test/extensions_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class ExtensionsTest < Minitest::Test module FooExtensions diff --git a/test/filter_test.rb b/test/filter_test.rb index f13c94a4..3af2cadd 100644 --- a/test/filter_test.rb +++ b/test/filter_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class BeforeFilterTest < Minitest::Test it "executes filters in the order defined" do diff --git a/test/haml_test.rb b/test/haml_test.rb index 4e678e1d..a987d970 100644 --- a/test/haml_test.rb +++ b/test/haml_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'haml' diff --git a/test/helpers_test.rb b/test/helpers_test.rb index c48da4f5..5e1cdc97 100644 --- a/test/helpers_test.rb +++ b/test/helpers_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) require 'date' require 'json' diff --git a/test/integration/app.rb b/test/integration/app.rb index 97884f85..23632499 100644 --- a/test/integration/app.rb +++ b/test/integration/app.rb @@ -47,7 +47,7 @@ get '/send' do end get '/send_file' do - file = File.expand_path '../../views/a/in_a.str', __FILE__ + file = File.expand_path '../views/a/in_a.str', __dir__ send_file file end diff --git a/test/integration_async_helper.rb b/test/integration_async_helper.rb index 155a627c..cf05839d 100644 --- a/test/integration_async_helper.rb +++ b/test/integration_async_helper.rb @@ -1,4 +1,4 @@ -require File.expand_path('../integration_helper', __FILE__) +require File.expand_path('integration_helper', __dir__) module IntegrationAsyncHelper def it(message, &block) diff --git a/test/integration_async_test.rb b/test/integration_async_test.rb index 79397baa..cd283692 100644 --- a/test/integration_async_test.rb +++ b/test/integration_async_test.rb @@ -1,5 +1,5 @@ -require File.expand_path('../helper', __FILE__) -require File.expand_path('../integration_async_helper', __FILE__) +require File.expand_path('helper', __dir__) +require File.expand_path('integration_async_helper', __dir__) # These tests are like integration_test, but they test asynchronous streaming. class IntegrationAsyncTest < Minitest::Test diff --git a/test/integration_helper.rb b/test/integration_helper.rb index e2d00409..68a40c7a 100644 --- a/test/integration_helper.rb +++ b/test/integration_helper.rb @@ -22,7 +22,7 @@ module IntegrationHelper end def app_file - File.expand_path('../integration/app.rb', __FILE__) + File.expand_path('integration/app.rb', __dir__) end def environment @@ -62,7 +62,7 @@ module IntegrationHelper cmd << File.expand_path(file, dir).inspect end cmd << "-w" unless net_http_server? - cmd << "-I" << File.expand_path('../../lib', __FILE__).inspect + cmd << "-I" << File.expand_path('../lib', __dir__).inspect cmd << app_file.inspect << '-s' << server << '-o' << '127.0.0.1' << '-p' << port cmd << "-e" << environment.to_s << '2>&1' cmd.join " " @@ -112,7 +112,7 @@ module IntegrationHelper # Create a new container, set load paths and env # SINGLETHREAD means create a new runtime vm = org.jruby.embed.ScriptingContainer.new(org.jruby.embed.LocalContextScope::SINGLETHREAD) - vm.load_paths = [File.expand_path('../../lib', __FILE__)] + vm.load_paths = [File.expand_path('../lib', __dir__)] vm.environment = ENV.merge('APP_ENV' => environment.to_s) # This ensures processing of RUBYOPT which activates Bundler diff --git a/test/integration_test.rb b/test/integration_test.rb index 925ad6a3..e174af53 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -1,5 +1,5 @@ -require File.expand_path('../helper', __FILE__) -require File.expand_path('../integration_helper', __FILE__) +require File.expand_path('helper', __dir__) +require File.expand_path('integration_helper', __dir__) # These tests start a real server and talk to it over TCP. # Every test runs with every detected server. diff --git a/test/liquid_test.rb b/test/liquid_test.rb index af32a707..ecbceac2 100644 --- a/test/liquid_test.rb +++ b/test/liquid_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'liquid' diff --git a/test/mapped_error_test.rb b/test/mapped_error_test.rb index 562e509d..60d6a90a 100644 --- a/test/mapped_error_test.rb +++ b/test/mapped_error_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class FooError < RuntimeError end diff --git a/test/markaby_test.rb b/test/markaby_test.rb index b1aecf9b..32dff219 100644 --- a/test/markaby_test.rb +++ b/test/markaby_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'markaby' diff --git a/test/markdown_test.rb b/test/markdown_test.rb index 9112b976..46091fbf 100644 --- a/test/markdown_test.rb +++ b/test/markdown_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) MarkdownTest = proc do def markdown_app(&block) diff --git a/test/mediawiki_test.rb b/test/mediawiki_test.rb index 4bd53832..79f41826 100644 --- a/test/mediawiki_test.rb +++ b/test/mediawiki_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'wikicloth' diff --git a/test/middleware_test.rb b/test/middleware_test.rb index 2bce8e3f..3901b7b5 100644 --- a/test/middleware_test.rb +++ b/test/middleware_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class MiddlewareTest < Minitest::Test setup do diff --git a/test/nokogiri_test.rb b/test/nokogiri_test.rb index 6b6e175b..517f495c 100644 --- a/test/nokogiri_test.rb +++ b/test/nokogiri_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'nokogiri' diff --git a/test/rabl_test.rb b/test/rabl_test.rb index 997726b4..2d54a9c5 100644 --- a/test/rabl_test.rb +++ b/test/rabl_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'rabl' diff --git a/test/rack_test.rb b/test/rack_test.rb index 8ac81d42..e20d0f63 100644 --- a/test/rack_test.rb +++ b/test/rack_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) require 'rack' class RackTest < Minitest::Test diff --git a/test/radius_test.rb b/test/radius_test.rb index 36187450..8c20608c 100644 --- a/test/radius_test.rb +++ b/test/radius_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'radius' diff --git a/test/rdoc_test.rb b/test/rdoc_test.rb index dd730bb9..f13cea01 100644 --- a/test/rdoc_test.rb +++ b/test/rdoc_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'rdoc' diff --git a/test/readme_test.rb b/test/readme_test.rb index 4da41038..eaa37924 100644 --- a/test/readme_test.rb +++ b/test/readme_test.rb @@ -1,5 +1,5 @@ # Tests to check if all the README examples work. -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class ReadmeTest < Minitest::Test example do diff --git a/test/request_test.rb b/test/request_test.rb index 978fe66a..d405205b 100644 --- a/test/request_test.rb +++ b/test/request_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) require 'stringio' class RequestTest < Minitest::Test diff --git a/test/response_test.rb b/test/response_test.rb index c5bb32fa..d713bd08 100644 --- a/test/response_test.rb +++ b/test/response_test.rb @@ -1,6 +1,6 @@ # encoding: utf-8 -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class ResponseTest < Minitest::Test setup { @response = Sinatra::Response.new([], 200, { 'Content-Type' => 'text/html' }) } diff --git a/test/result_test.rb b/test/result_test.rb index 67d163fc..28c4a1e2 100644 --- a/test/result_test.rb +++ b/test/result_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class ThirdPartyError < RuntimeError def http_status; 400 end diff --git a/test/route_added_hook_test.rb b/test/route_added_hook_test.rb index 2356166f..db3edbbf 100644 --- a/test/route_added_hook_test.rb +++ b/test/route_added_hook_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) module RouteAddedTest @routes, @procs = [], [] diff --git a/test/routing_test.rb b/test/routing_test.rb index d4de6013..47bfd836 100644 --- a/test/routing_test.rb +++ b/test/routing_test.rb @@ -1,5 +1,5 @@ # I like coding: UTF-8 -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) # Helper method for easy route pattern matching testing def route_def(pattern) diff --git a/test/sass_test.rb b/test/sass_test.rb index 08e5d631..4d189f8a 100644 --- a/test/sass_test.rb +++ b/test/sass_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'sass' diff --git a/test/scss_test.rb b/test/scss_test.rb index 41fe5b99..e08d7bb6 100644 --- a/test/scss_test.rb +++ b/test/scss_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'sass' diff --git a/test/server_test.rb b/test/server_test.rb index aff43ad8..efacddb1 100644 --- a/test/server_test.rb +++ b/test/server_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) require 'stringio' module Rack::Handler diff --git a/test/settings_test.rb b/test/settings_test.rb index bd4e9e1c..69fc3d27 100644 --- a/test/settings_test.rb +++ b/test/settings_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class SettingsTest < Minitest::Test setup do diff --git a/test/sinatra_test.rb b/test/sinatra_test.rb index b27120a0..f903825f 100644 --- a/test/sinatra_test.rb +++ b/test/sinatra_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class SinatraTest < Minitest::Test it 'creates a new Sinatra::Base subclass on new' do diff --git a/test/slim_test.rb b/test/slim_test.rb index cd3726cc..dd304000 100644 --- a/test/slim_test.rb +++ b/test/slim_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'slim' diff --git a/test/static_test.rb b/test/static_test.rb index cefe55f9..86c9dba3 100644 --- a/test/static_test.rb +++ b/test/static_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class StaticTest < Minitest::Test setup do diff --git a/test/streaming_test.rb b/test/streaming_test.rb index cc1abe70..800bcca2 100644 --- a/test/streaming_test.rb +++ b/test/streaming_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) class StreamingTest < Minitest::Test Stream = Sinatra::Helpers::Stream diff --git a/test/templates_test.rb b/test/templates_test.rb index 08a99ca8..69882176 100644 --- a/test/templates_test.rb +++ b/test/templates_test.rb @@ -1,5 +1,5 @@ # encoding: UTF-8 -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) File.delete(__dir__ + '/views/layout.test') rescue nil class TestTemplate < Tilt::Template diff --git a/test/textile_test.rb b/test/textile_test.rb index 03243bbd..ee1df3ba 100644 --- a/test/textile_test.rb +++ b/test/textile_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'redcloth' diff --git a/test/wlang_test.rb b/test/wlang_test.rb index ef8a7138..8cadf55e 100644 --- a/test/wlang_test.rb +++ b/test/wlang_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'wlang' diff --git a/test/yajl_test.rb b/test/yajl_test.rb index 1f090da9..6da0daed 100644 --- a/test/yajl_test.rb +++ b/test/yajl_test.rb @@ -1,4 +1,4 @@ -require File.expand_path('../helper', __FILE__) +require File.expand_path('helper', __dir__) begin require 'yajl'