rspec_overview 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f4558b861fa108b0a0810d3fae12a7a2ea625bf
4
- data.tar.gz: 5bfea330b3482aa5b75337a4715950b1850e56f5
3
+ metadata.gz: bf40c3329b0d98739b0e00a6a202bb23d9b5c205
4
+ data.tar.gz: e34c2e84a63d87523a889ba3fa2ad13d8b5cb542
5
5
  SHA512:
6
- metadata.gz: b25e8431b9829f4958a17aed61ace2b4f1f782ca53eae84969c2be2f8ca5367f3ecd430c22d429d36605e28c03b1a9bdc2727acf28fd1c69b0fbee4aa7c495f3
7
- data.tar.gz: b744a21eebfd6797b75a3ff0847bf17d1040dc78c5cd4155aea95cf0cbf5aaba3a1da249ba5c2362eecb93c67d4f60dda64ffe79a035a56d45229e41b8023233
6
+ metadata.gz: 71f0ab02f6846a6a0ca731ace4b7d90ab0e6ffb6b4f2d26914399b736cbb7fff7307317732b13275af9281c5284a702261660c18cc7ab770fcd71437040208c9
7
+ data.tar.gz: bf7efbaf8b0408422fab6844252aced0686c48d5b81b0b7f1db5472c4dffbdaa5841c05b7d49968d4002508c4886968b6caff5d09d5ff87875b6637fda4484a6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rspec_overview (0.1.0)
4
+ rspec_overview (0.1.1)
5
5
  rspec-core (~> 3.0)
6
6
  terminal-table (~> 1.6)
7
7
 
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Oliver Peate
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/odlp/rspec_overview.svg?branch=master)](https://travis-ci.org/odlp/rspec_overview)
4
4
 
5
- Take `RspecOverview::Formatter` a spin when you're new to a project & need an
5
+ Take `RspecOverview::Formatter` a spin when you're new to a project and need an
6
6
  overview:
7
7
 
8
8
  - How are the tests structured?
@@ -11,7 +11,7 @@ overview:
11
11
 
12
12
  ## Usage
13
13
 
14
- In your `Gemfile`:
14
+ Add the gem to your `Gemfile` and run `bundle`:
15
15
 
16
16
  ```ruby
17
17
  group :test do
@@ -19,8 +19,8 @@ group :test do
19
19
  end
20
20
  ```
21
21
 
22
- Then `bundle`. The overview formatter can be used standalone, or mix & match
23
- with other formatters:
22
+ You can use the overview formatter standalone, or mix & match with other
23
+ formatters:
24
24
 
25
25
  ```sh
26
26
  # With the progress formatter:
@@ -47,7 +47,8 @@ Randomized with seed 40301
47
47
  Finished in 19.36 seconds (files took 3.99 seconds to load)
48
48
  363 examples, 0 failures
49
49
 
50
- Summary by Type or Subfolder
50
+ +---------------------+---------------+--------------+-------------------------+
51
+ | Summary by Type or Subfolder |
51
52
  +---------------------+---------------+--------------+-------------------------+
52
53
  | Type or Subfolder | Example count | Duration (s) | Average per example (s) |
53
54
  +---------------------+---------------+--------------+-------------------------+
@@ -63,7 +64,8 @@ Summary by Type or Subfolder
63
64
  | ./spec/dashboards | 9 | 0.01684 | 0.00187 |
64
65
  +---------------------+---------------+--------------+-------------------------+
65
66
 
66
- Summary by File
67
+ +-------------------------------------------------------------+---------------+--------------+-------------------------+
68
+ | Summary by File |
67
69
  +-------------------------------------------------------------+---------------+--------------+-------------------------+
68
70
  | File | Example count | Duration (s) | Average per example (s) |
69
71
  +-------------------------------------------------------------+---------------+--------------+-------------------------+
@@ -37,21 +37,15 @@ module RspecOverview
37
37
  data[identifier].duration_raw += example.execution_result.run_time
38
38
  end
39
39
 
40
+ title = "Summary by #{column_name}"
41
+
40
42
  headings = [
41
43
  column_name, "Example count", "Duration (s)", "Average per example (s)"
42
44
  ]
43
45
 
44
- rows = values_in_descending_duration(data).map do |row|
45
- [
46
- row.identifier,
47
- row.example_count,
48
- helpers.format_seconds(row.duration_raw),
49
- helpers.format_seconds(row.avg_duration),
50
- ]
51
- end
46
+ rows = values_in_descending_duration(data).map(&method(:as_table_row))
52
47
 
53
- output.puts "\nSummary by #{column_name}"
54
- print_table(headings: headings, rows: rows)
48
+ print_table(title: title, headings: headings, rows: rows)
55
49
  end
56
50
 
57
51
  def type_or_subfolder(example)
@@ -62,12 +56,23 @@ module RspecOverview
62
56
  data.values.sort_by(&:duration_raw).reverse_each
63
57
  end
64
58
 
65
- def helpers
66
- RSpec::Core::Formatters::Helpers
59
+ def as_table_row(row)
60
+ [
61
+ row.identifier,
62
+ row.example_count,
63
+ format_seconds(row.duration_raw),
64
+ format_seconds(row.avg_duration),
65
+ ]
66
+ end
67
+
68
+ def format_seconds(duration)
69
+ RSpec::Core::Formatters::Helpers.format_seconds(duration)
67
70
  end
68
71
 
69
- def print_table(headings:, rows:)
70
- output.puts Terminal::Table.new(headings: headings, rows: rows)
72
+ def print_table(title:, headings:, rows:)
73
+ table = Terminal::Table.new(title: title, headings: headings, rows: rows)
74
+ output.puts "\n"
75
+ output.puts table
71
76
  end
72
77
  end
73
78
  end
@@ -1,3 +1,3 @@
1
1
  module RspecOverview
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.version = RspecOverview::VERSION
8
8
  spec.authors = ["Oli Peate"]
9
9
  spec.email = ["oliverp@gmail.com"]
10
+ spec.license = "MIT"
10
11
 
11
12
  spec.summary = "See an overview of your RSpec test suite"
12
13
  spec.homepage = "https://github.com/odlp/rspec_overview"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_overview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oli Peate
@@ -107,6 +107,7 @@ files:
107
107
  - ".travis.yml"
108
108
  - Gemfile
109
109
  - Gemfile.lock
110
+ - LICENSE
110
111
  - README.md
111
112
  - Rakefile
112
113
  - bin/console
@@ -117,7 +118,8 @@ files:
117
118
  - lib/rspec_overview/version.rb
118
119
  - rspec_overview.gemspec
119
120
  homepage: https://github.com/odlp/rspec_overview
120
- licenses: []
121
+ licenses:
122
+ - MIT
121
123
  metadata: {}
122
124
  post_install_message:
123
125
  rdoc_options: []