rspec_numbering_formatter 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,14 +3,15 @@ require 'rspec/core/formatters/base_text_formatter'
3
3
  # useful reference: http://ascii-table.com/ansi-escape-sequences.php
4
4
 
5
5
  class RspecNumberingFormatter < RSpec::Core::Formatters::BaseTextFormatter
6
- VERSION = "0.0.2"
6
+ VERSION = "0.0.3"
7
7
 
8
8
  attr_accessor :run_count
9
9
 
10
10
  def failure_color(*args); red(*args); end unless method_defined? :failure_color
11
11
 
12
12
  def start(example_count)
13
- @pwd = `pwd`
13
+ super
14
+ @cwd = `pwd`
14
15
  @start_time = Time.now
15
16
  @run_count = 0
16
17
  super
@@ -24,18 +25,25 @@ class RspecNumberingFormatter < RSpec::Core::Formatters::BaseTextFormatter
24
25
  mins = elapsed / 60
25
26
  elapsed = "#{mins}:#{secs.to_s.rjust(2, '0')}"
26
27
  @run_count += 1
27
- output.print "\r\e[K#{elapsed.rjust(8)} #{@run_count.to_s.rjust(10)} #{example.full_description[0..100].ljust(101)} #{truncate_pwd(example.location)[0..100]}"
28
+ output.print "\r\e[K#{elapsed.rjust(8)} #{@run_count.to_s.rjust(10)} #{example.full_description[0..100].ljust(101)} #{truncate_cwd(example.location)[0..100]}"
28
29
  end
29
30
 
30
31
  def example_failed(example)
31
32
  super
32
33
  @run_count += 1
33
34
  output.puts failure_color("\r\e[K#{@run_count.to_s.rjust(10)} #{example.full_description}")
34
- output.puts failure_color(" #{truncate_pwd example.location}")
35
+ output.puts failure_color(" #{truncate_cwd example.location}")
35
36
  dump_failure_info example
37
+ dump_backtrace example
38
+ output.puts
39
+ end
40
+
41
+ def truncate_cwd str
42
+ str.sub @cwd, ""
36
43
  end
37
44
 
38
- def truncate_pwd str
39
- str.sub @pwd, ""
45
+ def dump_failures
46
+ puts
40
47
  end
48
+
41
49
  end
@@ -14,15 +14,10 @@ describe RspecNumberingFormatter do
14
14
  Failure/Error: (1 + 1).should == 3
15
15
  expected: 3
16
16
  got: 2 (using ==)
17
+ # ./spec/sample-specs/second_spec_sample.rb:5:in `block (2 levels) in <top (required)>'
17
18
 
18
- *ESC[K 0:00 4 second sample should be true ./spec/sample-specs/second_spec_sample.rb:8
19
- Failures:
20
19
 
21
- 1) second sample should include a broken test
22
- Failure/Error: (1 + 1).should == 3
23
- expected: 3
24
- got: 2 (using ==)
25
- # ./spec/sample-specs/second_spec_sample.rb:5:in `block (2 levels) in <top (required)>'
20
+ *ESC[K 0:00 4 second sample should be true ./spec/sample-specs/second_spec_sample.rb:8
26
21
 
27
22
  Finished in some seconds
28
23
  4 examples, 1 failure
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_numbering_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-11 00:00:00.000000000 Z
12
+ date: 2013-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec