Module: RSpec::FlakeClassifier::Integrations

Defined in:
lib/rspec/flake/classifier/integrations.rb,
sig/rspec/flake/classifier.rbs

Defined Under Namespace

Modules: BuildkiteCollector, RSpecCovers, RSpecHermetic

Class Method Summary collapse

Class Method Details

.call_first(receivers, methods, *args) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rspec/flake/classifier/integrations.rb', line 37

def call_first(receivers, methods, *args)
  Array(receivers).compact.each do |receiver|
    Array(methods).each do |method_name|
      next unless receiver.respond_to?(method_name)

      value = receiver.public_send(method_name, *args)
      return value if value
    rescue ArgumentError
      next
    end
  end
  nil
end

.constant(name) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/rspec/flake/classifier/integrations.rb', line 20

def constant(name)
  name.to_s.split("::").reduce(Object) do |namespace, const_name|
    return nil unless namespace.const_defined?(const_name, false)

    namespace.const_get(const_name, false)
  end
rescue NameError
  nil
end

.coverage_for(example) ⇒ Object

Parameters:

  • example (Object)

Returns:

  • (Object)


8
9
10
# File 'lib/rspec/flake/classifier/integrations.rb', line 8

def coverage_for(example)
  RSpecCovers.coverage_for(example)
end

.probe_for(example) ⇒ Object

Parameters:

  • example (Object)

Returns:

  • (Object)


12
13
14
# File 'lib/rspec/flake/classifier/integrations.rb', line 12

def probe_for(example)
  RSpecHermetic.probe_for(example)
end

.tag_ci_execution(example:, signature:, classification:) ⇒ void

This method returns an undefined value.

Parameters:

  • example: (Object)
  • signature: (Signature)
  • classification: (Object)


16
17
18
# File 'lib/rspec/flake/classifier/integrations.rb', line 16

def tag_ci_execution(example:, signature:, classification:)
  BuildkiteCollector.tag_execution(example: example, signature: signature, classification: classification)
end

.try_require(feature) ⇒ Object



30
31
32
33
34
35
# File 'lib/rspec/flake/classifier/integrations.rb', line 30

def try_require(feature)
  require feature
  true
rescue LoadError
  false
end