Debian Codegraph @

src/ruby/spec/spec_helper.rb

raw ◀ ▶
1 Debian patch touch this file
1 # Copyright 2015 gRPC authors.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 spec_dir = File.expand_path(File.dirname(__FILE__))
16 root_dir = File.expand_path(File.join(spec_dir, '..'))
17 lib_dir = File.expand_path(File.join(root_dir, 'lib'))
18
19 $LOAD_PATH.unshift(spec_dir)
20 $LOAD_PATH.uniq!
21
22 # set up coverage
23 require 'simplecov'
24 SimpleCov.start do
25 add_filter 'spec'
26 add_filter 'bin'
27 SimpleCov.command_name ENV['COVERAGE_NAME']
28 end if ENV['COVERAGE_NAME']
29
30 require 'rspec'
31 require 'logging'
32 require 'rspec/logging_helper'
33 require 'grpc'
34
35 require_relative 'support/services'
36 require_relative 'support/helpers'
37
38 # GRPC is the general RPC module
39 #
40 # Configure its logging for fine-grained log control during test runs
41 module GRPC
42 extend Logging.globally
43 end
44 Logging.logger.root.appenders = Logging.appenders.stdout
45 Logging.logger.root.level = :info
46 Logging.logger['GRPC'].level = :info
47 Logging.logger['GRPC::ActiveCall'].level = :info
48 Logging.logger['GRPC::BidiCall'].level = :info
49
50 # Configure RSpec to capture log messages for each test. The output from the
51 # logs will be stored in the @log_output variable. It is a StringIO instance.
52 RSpec.configure do |config|
53 include RSpec::LoggingHelper
54 config.capture_log_messages # comment this out to see logs during test runs
55 include GRPC::Spec::Helpers
56 end
57
58 RSpec::Expectations.configuration.warn_about_potential_false_positives = false
59
60 Thread.abort_on_exception = true