Module: Bacon

Extended by:
SpecDoxOutput
Defined in:
lib/mac_bacon.rb,
lib/mac_bacon/helpers.rb

Defined Under Namespace

Modules: Helpers, KnockOutput, SpecDoxOutput, TapOutput, TestUnitOutput Classes: Context, Error, Specification

Constant Summary collapse

VERSION =
"1.3"
Counter =
Hash.new(0)
ErrorLog =
""
Shared =
Hash.new { |_, name|
  raise NameError, "no such context: #{name.inspect}"
}
RestrictName =
//
RestrictContext =
//
Backtraces =
true

Class Method Summary collapse

Methods included from SpecDoxOutput

handle_requirement_begin, handle_requirement_end, handle_specification_begin, handle_specification_end, handle_summary, spaces

Class Method Details

.add_context(context) ⇒ Object



304
305
306
# File 'lib/mac_bacon.rb', line 304

def self.add_context(context)
  (@contexts ||= []) << context
end

.context_did_finish(context) ⇒ Object



324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/mac_bacon.rb', line 324

def self.context_did_finish(context)
  handle_specification_end
  Counter[:context_depth] -= 1
  if (@current_context_index + 1) < @contexts.size
    @current_context_index += 1
    run
  else
    # DONE
    handle_summary
    exit(Counter.values_at(:failed, :errors).inject(:+))
  end
end

.current_contextObject



312
313
314
# File 'lib/mac_bacon.rb', line 312

def self.current_context
  @contexts[current_context_index]
end

.current_context_indexObject



308
309
310
# File 'lib/mac_bacon.rb', line 308

def self.current_context_index
  @current_context_index ||= 0
end

.runObject



316
317
318
319
320
321
322
# File 'lib/mac_bacon.rb', line 316

def self.run
  @timer ||= Time.now
  Counter[:context_depth] += 1
  handle_specification_begin(current_context.name)
  current_context.performSelector("run", withObject:nil, afterDelay:0)
  NSApplication.sharedApplication.run
end