summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb43
1 files changed, 7 insertions, 36 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index bce3eff..4a9c15e 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,44 +1,15 @@
-ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), ".."))
-
-require 'rspec/its'
-
require 'simplecov'
SimpleCov.start
-require 'vcr'
-require 'webmock'
-require 'webrick'
-
-VCR.configure do |c|
- c.cassette_library_dir = 'spec/vcr_cassettes'
- c.hook_into :webmock
- c.configure_rspec_metadata!
-end
+require 'gitlab_init'
-# like WEBrick::HTTPServer, but listens on UNIX socket
-class HTTPUNIXServer < WEBrick::HTTPServer
- def listen(address, port)
- socket = Socket.unix_server_socket(address)
- socket.autoclose = false
- server = UNIXServer.for_fd(socket.fileno)
- socket.close
- @listeners << server
- end
+Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f }
- # Workaround:
- # https://bugs.ruby-lang.org/issues/10956
- # Affecting Ruby 2.2
- # Fix for 2.2 is at https://github.com/ruby/ruby/commit/ab0a64e1
- # However, this doesn't work with 2.1. The following should work for both:
- def start(&block)
- @shutdown_pipe = IO.pipe
- shutdown_pipe = @shutdown_pipe
- super(&block)
- end
+RSpec.configure do |config|
+ config.run_all_when_everything_filtered = true
+ config.filter_run :focus
- def cleanup_shutdown_pipe(shutdown_pipe)
- @shutdown_pipe = nil
- return if !shutdown_pipe
- super(shutdown_pipe)
+ config.before(:each) do
+ stub_const('ROOT_PATH', File.expand_path('..', __dir__))
end
end