Class: RspecAbhakungszeichenFormatter

Inherits:
RSpec::Core::Formatters::BaseTextFormatter
  • Object
show all
Defined in:
lib/rspec-abhakungszeichen-formatter/formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ RspecAbhakungszeichenFormatter

Returns a new instance of RspecAbhakungszeichenFormatter.



4
5
6
7
8
# File 'lib/rspec-abhakungszeichen-formatter/formatter.rb', line 4

def initialize(output)
  super(output)

  @level = 0
end

Instance Method Details

#example_failed(proxy) ⇒ Object



18
19
20
# File 'lib/rspec-abhakungszeichen-formatter/formatter.rb', line 18

def example_failed(proxy)
  puts color("#{pad} \u2717 #{proxy.description}", :red)
end

#example_group_finished(example_group) ⇒ Object



27
28
29
# File 'lib/rspec-abhakungszeichen-formatter/formatter.rb', line 27

def example_group_finished(example_group)
  @level -= 1
end

#example_group_started(example_group) ⇒ Object



22
23
24
25
# File 'lib/rspec-abhakungszeichen-formatter/formatter.rb', line 22

def example_group_started(example_group)
  puts "#{pad} #{example_group.description}:"
  @level += 1
end

#example_passed(proxy) ⇒ Object



10
11
12
# File 'lib/rspec-abhakungszeichen-formatter/formatter.rb', line 10

def example_passed(proxy)
  puts color("#{pad} \u2713 #{proxy.description}", :green)
end

#example_pending(proxy) ⇒ Object



14
15
16
# File 'lib/rspec-abhakungszeichen-formatter/formatter.rb', line 14

def example_pending(proxy)
  puts color("#{pad} \u2729 #{proxy.description}", :yellow)
end

#padObject



31
32
33
# File 'lib/rspec-abhakungszeichen-formatter/formatter.rb', line 31

def pad
  ' ' * @level * 2
end