Class: Apiary::Okapi::Outputs::Tap

Inherits:
BaseOutput show all
Defined in:
lib/okapi/outputs/tap.rb

Instance Attribute Summary

Attributes inherited from BaseOutput

#status

Instance Method Summary collapse

Methods inherited from BaseOutput

#get_fail_result, #get_results, #initialize

Constructor Details

This class inherits a constructor from Apiary::Okapi::Outputs::BaseOutput

Instance Method Details

#error_block(test) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/okapi/outputs/tap.rb', line 34

def error_block(test)
  test[:exp].to_yaml.split(/\n/).each { |line|
    puts "  #{line}"
  }
  puts "  ..."
  
end

#getObject



9
10
11
12
# File 'lib/okapi/outputs/tap.rb', line 9

def get
  get_int
  puts "\n\n"
end

#get_intObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/okapi/outputs/tap.rb', line 14

def get_int
  puts "TAP version 13"
  puts "1..#{@results[:count].to_s}"
  if @results[:give_up]
      puts "Bail out! #{@results[:give_up][:error].to_s.tr("\n"," ")}"
      return
  end
  @results[:tests].each { |test|
    if test[:pass]
      o = 'ok '
    else
      o = 'not ok '
    end
    puts o + test[:test_no].to_s + ' ' + test[:description]
    if not test[:pass]
      error_block(test)
    end
  }      
end