File: spec_helper.rb

package info (click to toggle)
ruby-listen 3.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 544 kB
  • sloc: ruby: 5,033; makefile: 9
file content (44 lines) | stat: -rw-r--r-- 1,065 bytes parent folder | download | duplicates (2)
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
# frozen_string_literal: true

# TODO: reduce requires everwhere and be more strict about it
require 'listen'

Listen.logger.level = Logger::WARN unless ENV['LISTEN_GEM_DEBUGGING']

def ci?
  ENV['CI']
end

Dir["#{__dir__}/support/**/*.rb"].sort.each { |f| require f }

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
  config.order = :random
  config.filter_run focus: true
  config.run_all_when_everything_filtered = true
  # config.fail_fast = !ci?
  config.expect_with :rspec do |c|
    c.syntax = :expect
  end

  RSpec::Support::ObjectFormatter.default_instance.max_formatted_output_length = 2_000

  config.mock_with :rspec do |mocks|
    mocks.verify_doubled_constant_names = true
    mocks.verify_partial_doubles = true
  end

  config.disable_monkey_patching!
end

module SpecHelpers
  def fake_path(str, options = {})
    instance_double(Pathname, str, { to_s: str, directory?: true }.merge(options))
  end
end

RSpec.configure do |config|
  config.include SpecHelpers
end

Thread.abort_on_exception = true