doggo 0.0.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -5
- data/LICENSE.txt +21 -0
- data/README.md +125 -0
- data/lib/doggo.rb +8 -4
- data/spec/internal_spec.rb +13 -1
- metadata +31 -22
checksums.yaml
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMjU2":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZjZiMjhhN2YwNGMyM2RhNDk0ZWNmYWFiMzE2ODM2MmI3YTgyZjU2OGQwZmY0
|
5
|
+
OGQ1MmUyYTI2MDY1OWQxODI0ZQ==
|
6
|
+
data.tar.gz: !binary |-
|
7
|
+
Yjk2MzQzN2M2NmFiYzZjZDE0YTdmNmQwMDNlNzUzMjVkMzEyOWU3ZGJkYWRl
|
8
|
+
ZTNjODcyMGNjMmQwYzMzMjc4Ng==
|
5
9
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
10
|
+
metadata.gz: !binary |-
|
11
|
+
ODJmNjM2YWQ4NTk3NmQyZjA2MGVjNzEyOGEwNDllMDVmMmRmZGRkZGRhNjky
|
12
|
+
NWZkNTUyMGVjMDFiZWE4OTllODVmZTkyNGNhNjY4ZWMwOWQ1M2NmOGI1NjVk
|
13
|
+
OTkzYjA0ODcyZTcyN2U5YWNkYWI4ZDA1MDMzMzE0M2IwNmU5NDA=
|
14
|
+
data.tar.gz: !binary |-
|
15
|
+
YmQzYjkzMDA5YWQ0NmM2MWZiYjk5YzNkYzlkZWU5MWVmNGViNDE2NjAyMjI2
|
16
|
+
YjJmNDQ5NmQxMWNlZTYwY2FhMmEzNWMwNzA5ODc2MDY5NjdjMWMzNTBjZjY2
|
17
|
+
YjlhZTQ4NGM5MzUyZWM5NjY1MTIzYTkzNWNkMWViZWM0YzU3MDc=
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 RIPA Global
|
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
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
# Doggo
|
2
|
+
|
3
|
+
[![License](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT)
|
4
|
+
[![Build Status](https://app.travis-ci.com/RIPGlobal/doggo.svg?branch=master)](https://app.travis-ci.com/RIPGlobal/doggo)
|
5
|
+
|
6
|
+
An [RSpec](https://github.com/rspec) formatter that looks like `--format documentation`, but adds an indication of test number and overall test count at the start of each line.
|
7
|
+
|
8
|
+
## Example output
|
9
|
+
|
10
|
+
Regenerate this with `FOR_EXAMPLE=yes bundle exec rspec --order defined`:
|
11
|
+
|
12
|
+
```
|
13
|
+
[ 10] Doggo examples
|
14
|
+
[01/10] outer passes
|
15
|
+
[02/10] FAILED (1) - outer fails
|
16
|
+
|
17
|
+
1) Doggo examples outer fails
|
18
|
+
Failure/Error: expect(true).to eql(false)
|
19
|
+
|
20
|
+
expected: false
|
21
|
+
got: true
|
22
|
+
|
23
|
+
(compared using eql?)
|
24
|
+
|
25
|
+
Diff:
|
26
|
+
@@ -1,2 +1,2 @@
|
27
|
+
-false
|
28
|
+
+true
|
29
|
+
|
30
|
+
# ./spec/example/doggo_spec.rb:29:in `block (2 levels) in <top (required)>'
|
31
|
+
|
32
|
+
[03/10] PENDING - outer is pending with xit
|
33
|
+
[04/10] FAILED (2) - outer is pending with a custom message
|
34
|
+
|
35
|
+
2) Doggo examples outer is pending with a custom message FIXED
|
36
|
+
Expected pending 'custom message' to fail. No error was raised.
|
37
|
+
# ./spec/example/doggo_spec.rb:35
|
38
|
+
|
39
|
+
[ 10] in a context
|
40
|
+
[ 10] with a nested context
|
41
|
+
[05/10] passes
|
42
|
+
[06/10] FAILED (3) - fails
|
43
|
+
|
44
|
+
3) Doggo examples in a context with a nested context fails
|
45
|
+
Failure/Error: expect(true).to eql(false)
|
46
|
+
|
47
|
+
expected: false
|
48
|
+
got: true
|
49
|
+
|
50
|
+
(compared using eql?)
|
51
|
+
|
52
|
+
Diff:
|
53
|
+
@@ -1,2 +1,2 @@
|
54
|
+
-false
|
55
|
+
+true
|
56
|
+
|
57
|
+
# ./spec/example/doggo_spec.rb:12:in `block (4 levels) in <top (required)>'
|
58
|
+
|
59
|
+
[07/10] PENDING - is pending with xit
|
60
|
+
[08/10] FAILED (4) - is pending with a custom message
|
61
|
+
|
62
|
+
4) Doggo examples in a context with a nested context is pending with a custom message FIXED
|
63
|
+
Expected pending 'custom message' to fail. No error was raised.
|
64
|
+
# ./spec/example/doggo_spec.rb:18
|
65
|
+
|
66
|
+
[ 10] test count
|
67
|
+
[09/10] is taken to 9
|
68
|
+
[10/10] is taken to 10, showing leading zero pad formatting
|
69
|
+
```
|
70
|
+
|
71
|
+
Notable things are:
|
72
|
+
|
73
|
+
* Group title entries omit the example number
|
74
|
+
* Left zero padding to keep column alignment, working for any number of total tests
|
75
|
+
* `FAILED` and `PENDING` states are shown on the left side of the message, not the right as with RSpec's `--format documentation`, to make them a little easier to see in CI output
|
76
|
+
* A `PENDING` default message of `Temporarily skipped with xit` is suppressed for brevity, but any other message would be shown inline.
|
77
|
+
* Detailed failure messages are shown inline, so you can start investigating test failures while your test suite continues to run.
|
78
|
+
|
79
|
+
## Installation
|
80
|
+
|
81
|
+
Either:
|
82
|
+
|
83
|
+
```shell
|
84
|
+
gem install doggo
|
85
|
+
```
|
86
|
+
|
87
|
+
...or in a Gemfile:
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
gem 'doggo', '~> 1.0'
|
91
|
+
```
|
92
|
+
|
93
|
+
## Usage
|
94
|
+
|
95
|
+
Drive RSpec with:
|
96
|
+
|
97
|
+
```
|
98
|
+
rspec --format Doggo
|
99
|
+
```
|
100
|
+
|
101
|
+
Alternatively, edit your `.rspec` file:
|
102
|
+
|
103
|
+
```
|
104
|
+
# .rspec
|
105
|
+
|
106
|
+
--format Doggo
|
107
|
+
```
|
108
|
+
|
109
|
+
...or alter your `spec_helper.rb` file or equivalent:
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
RSpec.configure do | config |
|
113
|
+
config.add_formatter 'Doggo'
|
114
|
+
end
|
115
|
+
```
|
116
|
+
|
117
|
+
## Development
|
118
|
+
|
119
|
+
Doggo works with Ruby 1.9.3-p551 from November 13th 2011, but needs a far newer RubyGems version in order for its `.gemspec` file to be processed. You will therefore probably need to update RubyGems if you are doing development work on the source code and want to, for example, run `bundle update`. _Assuming you are using [rbenv](https://github.com/rbenv/rbenv)_ and have automatically (via Doggo's `.ruby-version` file) or manually (via e.g. running command `rbenv local 1.9.3-p551`) switched to Ruby 1.9.3-p551, you can safely ensure that the most recent compatible RubyGems version is installed by issuing this command:
|
120
|
+
|
121
|
+
```
|
122
|
+
gem update --system 2.7.11
|
123
|
+
```
|
124
|
+
|
125
|
+
According to the [release history](https://rubygems.org/gems/rubygems-update/versions), 2.7.11 is the last of the v2.x RubyGems releases which still supported Ruby v1.x. Version 2.7.11 was released on December 9th 2020.
|
data/lib/doggo.rb
CHANGED
@@ -71,7 +71,7 @@ class Doggo < RSpec::Core::Formatters::BaseTextFormatter
|
|
71
71
|
|
72
72
|
def example_passed(passed)
|
73
73
|
self.outstr.puts(passed_output(passed.example))
|
74
|
-
flush_messages
|
74
|
+
flush_messages()
|
75
75
|
|
76
76
|
self.passed_count += 1
|
77
77
|
self.example_running = false
|
@@ -85,17 +85,21 @@ class Doggo < RSpec::Core::Formatters::BaseTextFormatter
|
|
85
85
|
)
|
86
86
|
)
|
87
87
|
|
88
|
-
flush_messages
|
88
|
+
flush_messages()
|
89
89
|
|
90
90
|
self.pending_count += 1
|
91
91
|
self.example_running = false
|
92
92
|
end
|
93
93
|
|
94
94
|
def example_failed(failure)
|
95
|
+
self.failed_count += 1
|
96
|
+
|
95
97
|
self.outstr.puts(failure_output(failure.example))
|
96
|
-
|
98
|
+
self.outstr.puts(failure.fully_formatted(self.failed_count))
|
99
|
+
self.outstr.puts("\n")
|
100
|
+
|
101
|
+
flush_messages()
|
97
102
|
|
98
|
-
self.failed_count += 1
|
99
103
|
self.example_running = false
|
100
104
|
end
|
101
105
|
|
data/spec/internal_spec.rb
CHANGED
@@ -91,7 +91,12 @@ RSpec.describe Doggo do
|
|
91
91
|
context '#example_failed' do
|
92
92
|
before :each do
|
93
93
|
@dog.start(@notification)
|
94
|
+
@detail = 'failure detail'
|
94
95
|
@failed = double('Failing test', example: @example)
|
96
|
+
|
97
|
+
allow(@failed).to receive(:fully_formatted) do | count |
|
98
|
+
"#{count} #{@detail}"
|
99
|
+
end
|
95
100
|
end
|
96
101
|
|
97
102
|
it 'notes an example is no longer running' do
|
@@ -116,7 +121,7 @@ RSpec.describe Doggo do
|
|
116
121
|
expect(@dog.failed_count).to eql(2)
|
117
122
|
end
|
118
123
|
|
119
|
-
it 'logs the failure' do
|
124
|
+
it 'logs the summary failure' do
|
120
125
|
@dog.example_started(@notification)
|
121
126
|
@dog.example_failed(@failed)
|
122
127
|
|
@@ -124,6 +129,13 @@ RSpec.describe Doggo do
|
|
124
129
|
expect(@bork.string).to include('FAILED')
|
125
130
|
expect(@bork.string).to include(@example_description)
|
126
131
|
end
|
132
|
+
|
133
|
+
it 'logs the detailed failure' do
|
134
|
+
@dog.example_started(@notification)
|
135
|
+
@dog.example_failed(@failed)
|
136
|
+
|
137
|
+
expect(@bork.string).to include("1 #{@detail}")
|
138
|
+
end
|
127
139
|
end # "context '#example_failed' do"
|
128
140
|
|
129
141
|
context '#example_pending' do
|
metadata
CHANGED
@@ -1,79 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doggo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- RIPA Global
|
8
8
|
- Andrew David Hodgkinson
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-09-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec-core
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '3.
|
20
|
+
version: '3.10'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '3.
|
27
|
+
version: '3.10'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rspec
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '3.
|
34
|
+
version: '3.10'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - ~>
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '3.
|
42
|
-
description: Similar to
|
43
|
-
on each line
|
41
|
+
version: '3.10'
|
42
|
+
description: Similar to "rspec -f d", but also indicates progress by showing the current
|
43
|
+
test number and total test count on each line.
|
44
44
|
email:
|
45
|
-
-
|
45
|
+
- dev@ripaglobal.com
|
46
46
|
executables: []
|
47
47
|
extensions: []
|
48
|
-
extra_rdoc_files:
|
48
|
+
extra_rdoc_files:
|
49
|
+
- LICENSE.txt
|
50
|
+
- README.md
|
49
51
|
files:
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
50
54
|
- lib/doggo.rb
|
51
55
|
- spec/example/doggo_spec.rb
|
52
56
|
- spec/internal_spec.rb
|
53
57
|
- spec/spec_helper.rb
|
54
|
-
homepage: https://
|
58
|
+
homepage: https://www.ripaglobal.com/
|
55
59
|
licenses:
|
56
60
|
- MIT
|
57
|
-
metadata:
|
61
|
+
metadata:
|
62
|
+
homepage_uri: https://www.ripaglobal.com/
|
63
|
+
source_code_uri: https://github.com/RIPAGlobal/doggo/
|
64
|
+
bug_tracker_uri: https://github.com/RIPAGlobal/doggo/issues/
|
65
|
+
changelog_uri: https://github.com/RIPAGlobal/doggo/blob/master/CHANGELOG.md
|
58
66
|
post_install_message:
|
59
67
|
rdoc_options: []
|
60
68
|
require_paths:
|
61
69
|
- lib
|
62
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
71
|
requirements:
|
64
|
-
- -
|
72
|
+
- - ! '>='
|
65
73
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
74
|
+
version: 1.9.3
|
67
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
76
|
requirements:
|
69
|
-
- -
|
77
|
+
- - ! '>='
|
70
78
|
- !ruby/object:Gem::Version
|
71
79
|
version: '0'
|
72
80
|
requirements: []
|
73
|
-
|
81
|
+
rubyforge_project:
|
82
|
+
rubygems_version: 2.7.11
|
74
83
|
signing_key:
|
75
84
|
specification_version: 4
|
76
|
-
summary: RSpec formatter - documentation, with progress indication
|
85
|
+
summary: RSpec 3 formatter - documentation, with progress indication
|
77
86
|
test_files:
|
78
87
|
- spec/spec_helper.rb
|
79
88
|
- spec/internal_spec.rb
|