Sha256: b2123d09957cc70662a3607bf40a0f891531ff6a713be12135af0978fbb102b8

Contents?: true

Size: 790 Bytes

Versions: 2

Compression:

Stored size: 790 Bytes

Contents

module Rgot
  class T < Common
    def initialize(test_module, name)
      super()
      @module = test_module
      @name = name
      @module.extend @module
    end

    def run
      begin
        catch(:skip) { call }
        finish!
      rescue => e
        fail!
        report
        raise e
      end
    end

    def report
      duration = Rgot.now - @start
      template = "--- %s: %s (%.5fs)\n%s"
      if failed?
        printf template, "FAIL", @name, duration, @output
      elsif Rgot.verbose?
        if skipped?
          printf template, "SKIP", @name, duration, @output
        else
          printf template, "PASS", @name, duration, @output
        end
      end
    end

    def call
      @module.instance_method(@name).bind(@module).call(self)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rgot-0.1.1 lib/rgot/t.rb
rgot-0.1.0 lib/rgot/t.rb