Class: Jasmine::Formatters::Console

Inherits:
Object
  • Object
show all
Defined in:
lib/jasmine/formatters/console.rb

Instance Method Summary collapse

Constructor Details

#initialize(config, outputter = Kernel) ⇒ Console

Returns a new instance of Console.



4
5
6
7
8
# File 'lib/jasmine/formatters/console.rb', line 4

def initialize(config, outputter = Kernel)
  @config = config
  @results = []
  @outputter = outputter
end

Instance Method Details

#done(run_details) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/jasmine/formatters/console.rb', line 15

def done(run_details)
  outputter.puts

  run_result = global_failure_details(run_details)

  failure_count = results.count(&:failed?)
  if failure_count > 0
    outputter.puts('Failures:')
    outputter.puts(failures(@results))
    outputter.puts
  end

  pending_count = results.count(&:pending?)
  if pending_count > 0
    outputter.puts('Pending:')
    outputter.puts(pending(@results))
    outputter.puts
  end

  deprecationWarnings = (@results + [run_result]).map(&:deprecation_warnings).flatten
  if deprecationWarnings.size > 0
    outputter.puts('Deprecations:')
    outputter.puts(deprecations(deprecationWarnings))
    outputter.puts
  end

  summary = "#{pluralize(results.size, 'spec')}, " +
    "#{pluralize(failure_count, 'failure')}"

  summary += ", #{pluralize(pending_count, 'pending spec')}" if pending_count > 0

  outputter.puts(summary)

  if run_details['overallStatus'] == 'incomplete'
    outputter.puts("Incomplete: #{run_details['incompleteReason']}")
  end

  if run_details['order'] && run_details['order']['random']
    seed = run_details['order']['seed']
    outputter.puts("Randomized with seed #{seed} \(rake jasmine:ci\[true,#{seed}])")
  end
end

#format(results_batch) ⇒ Object



10
11
12
13
# File 'lib/jasmine/formatters/console.rb', line 10

def format(results_batch)
  outputter.print(chars(results_batch))
  @results += results_batch
end