Sha256: e610e22cce418b568ef8e0396e8cd082ec1d6c1d597cd29ef7750464f63dd8f9

Contents?: true

Size: 977 Bytes

Versions: 8

Compression:

Stored size: 977 Bytes

Contents

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

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

       def get
         get_int
         puts "\n\n"
       end
       
       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

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

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
honey-0.0.6 lib/okapi/outputs/tap.rb
apiaryio-0.0.5 lib/okapi/outputs/tap.rb
apiaryio-0.0.4 lib/okapi/outputs/tap.rb
apiaryio-0.0.3 lib/okapi/outputs/tap.rb
okapi-0.1.0 lib/okapi/outputs/tap.rb
okapi-0.0.9 lib/okapi/outputs/tap.rb
okapi-0.0.8 lib/okapi/outputs/tap.rb
okapi-0.0.7 lib/okapi/outputs/tap.rb