rspec-progress-bar 0.1.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 +7 -0
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +56 -0
- data/lib/rspec_progress_bar/formatter.rb +24 -0
- data/lib/rspec_progress_bar/version.rb +5 -0
- data/lib/rspec_progress_bar.rb +3 -0
- data/rspec-progress-bar.gemspec +29 -0
- data/spec/lib/rspec_progress_bar/formatter_spec.rb +55 -0
- data/spec/spec_helper.rb +3 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c1d18a6548bea579d256e260cef1e5c4c88d2d6e7b52fc61508e812031a90dd9
|
4
|
+
data.tar.gz: 13c3bdb592dbe28be91cc0951e30658f60d866208600543a1e88af10e9a851ed
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ee96050000b4c60952b9313921693cfcddea4250d3a8b62d470a577d046ce4f06a918a9bf39452b85a5c620919ebee510c24e48dabf9fb15132ceb2ac5e7c3d4
|
7
|
+
data.tar.gz: 0fcf2495897d5ef0a0c7bdb237f4707f1b9940b89aa57a3ec1e42b2e5fbf288241414ac4f979c84d876f7d827dec82b13a2be36a4b28f5616dfc59ffc3e22f51
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/Gemfile.lock
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Anton Trushkevich
|
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,56 @@
|
|
1
|
+
# rspec-progress-bar
|
2
|
+
|
3
|
+
[ProgressBar](https://github.com/paul/progress_bar) formatter for RSpec
|
4
|
+
|
5
|
+
Output
|
6
|
+
======
|
7
|
+
|
8
|
+
```
|
9
|
+
[###################################################] [27/27] [100.00%] [00:01] [00:00] [16.18/s]
|
10
|
+
Finished in 1.4 seconds (files took 6.57 seconds to load)
|
11
|
+
27 examples, 0 failures
|
12
|
+
```
|
13
|
+
|
14
|
+
When used along with [rspec-instafail](https://github.com/grosser/rspec-instafail):
|
15
|
+
|
16
|
+
```
|
17
|
+
[####################### ] [ 4/27] [ 14.81%] [00:01] [00:07] [ 3.22/s]
|
18
|
+
1) ApplicationController#sign_out_and_redirect with JSON should return JSON indicating success
|
19
|
+
Failure/Error: json_response = JSON.parse response.body
|
20
|
+
A JSON text must at least contain two octets!
|
21
|
+
# /Users/miwillhite/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:146:in `initialize'
|
22
|
+
# /Users/miwillhite/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:146:in `new'
|
23
|
+
# /Users/miwillhite/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:146:in `parse'
|
24
|
+
# ./spec/controllers/application_controller_spec.rb:17:in `block (4 levels) in <top (required)>'
|
25
|
+
[###################################################] [27/27] [100.00%] [00:01] [00:00] [16.18/s]
|
26
|
+
Failures:
|
27
|
+
|
28
|
+
1) ApplicationController#sign_out_and_redirect with JSON should return JSON indicating success
|
29
|
+
Failure/Error: json_response = JSON.parse response.body
|
30
|
+
A JSON text must at least contain two octets!
|
31
|
+
# /Users/miwillhite/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:146:in `initialize'
|
32
|
+
# /Users/miwillhite/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:146:in `new'
|
33
|
+
# /Users/miwillhite/.rvm/gems/ruby-1.9.2-p0/gems/json_pure-1.4.6/lib/json/common.rb:146:in `parse'
|
34
|
+
# ./spec/controllers/application_controller_spec.rb:17:in `block (4 levels) in <top (required)>'
|
35
|
+
|
36
|
+
Finished in 1.52 seconds (files took 6.63 seconds to load)
|
37
|
+
27 examples, 1 failure
|
38
|
+
```
|
39
|
+
|
40
|
+
Install
|
41
|
+
=======
|
42
|
+
|
43
|
+
```Bash
|
44
|
+
gem install rspec-progress-bar
|
45
|
+
|
46
|
+
# .rspec
|
47
|
+
--require rspec_progress_bar/formatter
|
48
|
+
--format RspecProgressBar::Formatter
|
49
|
+
```
|
50
|
+
|
51
|
+
Authors
|
52
|
+
=======
|
53
|
+
|
54
|
+
Anton Trushkevich<br/>
|
55
|
+
trushkevich@gmail.com<br/>
|
56
|
+
License: MIT
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rspec/core/formatters/base_text_formatter'
|
4
|
+
|
5
|
+
module RspecProgressBar
|
6
|
+
class Formatter < RSpec::Core::Formatters::BaseTextFormatter
|
7
|
+
RSpec::Core::Formatters.register self, :start, :example_started
|
8
|
+
|
9
|
+
attr_accessor :progress_bar
|
10
|
+
|
11
|
+
def initialize(output)
|
12
|
+
@output = output
|
13
|
+
end
|
14
|
+
|
15
|
+
def start(notification)
|
16
|
+
@progress_bar = ProgressBar.new(notification.count)
|
17
|
+
end
|
18
|
+
|
19
|
+
def example_started(_notification)
|
20
|
+
progress_bar.count += 1
|
21
|
+
@output << "#{progress_bar}\r"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'rspec_progress_bar/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'rspec-progress-bar'
|
9
|
+
spec.version = RspecProgressBar::VERSION
|
10
|
+
|
11
|
+
spec.authors = ['Anton Trushkevich']
|
12
|
+
spec.email = ['trushkevich@gmail.com']
|
13
|
+
|
14
|
+
spec.summary = 'RSpec progress bar formatter'
|
15
|
+
spec.homepage = 'https://github.com/trushkevich/rspec-progress-bar'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
spec.files = `git ls-files`.split($/)
|
20
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split($/)
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'rspec', '~> 3.0'
|
23
|
+
spec.add_runtime_dependency 'progress_bar', '~> 1.0'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_development_dependency 'rake'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'progress_bar', '~> 1.0'
|
29
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
RSpec.describe RspecProgressBar::Formatter do
|
6
|
+
let(:io) { double }
|
7
|
+
let(:formatter) { described_class.new(io) }
|
8
|
+
|
9
|
+
describe '#initialize' do
|
10
|
+
it 'assigns @output' do
|
11
|
+
expect(formatter.instance_variable_get(:@output)).to eq(io)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#start' do
|
16
|
+
let(:notification) { double(count: 100) }
|
17
|
+
|
18
|
+
it 'initializes progress bar' do
|
19
|
+
expect { formatter.start(notification) }
|
20
|
+
.to change { formatter.progress_bar }
|
21
|
+
.from(nil)
|
22
|
+
.to(ProgressBar)
|
23
|
+
|
24
|
+
expect(formatter.progress_bar.max).to eq(100)
|
25
|
+
expect(formatter.progress_bar.count).to eq(0)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#example_started' do
|
30
|
+
let(:notification) { double(count: 100) }
|
31
|
+
|
32
|
+
before do
|
33
|
+
formatter.start(notification)
|
34
|
+
allow(io).to receive(:<<)
|
35
|
+
allow(formatter.progress_bar)
|
36
|
+
.to receive(:to_s)
|
37
|
+
.and_return('PROGRESS')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'increments progress bar count' do
|
41
|
+
expect { formatter.example_started(notification) }
|
42
|
+
.to change { formatter.progress_bar.count }
|
43
|
+
.from(0)
|
44
|
+
.to(1)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'prints progress' do
|
48
|
+
formatter.example_started(notification)
|
49
|
+
|
50
|
+
expect(io)
|
51
|
+
.to have_received(:<<)
|
52
|
+
.with("PROGRESS\r")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-progress-bar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anton Trushkevich
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: progress_bar
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: progress_bar
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- trushkevich@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE
|
107
|
+
- README.md
|
108
|
+
- lib/rspec_progress_bar.rb
|
109
|
+
- lib/rspec_progress_bar/formatter.rb
|
110
|
+
- lib/rspec_progress_bar/version.rb
|
111
|
+
- rspec-progress-bar.gemspec
|
112
|
+
- spec/lib/rspec_progress_bar/formatter_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
homepage: https://github.com/trushkevich/rspec-progress-bar
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubygems_version: 3.1.2
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: RSpec progress bar formatter
|
137
|
+
test_files: []
|