Sha256: ab58470c77c46e9cb2ae661f3b095e2b80f14d2e2ed33cffc2331e075fd60787

Contents?: true

Size: 895 Bytes

Versions: 5

Compression:

Stored size: 895 Bytes

Contents

require "#{File.dirname(__FILE__)}/base.rb"
require 'yaml'

module Apiary
  module Okapi
   module Outputs
     class Tap < Apiary::Okapi::Outputs::BaseOutput

       def get
         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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
okapi-0.0.6 lib/okapi/outputs/tap.rb
okapi-0.0.5 lib/okapi/outputs/tap.rb
okapi-0.0.4 lib/okapi/outputs/tap.rb
okapi-0.0.3 lib/okapi/outputs/tap.rb
okapi-0.0.2 lib/okapi/outputs/tap.rb