File: spec_helper.rb

package info (click to toggle)
ruby-webmock 3.25.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,172 kB
  • sloc: ruby: 12,829; makefile: 6
file content (47 lines) | stat: -rw-r--r-- 1,154 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
require 'rubygems'
require 'httpclient'
unless RUBY_PLATFORM =~ /java/
  require 'curb'
  require 'typhoeus'
end
if RUBY_PLATFORM =~ /java/
  require 'manticore'
end

require 'rspec'
require 'rspec/retry'

require 'webmock/rspec'

require 'support/network_connection'
require 'support/webmock_server'
require 'support/my_rack_app'
require 'support/failures'

Warning[:deprecated] = true if Warning.respond_to?(:[]=)

CURL_EXAMPLE_OUTPUT_PATH = File.expand_path('../support/example_curl_output.txt', __FILE__)

RSpec.configure do |config|
  no_network_connection = ENV["NO_CONNECTION"] || ! NetworkConnection.is_network_available?
  if no_network_connection
    warn("No network connectivity. Only examples which do not make real network connections will run.")
    config.filter_run_excluding net_connect: true
  end

  config.filter_run_excluding without_webmock: true

  config.before(:suite) do
    WebMockServer.instance.start unless WebMockServer.instance.started
  end

  config.after(:suite) do
    WebMockServer.instance.stop
  end

  config.filter_run focus: true
  config.run_all_when_everything_filtered = true

  config.include Failures
end