Path: blob/trunk/rb/spec/unit/selenium/webdriver/spec_helper.rb
1864 views
# frozen_string_literal: true12# Licensed to the Software Freedom Conservancy (SFC) under one3# or more contributor license agreements. See the NOTICE file4# distributed with this work for additional information5# regarding copyright ownership. The SFC licenses this file6# to you under the Apache License, Version 2.0 (the7# "License"); you may not use this file except in compliance8# with the License. You may obtain a copy of the License at9#10# http://www.apache.org/licenses/LICENSE-2.011#12# Unless required by applicable law or agreed to in writing,13# software distributed under the License is distributed on an14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY15# KIND, either express or implied. See the License for the16# specific language governing permissions and limitations17# under the License.1819begin20require 'debug/session'21DEBUGGER__::CONFIG[:fork_mode] = :parent22DEBUGGER__.open(nonstop: true)23rescue LoadError24# not supported on JRuby and TruffleRuby25end2627require 'rubygems'28require 'time'29require 'rspec'30require 'webmock/rspec'31require 'selenium-webdriver'32require 'securerandom'33require 'pathname'34require_relative '../../../rspec_matchers'3536module Selenium37module WebDriver38module UnitSpecHelper39def with_env(hash)40hash.each { |k, v| ENV[k.to_s] = v.to_s }41yield42ensure43hash.each_key { |k| ENV.delete(k) }44end45end46end47end4849RSpec.configure do |c|50c.define_derived_metadata do |meta|51meta[:aggregate_failures] = true52end53Selenium::WebDriver.logger(ignored: :logger_info)5455root = Pathname.new('../../../../../../').realpath(__FILE__)56$LOAD_PATH.insert(0, root.join('bazel-bin/rb/lib').to_s) if File.exist?(root.join('bazel-bin/rb/lib'))5758c.include Selenium::WebDriver::UnitSpecHelper5960c.filter_run_when_matching :focus61c.run_all_when_everything_filtered = true62c.default_formatter = c.files_to_run.count > 1 ? 'progress' : 'doc'6364c.before do65# https://github.com/ruby/debug/issues/79766allow(File).to receive(:exist?).and_call_original67end68end697071