Class: RSpec::Hermetic::Verdict

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/hermetic/verdict.rb

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ Verdict

Returns a new instance of Verdict.



16
17
18
# File 'lib/rspec/hermetic/verdict.rb', line 16

def initialize(configuration)
  @configuration = configuration
end

Instance Method Details

#call(change_set, example_allowances: []) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rspec/hermetic/verdict.rb', line 20

def call(change_set, example_allowances: [])
  pollutions = []
  warnings = []
  ignored = []

  change_set.changes.each do |change|
    if @configuration.allowlist.allowed?(change, example_allowances)
      ignored << change
    elsif @configuration.allowlist.append_only?(change) && change.append_only?
      warnings << change
    else
      pollutions << change
    end
  end

  Result.new(pollutions: pollutions, warnings: warnings, ignored: ignored)
end