Class: RSpec::CentaurPride

Inherits:
Pride
  • Object
show all
Defined in:
lib/rspec/centaur_pride.rb

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ CentaurPride

Returns a new instance of CentaurPride.



6
7
8
9
# File 'lib/rspec/centaur_pride.rb', line 6

def initialize io
  super
  @centaur = String::CENTAUR.chomp
end

Instance Method Details

#draw_centaur_with(arg) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rspec/centaur_pride.rb', line 11

def draw_centaur_with arg
  if @centaur.empty? #draw centaurs until we run out of characters dots (specs)
    @centaur = "\n" + String::CENTAUR.chomp
  end

  # Print char (space) unless it is an 'x'
  while char = @centaur.slice!(0)
    break if char == 'x'
    output.print(char)
  end

  output.print(arg)
end

#example_failed(example) ⇒ Object



29
30
31
# File 'lib/rspec/centaur_pride.rb', line 29

def example_failed example
 draw_centaur_with failure
end

#example_passed(example) ⇒ Object



25
26
27
# File 'lib/rspec/centaur_pride.rb', line 25

def example_passed example
  draw_centaur_with pass
end

#example_pending(example) ⇒ Object



33
34
35
# File 'lib/rspec/centaur_pride.rb', line 33

def example_pending example
  draw_centaur_with pending
end