summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/templates/newgem/newgem.gemspec.tt4
-rw-r--r--lib/bundler/templates/newgem/test/test_helper.rb.tt4
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/bundler/templates/newgem/newgem.gemspec.tt b/lib/bundler/templates/newgem/newgem.gemspec.tt
index 991d645cc6..116bb5fa62 100644
--- a/lib/bundler/templates/newgem/newgem.gemspec.tt
+++ b/lib/bundler/templates/newgem/newgem.gemspec.tt
@@ -1,8 +1,10 @@
<%- if RUBY_VERSION < "2.0.0" -%>
# coding: utf-8
-<%- end -%>
lib = File.expand_path("../lib", __FILE__)
+<%- else -%>
+lib = File.expand_path("lib", __dir__)
+<%- end -%>
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "<%= config[:namespaced_path] %>/version"
diff --git a/lib/bundler/templates/newgem/test/test_helper.rb.tt b/lib/bundler/templates/newgem/test/test_helper.rb.tt
index 725e3e4647..335c4704ec 100644
--- a/lib/bundler/templates/newgem/test/test_helper.rb.tt
+++ b/lib/bundler/templates/newgem/test/test_helper.rb.tt
@@ -1,4 +1,8 @@
+<%- if RUBY_VERSION < "2.0.0" -%>
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
+<%- else -%>
+$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
+<%- end -%>
require "<%= config[:namespaced_path] %>"
require "minitest/autorun"