rspec_overview 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -5
- data/README.md +33 -39
- data/lib/rspec_overview.rb +0 -2
- data/lib/rspec_overview/formatter.rb +5 -5
- data/lib/rspec_overview/formatter_csv.rb +2 -1
- data/lib/rspec_overview/output/csv.rb +14 -6
- data/lib/rspec_overview/output/markdown_table.rb +56 -0
- data/lib/rspec_overview/version.rb +1 -1
- data/rspec_overview.gemspec +0 -1
- metadata +3 -17
- data/lib/rspec_overview/output/table.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 287a96d1c9135913ae99f63bd6e8ef9128f2c11d
|
4
|
+
data.tar.gz: 5c11b17f834b44e79e296cd361255834cabea3ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31a462e3d5b8a5a002aff2c05ead867a4b095a0b920abab8482b6613b41b112685c3a0ea47215b550b5ee6204bbaaa32827182c35c2a59297c8fef9b95c15bf4
|
7
|
+
data.tar.gz: c7de28741f24ed646d18cad7fe2ee7a3003afebc340a0060b1ac5340666a7610344a9e8ced8e4427212cfdb062fcf3b49ff471de93e7c2f86a721e1e09619bc2
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec_overview (0.
|
4
|
+
rspec_overview (0.3.0)
|
5
5
|
rspec-core (~> 3.0)
|
6
|
-
terminal-table (~> 1.6)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -32,9 +31,6 @@ GEM
|
|
32
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
33
32
|
rspec-support (~> 3.7.0)
|
34
33
|
rspec-support (3.7.0)
|
35
|
-
terminal-table (1.8.0)
|
36
|
-
unicode-display_width (~> 1.1, >= 1.1.1)
|
37
|
-
unicode-display_width (1.3.0)
|
38
34
|
|
39
35
|
PLATFORMS
|
40
36
|
ruby
|
data/README.md
CHANGED
@@ -45,52 +45,46 @@ Run against [thoughtbot/administrate][administrate]:
|
|
45
45
|
[administrate]: https://github.com/thoughtbot/administrate
|
46
46
|
|
47
47
|
```
|
48
|
-
Randomized with seed
|
49
|
-
................................................................................
|
48
|
+
Randomized with seed 16132
|
50
49
|
................................................................................
|
51
50
|
................................................................................
|
52
51
|
................................................................................
|
53
|
-
|
52
|
+
......................................................................
|
53
|
+
|
54
|
+
Finished in 15.03 seconds (files took 6.02 seconds to load)
|
55
|
+
310 examples, 0 failures
|
54
56
|
|
55
|
-
|
56
|
-
363 examples, 0 failures
|
57
|
+
# Summary by Type or Subfolder
|
57
58
|
|
58
|
-
+---------------------+---------------+--------------+-------------------------+
|
59
|
-
| Summary by Type or Subfolder |
|
60
|
-
+---------------------+---------------+--------------+-------------------------+
|
61
59
|
| Type or Subfolder | Example count | Duration (s) | Average per example (s) |
|
62
|
-
|
63
|
-
| feature |
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
| ./spec/i18n_spec.rb | 2 | 0.
|
68
|
-
|
|
69
|
-
| model | 28 | 0.
|
70
|
-
| ./spec/administrate | 5 | 0.
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
+-------------------------------------------------------------+---------------+--------------+-------------------------+
|
60
|
+
|---------------------|---------------|--------------|-------------------------|
|
61
|
+
| feature | 72 | 9.28 | 0.12889 |
|
62
|
+
| generator | 65 | 1.83 | 0.0282 |
|
63
|
+
| controller | 32 | 1.69 | 0.05293 |
|
64
|
+
| view | 14 | 0.68246 | 0.04875 |
|
65
|
+
| ./spec/i18n_spec.rb | 2 | 0.58921 | 0.2946 |
|
66
|
+
| ./spec/lib | 79 | 0.33908 | 0.00429 |
|
67
|
+
| model | 28 | 0.29078 | 0.01038 |
|
68
|
+
| ./spec/administrate | 5 | 0.03813 | 0.00763 |
|
69
|
+
| ./spec/dashboards | 9 | 0.024 | 0.00267 |
|
70
|
+
| helper | 4 | 0.01062 | 0.00265 |
|
71
|
+
|
72
|
+
|
73
|
+
# Summary by File
|
74
|
+
|
78
75
|
| File | Example count | Duration (s) | Average per example (s) |
|
79
|
-
|
80
|
-
| ./spec/features/index_page_spec.rb | 11 | 2.
|
81
|
-
| ./spec/controllers/admin/
|
82
|
-
| ./spec/features/
|
83
|
-
| ./spec/
|
84
|
-
| ./spec/
|
85
|
-
| ./spec/
|
86
|
-
| ./spec/
|
87
|
-
| ./spec/features/
|
88
|
-
| ./spec/
|
89
|
-
| ./spec/features/
|
90
|
-
|
|
91
|
-
| ./spec/features/search_spec.rb | 3 | 0.6555 | 0.2185 |
|
92
|
-
| <abridged> | <abridged> | <abridged> | <abridged> |
|
93
|
-
+-------------------------------------------------------------+---------------+--------------+-------------------------+
|
76
|
+
|-------------------------------------------------------------|---------------|--------------|-------------------------|
|
77
|
+
| ./spec/features/index_page_spec.rb | 11 | 2.76 | 0.25125 |
|
78
|
+
| ./spec/controllers/admin/customers_controller_spec.rb | 15 | 1.11 | 0.07432 |
|
79
|
+
| ./spec/features/form_errors_spec.rb | 2 | 1.1 | 0.54813 |
|
80
|
+
| ./spec/generators/dashboard_generator_spec.rb | 20 | 1.06 | 0.05293 |
|
81
|
+
| ./spec/features/orders_form_spec.rb | 7 | 1.01 | 0.14472 |
|
82
|
+
| ./spec/features/show_page_spec.rb | 10 | 0.67528 | 0.06753 |
|
83
|
+
| ./spec/i18n_spec.rb | 2 | 0.58921 | 0.2946 |
|
84
|
+
| ./spec/features/search_spec.rb | 3 | 0.57751 | 0.1925 |
|
85
|
+
| ./spec/features/orders_index_spec.rb | 6 | 0.57129 | 0.09521 |
|
86
|
+
| ./spec/features/products_index_spec.rb | 4 | 0.54049 | 0.13512 |
|
87
|
+
| <abridged> | | | |
|
94
88
|
|
95
89
|
Randomized with seed 40301
|
96
90
|
```
|
data/lib/rspec_overview.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "rspec/core"
|
2
|
-
require_relative "output/
|
2
|
+
require_relative "output/markdown_table"
|
3
3
|
require_relative "result"
|
4
4
|
|
5
5
|
module RspecOverview
|
@@ -43,12 +43,12 @@ module RspecOverview
|
|
43
43
|
column_name, "Example count", "Duration (s)", "Average per example (s)"
|
44
44
|
]
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
title: "Summary by #{column_name}",
|
46
|
+
output.puts "\n# Summary by #{column_name}\n\n"
|
47
|
+
output.puts output_format.new(
|
49
48
|
headings: headings,
|
50
49
|
rows: results_as_rows(results),
|
51
50
|
)
|
51
|
+
output.puts "\n"
|
52
52
|
end
|
53
53
|
|
54
54
|
def extract_subfolder(file_path)
|
@@ -63,7 +63,7 @@ module RspecOverview
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def output_format
|
66
|
-
RspecOverview::Output::
|
66
|
+
RspecOverview::Output::MarkdownTable
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -3,17 +3,25 @@ require "csv"
|
|
3
3
|
module RspecOverview
|
4
4
|
module Output
|
5
5
|
class Csv
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
def initialize(headings:, rows:)
|
7
|
+
@headings = headings
|
8
|
+
@rows = rows
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
def to_s
|
12
|
+
csv_content
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
+
attr_reader :headings, :rows
|
18
|
+
|
19
|
+
def csv_content
|
20
|
+
CSV.generate(**csv_options, headers: headings) do |csv|
|
21
|
+
rows.each { |row| csv << row }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
17
25
|
def csv_options
|
18
26
|
{ write_headers: true, force_quotes: true }
|
19
27
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "matrix"
|
2
|
+
|
3
|
+
module RspecOverview
|
4
|
+
module Output
|
5
|
+
class MarkdownTable
|
6
|
+
BORDER_SEPERATOR = "|".freeze
|
7
|
+
NOT_BORDER_SEPERATOR = /[^#{BORDER_SEPERATOR}]/
|
8
|
+
HEADING_SEPERATOR = "-".freeze
|
9
|
+
|
10
|
+
def initialize(headings:, rows:)
|
11
|
+
@matrix = Matrix.rows([headings] + rows)
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
render_table
|
16
|
+
end
|
17
|
+
|
18
|
+
def column(index)
|
19
|
+
matrix.column(index).to_a
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :matrix
|
25
|
+
|
26
|
+
def render_table
|
27
|
+
lines = matrix.row_vectors.map(&method(:render_row))
|
28
|
+
lines.insert(1, create_heading_divider(lines.first))
|
29
|
+
lines.join("\n") + "\n"
|
30
|
+
end
|
31
|
+
|
32
|
+
def render_row(data_row)
|
33
|
+
table_row = [BORDER_SEPERATOR]
|
34
|
+
|
35
|
+
data_row.each_with_index do |value, column_index|
|
36
|
+
table_row << " #{pad_value(value, column_index)} #{BORDER_SEPERATOR}"
|
37
|
+
end
|
38
|
+
|
39
|
+
table_row.join
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_heading_divider(line)
|
43
|
+
line.gsub(NOT_BORDER_SEPERATOR, HEADING_SEPERATOR)
|
44
|
+
end
|
45
|
+
|
46
|
+
def pad_value(value, column_index)
|
47
|
+
column_width = width_of_column(column_index)
|
48
|
+
value.to_s.ljust(column_width, " ")
|
49
|
+
end
|
50
|
+
|
51
|
+
def width_of_column(index)
|
52
|
+
column(index).max_by{ |value| value.to_s.length }.length
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/rspec_overview.gemspec
CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_dependency "rspec-core", "~> 3.0"
|
23
|
-
spec.add_dependency "terminal-table", "~> 1.6"
|
24
23
|
|
25
24
|
spec.add_development_dependency "bundler", "~> 1.16"
|
26
25
|
spec.add_development_dependency "pry-byebug", "~> 3.5"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_overview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oli Peate
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: terminal-table
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.6'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.6'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: bundler
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +103,7 @@ files:
|
|
117
103
|
- lib/rspec_overview/formatter.rb
|
118
104
|
- lib/rspec_overview/formatter_csv.rb
|
119
105
|
- lib/rspec_overview/output/csv.rb
|
120
|
-
- lib/rspec_overview/output/
|
106
|
+
- lib/rspec_overview/output/markdown_table.rb
|
121
107
|
- lib/rspec_overview/result.rb
|
122
108
|
- lib/rspec_overview/version.rb
|
123
109
|
- rspec_overview.gemspec
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require "terminal-table"
|
2
|
-
|
3
|
-
module RspecOverview
|
4
|
-
module Output
|
5
|
-
class Table
|
6
|
-
def generate(output:, title:, headings:, rows:)
|
7
|
-
output.puts "\n"
|
8
|
-
output.puts Terminal::Table.new(
|
9
|
-
title: title,
|
10
|
-
headings: headings,
|
11
|
-
rows: rows,
|
12
|
-
)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|