Class: MusicalSpec::Formatter

Inherits:
RSpec::Core::Formatters::ProgressFormatter
  • Object
show all
Defined in:
lib/musical_spec/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter

Returns a new instance of Formatter.



7
8
9
10
11
# File 'lib/musical_spec/formatter.rb', line 7

def initialize(output)
  super(output)
  @note   = Note.new
  @player = Player.new
end

Instance Attribute Details

#playerObject (readonly)

Returns the value of attribute player.



13
14
15
# File 'lib/musical_spec/formatter.rb', line 13

def player
  @player
end

Instance Method Details

#example_failed(example) ⇒ Object

Plays a lower note and then calls super.



22
23
24
25
# File 'lib/musical_spec/formatter.rb', line 22

def example_failed(example)
  play_lower_note
  super(example)
end

#example_passed(example) ⇒ Object

Plays a higher note and then calls super.



16
17
18
19
# File 'lib/musical_spec/formatter.rb', line 16

def example_passed(example)
  play_higher_note
  super(example)
end

#example_pending(example) ⇒ Object

Plays a note without changing the pitch and then calls super.



28
29
30
31
# File 'lib/musical_spec/formatter.rb', line 28

def example_pending(example)
  play_note
  super(example)
end