Method: MSpecOptions#formatters

Defined in:
lib/mspec/utils/options.rb

#formattersObject



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/mspec/utils/options.rb', line 271

def formatters
  on("-f", "--format", "FORMAT",
     "Formatter for reporting, where FORMAT is one of:") do |o|
    case o
    when 's', 'spec', 'specdoc'
      config[:formatter] = SpecdocFormatter
    when 'h', 'html'
      config[:formatter] = HtmlFormatter
    when 'd', 'dot', 'dotted'
      config[:formatter] = DottedFormatter
    when 'b', 'describe'
      config[:formatter] = DescribeFormatter
    when 'f', 'file'
      config[:formatter] = FileFormatter
    when 'u', 'unit', 'unitdiff'
      config[:formatter] = UnitdiffFormatter
    when 'm', 'summary'
      config[:formatter] = SummaryFormatter
    when 'a', '*', 'spin'
      config[:formatter] = SpinnerFormatter
    when 't', 'method'
      config[:formatter] = MethodFormatter
    when 'y', 'yaml'
      config[:formatter] = YamlFormatter
    when 'p', 'profile'
      config[:formatter] = ProfileFormatter
    when 'j', 'junit'
      config[:formatter] = JUnitFormatter
    else
      puts "Unknown format: #{o}"
      puts @parser
      exit
    end
  end

  doc ""
  doc "       s, spec, specdoc         SpecdocFormatter"
  doc "       h, html,                 HtmlFormatter"
  doc "       d, dot, dotted           DottedFormatter"
  doc "       f, file                  FileFormatter"
  doc "       u, unit, unitdiff        UnitdiffFormatter"
  doc "       m, summary               SummaryFormatter"
  doc "       a, *, spin               SpinnerFormatter"
  doc "       t, method                MethodFormatter"
  doc "       y, yaml                  YamlFormatter"
  doc "       p, profile               ProfileFormatter"
  doc "       j, junit                 JUnitFormatter\n"

  on("-o", "--output", "FILE",
     "Write formatter output to FILE") do |f|
    config[:output] = f
  end
end