Class: RSpec::DescriptionConsistency::Reporter

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/description_consistency/reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(output_stream:) ⇒ Reporter

Returns a new instance of Reporter.



6
7
8
# File 'lib/rspec/description_consistency/reporter.rb', line 6

def initialize(output_stream:)
  @output_stream = output_stream
end

Instance Method Details

#report(state) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rspec/description_consistency/reporter.rb', line 10

def report(state)
  return if state.data.empty?

  output_stream << <<~TXT
    RSpec::DescriptionConsistency detected the following potential inconsistencies:

  TXT

  state.data.each do |key, value|
    output_stream.puts format_violation_entry(key, value)
  end
end