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.2.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



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

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

.context_did_finish(context) ⇒ Object



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

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



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

def self.current_context
  @contexts[current_context_index]
end

.current_context_indexObject



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

def self.current_context_index
  @current_context_index ||= 0
end

.runObject



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

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