Class: Minitest::Sound::Reporter

Inherits:
StatisticsReporter
  • Object
show all
Defined in:
lib/minitest/sound/reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(io = $stdout, options = {}) ⇒ Reporter

Returns a new instance of Reporter.



6
7
8
9
10
11
12
# File 'lib/minitest/sound/reporter.rb', line 6

def initialize(io = $stdout, options = {})
  super(io, options)
  @player = Minitest::Sound::Player.new(
    success: Minitest::Sound.success, failure: Minitest::Sound.failure,
    during_test: Minitest::Sound.during_test,
  )
end

Instance Method Details

#add_defaults(defaults) ⇒ Object

When using the following methods together with minitest-reporters, they are required.



31
# File 'lib/minitest/sound/reporter.rb', line 31

def add_defaults(defaults); end

#after_test(test) ⇒ Object



35
# File 'lib/minitest/sound/reporter.rb', line 35

def after_test(test); end

#before_test(test) ⇒ Object



33
# File 'lib/minitest/sound/reporter.rb', line 33

def before_test(test); end

#reportObject



19
20
21
22
23
# File 'lib/minitest/sound/reporter.rb', line 19

def report
  super
  @player.stop_during_test_sound
   test_success? ? @player.play_success_sound : @player.play_failure_sound
end

#startObject



14
15
16
17
# File 'lib/minitest/sound/reporter.rb', line 14

def start
  super
  @player.play_during_test_sound
end

#test_success?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/minitest/sound/reporter.rb', line 25

def test_success?
  errors == 0 && failures == 0
end