Module: Bacon

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

Defined Under Namespace

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

Constant Summary collapse

VERSION =
"1.1"
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



216
217
218
# File 'lib/mac_bacon.rb', line 216

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

.context_did_finish(context) ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/mac_bacon.rb', line 236

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
    NSApplication.sharedApplication.terminate(self)
  end
end

.current_contextObject



224
225
226
# File 'lib/mac_bacon.rb', line 224

def self.current_context
  @contexts[current_context_index]
end

.current_context_indexObject



220
221
222
# File 'lib/mac_bacon.rb', line 220

def self.current_context_index
  @current_context_index ||= 0
end

.runObject



228
229
230
231
232
233
234
# File 'lib/mac_bacon.rb', line 228

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