summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-08-14 15:07:36 -0500
committerRobert Speicher <rspeicher@gmail.com>2018-08-15 16:04:25 -0500
commit69d39094744b2b5f408b67b7def97a66853deaf3 (patch)
tree5e7908edbccfdf6a0319749d19d0fecae8b85df4
parentb9d086e9dbcbd238426b10069d621c5af0f87ac8 (diff)
downloadgitlab-shell-69d39094744b2b5f408b67b7def97a66853deaf3.tar.gz
Override `ROOT_PATH` in specs in a less insane way
-rw-r--r--lib/gitlab_init.rb2
-rw-r--r--spec/spec_helper.rb8
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/gitlab_init.rb b/lib/gitlab_init.rb
index c3f35a2..2767a62 100644
--- a/lib/gitlab_init.rb
+++ b/lib/gitlab_init.rb
@@ -1,3 +1,3 @@
-ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), ".."))
+ROOT_PATH = File.expand_path('..', __dir__)
require_relative 'gitlab_config'
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index d93f88d..7b7b1b7 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,5 +1,3 @@
-ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), ".."))
-
require 'simplecov'
SimpleCov.start
@@ -13,6 +11,12 @@ VCR.configure do |c|
c.configure_rspec_metadata!
end
+RSpec.configure do |config|
+ config.before(:each) do
+ stub_const('ROOT_PATH', File.expand_path('..', __dir__))
+ end
+end
+
# like WEBrick::HTTPServer, but listens on UNIX socket
class HTTPUNIXServer < WEBrick::HTTPServer
def listen(address, port)