rfc 0.0.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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +23 -0
  3. data/README.md +18 -0
  4. data/lib/rfc/riff.rb +73 -0
  5. metadata +61 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 403f0fc9c271ab60489c370779dbf3ea096ccd2ddb0deb0871654407e6726ba5
4
+ data.tar.gz: b10d9f3b9e05ff98b3a5bc2ee2dcc2c466f45f0d4ee679b80aec70f5918959e5
5
+ SHA512:
6
+ metadata.gz: b80db7ac8762d1fd44ace501bdd655771b5c65150574e2c11481a8e78e8a31e96e0c7f0830f8b8a9e149cb3caf2f69c5ee7d9a8df3fee7f3325acb07161e698d
7
+ data.tar.gz: 2ceaa5bff8edba75680c9e4bb24e9d41233f8fa3d8db8858d8fd796724dc3f0b33e31082e8ffb419fc6671292dd4c4eedf5641d2e5d2b606d7412ccd58c27935
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ The MIT License (MIT)
2
+ =====================
3
+
4
+ Copyright (c) 2018 Oleg Pudeyev
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,18 @@
1
+ # RSpec Formatter Collection
2
+
3
+ A collection of RSpec formatters.
4
+
5
+ ## RSpec Insta-Failing Formatter (RIFF)
6
+
7
+ RIFF was originally developed for running large test suites in a
8
+ continuous integration environment, where the runs are non-interactive
9
+ and the output is saved to a file/stream of some kind.
10
+ It has the following features;
11
+
12
+ - Immediate error/failure reporting
13
+ - Timestamped percentage progress output
14
+ - No output overwrites or terminal manipulation
15
+
16
+ ## License
17
+
18
+ MIT
@@ -0,0 +1,73 @@
1
+ require 'rspec/core/formatters/base_text_formatter'
2
+
3
+ module Rfc
4
+ class Riff < RSpec::Core::Formatters::BaseTextFormatter
5
+ RSpec::Core::Formatters.register self,
6
+ :message, :dump_summary, :dump_failures, :dump_pending, :seed,
7
+ :example_passed, :example_pending, :example_failed
8
+
9
+ attr_reader :total_count, :passed_count, :failed_count, :completed_count
10
+
11
+ class << self
12
+ attr_accessor :heartbeat_interval
13
+ end
14
+ self.heartbeat_interval = 10
15
+
16
+ def start(notification)
17
+ @total_count = notification.count
18
+ @passed_count = 0
19
+ @pending_count = 0
20
+ @failed_count = 0
21
+ @completed_count = 0
22
+ @this_percent = 0
23
+ @started_at = Time.now
24
+
25
+ # There is no progress at this point but report the total number of
26
+ # examples prior to running any of them
27
+ report_progress
28
+ end
29
+
30
+ def example_passed(_notification)
31
+ @passed_count += 1
32
+ @completed_count += 1
33
+ report_progress
34
+ end
35
+
36
+ def example_pending(notification)
37
+ @pending_count += 1
38
+ @completed_count += 1
39
+ report_progress
40
+ end
41
+
42
+ def example_failed(notification)
43
+ @failed_count += 1
44
+ @completed_count += 1
45
+
46
+ output.puts notification.fully_formatted(failed_count)
47
+ output.puts
48
+ end
49
+
50
+ def report_progress
51
+ this_percent = @completed_count * 100 / total_count
52
+ if @reported_percent != this_percent || @reported_at.nil? ||
53
+ Time.now-@reported_at > self.class.heartbeat_interval
54
+ then
55
+ progress_msg = %Q`\
56
+ #{Time.now.strftime('[%Y-%m-%d %H:%M:%S %z]')} \
57
+ #{this_percent}% (#{@completed_count}/#{@total_count} examples) complete`
58
+ if @pending_count > 0
59
+ progress_msg += ", #{@pending_count} pending"
60
+ end
61
+ if @failed_count > 0
62
+ progress_msg += ", #{@failed_count} failed"
63
+ end
64
+ output.puts progress_msg
65
+ @reported_percent = this_percent
66
+ @reported_at = Time.now
67
+ end
68
+ end
69
+
70
+ def dump_failures(notification)
71
+ end
72
+ end
73
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rfc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Oleg Pudeyev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec-core
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
+ description: RSpec Formatter Collection including a concise insta-failing formatter
28
+ email: oleg@olegp.name
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - LICENSE
34
+ - README.md
35
+ - lib/rfc/riff.rb
36
+ homepage: https://github.com/p-mongo/rfc
37
+ licenses:
38
+ - MIT
39
+ metadata: {}
40
+ post_install_message:
41
+ rdoc_options:
42
+ - "--charset=UTF-8"
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 1.9.3
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project:
57
+ rubygems_version: 2.7.6
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: rfc-0.0.1
61
+ test_files: []