rspec_numbering_formatter 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +9 -0
- data/lib/rspec_numbering_formatter.rb +13 -14
- data/rspec_numbering_formatter.gemspec +1 -1
- data/spec/rspec_numbering_formatter_spec.rb +19 -10
- data/spec/sample-specs/first_spec_sample.rb +2 -2
- data/spec/sample-specs/second_spec_sample.rb +2 -2
- data/spec/sample_spec_helper.rb +0 -1
- data/spec/spec_helper.rb +0 -1
- metadata +15 -19
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 451efeed770138459a2eda9d3b2677ad06b75838
|
4
|
+
data.tar.gz: 50c95304734a7714d81c856c4c8930566af0a5da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 13078e2c13fa517020c4c10d576ab4bc735afae4986cabae77824b6cdd2be0d7fbba34e3fbaca6e7e7271c92edce04b51ec08e6459616cef8e1058b47615e8a7
|
7
|
+
data.tar.gz: bb16d76fa3fe1ba834b0b99355841ca2c6f37a0940aea92c298c2fdf111d1a494be20079367622cfd65b1431877c53ae5fb85f70f0fc545f294139d36479da70
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
An rspec formatter that shows elapsed time, example count, example description, and example location, with no scrolling except for errors.
|
4
4
|
|
5
|
+
Compatible with rspec 3.1
|
6
|
+
|
5
7
|
Output looks something like this:
|
6
8
|
|
7
9
|
$ rspec spec --format RspecNumberingFormatter
|
@@ -31,6 +33,9 @@ Note: (seriously) if your main project has 6,000 rspec examples, like mine does,
|
|
31
33
|
pathological, and you should probably refactor, as I should. This formatter can help you cope
|
32
34
|
while you're waiting for the doctor.
|
33
35
|
|
36
|
+
Note: this formatter is less helpful when used together with parallel_tests. Everything still
|
37
|
+
works, but you lose that smooth satisfying sense of progress because you're getting output from
|
38
|
+
N threads all on top of each other at once.
|
34
39
|
|
35
40
|
## Installation
|
36
41
|
|
@@ -53,6 +58,10 @@ Run rspec thus:
|
|
53
58
|
|
54
59
|
Enjoy the immediate boost to your productivity.
|
55
60
|
|
61
|
+
## History
|
62
|
+
|
63
|
+
0.1.0: upgrade to depend on rspec 3.1
|
64
|
+
|
56
65
|
## Contributing
|
57
66
|
|
58
67
|
1. Fork it
|
@@ -1,40 +1,39 @@
|
|
1
|
+
require 'rspec/core'
|
1
2
|
require 'rspec/core/formatters/base_text_formatter'
|
2
3
|
|
3
4
|
# useful reference: http://ascii-table.com/ansi-escape-sequences.php
|
4
5
|
|
5
6
|
class RspecNumberingFormatter < RSpec::Core::Formatters::BaseTextFormatter
|
6
|
-
VERSION = "0.0
|
7
|
+
VERSION = "0.1.0"
|
8
|
+
RSpec::Core::Formatters.register self, :start, :example_passed, :example_failed
|
7
9
|
|
8
10
|
attr_accessor :run_count
|
9
11
|
|
10
12
|
def failure_color(*args); red(*args); end unless method_defined? :failure_color
|
11
13
|
|
12
|
-
def start(
|
14
|
+
def start(notification)
|
13
15
|
super
|
14
16
|
@cwd = `pwd`
|
15
17
|
@start_time = Time.now
|
16
18
|
@run_count = 0
|
17
|
-
|
18
|
-
output.puts "#{example_count} examples"
|
19
|
+
output.puts "#{notification.count} examples"
|
19
20
|
end
|
20
21
|
|
21
|
-
def example_passed(
|
22
|
-
super
|
22
|
+
def example_passed(notification)
|
23
23
|
elapsed = (Time.now - @start_time).to_i
|
24
24
|
secs = elapsed % 60
|
25
25
|
mins = elapsed / 60
|
26
26
|
elapsed = "#{mins}:#{secs.to_s.rjust(2, '0')}"
|
27
27
|
@run_count += 1
|
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
|
+
output.print "\r\e[K#{elapsed.rjust(8)} #{@run_count.to_s.rjust(10)} #{notification.example.full_description[0..100].ljust(101)} #{truncate_cwd(notification.example.location)[0..100]}"
|
29
29
|
end
|
30
30
|
|
31
|
-
def example_failed(
|
32
|
-
super
|
31
|
+
def example_failed(notification)
|
33
32
|
@run_count += 1
|
34
|
-
output.puts
|
35
|
-
output.puts
|
36
|
-
|
37
|
-
|
33
|
+
output.puts "\r\e[K#{@run_count.to_s.rjust(10)} #{notification.example.full_description}"
|
34
|
+
output.puts " #{truncate_cwd notification.example.location}"
|
35
|
+
output.puts notification.colorized_message_lines
|
36
|
+
output.puts notification.colorized_formatted_backtrace
|
38
37
|
output.puts
|
39
38
|
end
|
40
39
|
|
@@ -42,7 +41,7 @@ class RspecNumberingFormatter < RSpec::Core::Formatters::BaseTextFormatter
|
|
42
41
|
str.sub @cwd, ""
|
43
42
|
end
|
44
43
|
|
45
|
-
def dump_failures
|
44
|
+
def dump_failures notification
|
46
45
|
puts
|
47
46
|
end
|
48
47
|
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.summary = %q{ RSpec formatter with more information in less space }
|
16
16
|
gem.homepage = "https://github.com/conanite/rspec_numbering_formatter"
|
17
17
|
|
18
|
-
gem.add_development_dependency 'rspec', '~>
|
18
|
+
gem.add_development_dependency 'rspec', '~> 3.1'
|
19
19
|
|
20
20
|
gem.files = `git ls-files`.split($/)
|
21
21
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -3,28 +3,37 @@ require 'spec_helper'
|
|
3
3
|
describe RspecNumberingFormatter do
|
4
4
|
it "should produce helpful output" do
|
5
5
|
rspec_command = 'bundle exec rspec spec/sample-specs --format RspecNumberingFormatter -P "**/*_spec_sample.rb" 2>&1'
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
putout = `#{rspec_command}`
|
7
|
+
putout = putout.
|
8
|
+
gsub(/Finished in \d+.\d+ seconds/, 'Finished in some seconds').
|
9
|
+
gsub(/files took \d+.\d+ seconds to load/, 'files took AGES to load').
|
10
|
+
gsub(/\r/, "\n*").
|
11
|
+
gsub(/\e/, 'ESC').
|
12
|
+
split(/\n/).
|
13
|
+
map { |line| line.rstrip }.
|
14
|
+
join("\n")
|
15
|
+
expect(putout).to eq "4 examples
|
9
16
|
|
10
17
|
*ESC[K 0:00 1 first should be nil ./spec/sample-specs/first_spec_sample.rb:4
|
11
18
|
*ESC[K 0:00 2 first should be non-nil ./spec/sample-specs/first_spec_sample.rb:8
|
12
19
|
*ESC[K 3 second sample should include a broken test
|
13
20
|
./spec/sample-specs/second_spec_sample.rb:4
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
21
|
+
Failure/Error: expect((1 + 1)).to eq 3
|
22
|
+
|
23
|
+
expected: 3
|
24
|
+
got: 2
|
25
|
+
|
26
|
+
(compared using ==)
|
27
|
+
# ./spec/sample-specs/second_spec_sample.rb:5:in `block (2 levels) in <top (required)>'
|
18
28
|
|
19
29
|
|
20
30
|
*ESC[K 0:00 4 second sample should be true ./spec/sample-specs/second_spec_sample.rb:8
|
21
31
|
|
22
|
-
Finished in some seconds
|
32
|
+
Finished in some seconds (files took AGES to load)
|
23
33
|
4 examples, 1 failure
|
24
34
|
|
25
35
|
Failed examples:
|
26
36
|
|
27
|
-
rspec ./spec/sample-specs/second_spec_sample.rb:4 # second sample should include a broken test
|
28
|
-
"
|
37
|
+
rspec ./spec/sample-specs/second_spec_sample.rb:4 # second sample should include a broken test"
|
29
38
|
end
|
30
39
|
end
|
data/spec/sample_spec_helper.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,42 +1,39 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_numbering_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Conan Dalton
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-09-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '3.1'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
description:
|
31
|
-
description, and example location, with no scrolling except for errors.
|
26
|
+
version: '3.1'
|
27
|
+
description: " An rspec formatter that shows elapsed time, example count, example
|
28
|
+
description, and example location, with no scrolling except for errors. "
|
32
29
|
email:
|
33
30
|
- conan@conandalton.net
|
34
31
|
executables: []
|
35
32
|
extensions: []
|
36
33
|
extra_rdoc_files: []
|
37
34
|
files:
|
38
|
-
- .gitignore
|
39
|
-
- .rspec
|
35
|
+
- ".gitignore"
|
36
|
+
- ".rspec"
|
40
37
|
- Gemfile
|
41
38
|
- LICENSE.txt
|
42
39
|
- README.md
|
@@ -51,27 +48,26 @@ files:
|
|
51
48
|
homepage: https://github.com/conanite/rspec_numbering_formatter
|
52
49
|
licenses:
|
53
50
|
- MIT
|
51
|
+
metadata: {}
|
54
52
|
post_install_message:
|
55
53
|
rdoc_options: []
|
56
54
|
require_paths:
|
57
55
|
- lib
|
58
56
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
57
|
requirements:
|
61
|
-
- -
|
58
|
+
- - ">="
|
62
59
|
- !ruby/object:Gem::Version
|
63
60
|
version: '0'
|
64
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
62
|
requirements:
|
67
|
-
- -
|
63
|
+
- - ">="
|
68
64
|
- !ruby/object:Gem::Version
|
69
65
|
version: '0'
|
70
66
|
requirements: []
|
71
67
|
rubyforge_project:
|
72
|
-
rubygems_version:
|
68
|
+
rubygems_version: 2.2.2
|
73
69
|
signing_key:
|
74
|
-
specification_version:
|
70
|
+
specification_version: 4
|
75
71
|
summary: RSpec formatter with more information in less space
|
76
72
|
test_files:
|
77
73
|
- spec/rspec_numbering_formatter_spec.rb
|