Debian Codegraph @

src/ruby/spec/spec_helper.rb

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
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.unshift(lib_dir)
21 $LOAD_PATH.uniq!
22
23 # set up coverage
24 require 'simplecov'
25 SimpleCov.start do
26 add_filter 'spec'
27 add_filter 'bin'
28 SimpleCov.command_name ENV['COVERAGE_NAME']
29 end if ENV['COVERAGE_NAME']
30
31 require 'rspec'
32 require 'logging'
33 require 'rspec/logging_helper'
34 require 'grpc'
35
36 require_relative 'support/services'
37 require_relative 'support/helpers'
38
39 # GRPC is the general RPC module
40 #
41 # Configure its logging for fine-grained log control during test runs
42 module GRPC
43 extend Logging.globally
44 end
45 Logging.logger.root.appenders = Logging.appenders.stdout
46 Logging.logger.root.level = :info
47 Logging.logger['GRPC'].level = :info
48 Logging.logger['GRPC::ActiveCall'].level = :info
49 Logging.logger['GRPC::BidiCall'].level = :info
50
51 # Configure RSpec to capture log messages for each test. The output from the
52 # logs will be stored in the @log_output variable. It is a StringIO instance.
53 RSpec.configure do |config|
54 include RSpec::LoggingHelper
55 config.capture_log_messages # comment this out to see logs during test runs
56 include GRPC::Spec::Helpers
57 end
58
59 RSpec::Expectations.configuration.warn_about_potential_false_positives = false
60
61 Thread.abort_on_exception = true