Skip to content

Commit 432222f

Browse files
committed
prefer __dir__ over __FILE__ in File.expand_path
Thinking .. relative to files is not natural, we are used to think "parent of a directory", and we have __dir__ nowadays.
1 parent a1623fc commit 432222f

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

actionmailer/bin/test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2-
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
2+
3+
COMPONENT_ROOT = File.expand_path("..", __dir__)
34
require File.expand_path("../tools/test", COMPONENT_ROOT)
5+
46
exit Minitest.run(ARGV)

actionpack/bin/test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2-
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
2+
3+
COMPONENT_ROOT = File.expand_path("..", __dir__)
34
require File.expand_path("../tools/test", COMPONENT_ROOT)
5+
46
exit Minitest.run(ARGV)

actionview/bin/test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2-
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
2+
3+
COMPONENT_ROOT = File.expand_path("..", __dir__)
34
require File.expand_path("../tools/test", COMPONENT_ROOT)
5+
46
exit Minitest.run(ARGV)

activemodel/bin/test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2-
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
2+
3+
COMPONENT_ROOT = File.expand_path("..", __dir__)
34
require File.expand_path("../tools/test", COMPONENT_ROOT)
5+
46
exit Minitest.run(ARGV)

activerecord/bin/test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env ruby
2-
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
2+
3+
COMPONENT_ROOT = File.expand_path("..", __dir__)
34
require File.expand_path("../tools/test", COMPONENT_ROOT)
5+
46
module Minitest
57
def self.plugin_active_record_options(opts, options)
68
opts.separator ""

activesupport/bin/test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2-
COMPONENT_ROOT = File.expand_path("../../", __FILE__)
2+
3+
COMPONENT_ROOT = File.expand_path("..", __dir__)
34
require File.expand_path("../tools/test", COMPONENT_ROOT)
5+
46
exit Minitest.run(ARGV)

0 commit comments

Comments
 (0)