rfc 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 297ec5e3f1c71f1ae090bb6dcac575c14d22be9d2f6051b8533a2dfcc58a8ff1
4
- data.tar.gz: 5af5cee83d8ca484e24662ae1d9bfda413e8524af52fefc19170cbfe68837a9b
3
+ metadata.gz: e5ac8bcfd44b14f7d6c36ec0c4926d8582c013f036a9add7eb1400a060816198
4
+ data.tar.gz: c82566f0acb6007a9d7a21bc683470bdf9e76637714100f4ac5c7694a129c80b
5
5
  SHA512:
6
- metadata.gz: 46361628712b25416b775339ea16dbe6b2675885853376736855d843efffba0f2448f883c89e01ed2275b90f08888dd84b21cbff01cc5d850bdbcbd2783203da
7
- data.tar.gz: 54f205faa1feaf4cac10dd51a47ec8a3afbc58c99d794a194c866b4802bc38657f55e3627c84186014034a354699ab1f28ed408a6c0614a73bfd465884646afd
6
+ metadata.gz: 7638f6563c4e4cab423316cd2a241d1a436680fa8bede3cb40e7f472b05df4895503e00cb4a8a7c6820bf7b93ad960389eac096914a7a58cc35f63583891821a
7
+ data.tar.gz: 392c4a37971d82250ae6622d25f294c701f8db943fd194adfb72d41ae169329f6698b740e81c3a784ca06fdae8e48bc7db61a3cf268ed3f5685438c8489527e9
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A collection of RSpec formatters.
4
4
 
5
- ## RSpec Insta-Failing Formatter (RIFF)
5
+ ## RSpec Insta-Failing Formatter (Rif, Riff)
6
6
 
7
7
  RIFF was originally developed for running large test suites in a
8
8
  continuous integration environment, where the runs are non-interactive
@@ -23,7 +23,7 @@ by global test setup code as well as a specific test, or by multiple tests.
23
23
  This formatter reports failures at the end of the test run, like
24
24
  RSpec's documentation formatter does.
25
25
 
26
- ## Announce Insta-Failing Formatter (AIF)
26
+ ## Announce Insta-Failing Formatter (Aif, AIF)
27
27
 
28
28
  This is the announce formatter with insta-fail feature. It reports
29
29
  failures as soon as they happen, after each example is executed.
data/lib/rfc.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require 'rfc/version'
2
2
  require 'rfc/announce'
3
+ require 'rfc/rif'
3
4
  require 'rfc/riff'
data/lib/rfc/aif.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rfc/announce'
2
2
 
3
3
  module Rfc
4
- class AIF < Announce
4
+ class Aif < Announce
5
5
  RSpec::Core::Formatters.register self,
6
6
  :example_group_started, :example_group_finished,
7
7
  :start, :example_started,
@@ -26,4 +26,6 @@ class AIF < Announce
26
26
  end
27
27
 
28
28
  end
29
+
30
+ AIF = Aif
29
31
  end
data/lib/rfc/rif.rb ADDED
@@ -0,0 +1,74 @@
1
+ require 'rspec/core'
2
+ RSpec::Support.require_rspec_core "formatters/base_text_formatter"
3
+
4
+ module Rfc
5
+ class Rif < RSpec::Core::Formatters::BaseTextFormatter
6
+ RSpec::Core::Formatters.register self,
7
+ :message, :dump_summary, :dump_failures, :dump_pending, :seed,
8
+ :example_passed, :example_pending, :example_failed
9
+
10
+ attr_reader :total_count, :passed_count, :failed_count, :completed_count
11
+
12
+ class << self
13
+ attr_accessor :heartbeat_interval
14
+ end
15
+ self.heartbeat_interval = 10
16
+
17
+ def start(notification)
18
+ @total_count = notification.count
19
+ @passed_count = 0
20
+ @pending_count = 0
21
+ @failed_count = 0
22
+ @completed_count = 0
23
+ @this_percent = 0
24
+ @started_at = Time.now
25
+
26
+ # There is no progress at this point but report the total number of
27
+ # examples prior to running any of them
28
+ report_progress
29
+ end
30
+
31
+ def example_passed(_notification)
32
+ @passed_count += 1
33
+ @completed_count += 1
34
+ report_progress
35
+ end
36
+
37
+ def example_pending(notification)
38
+ @pending_count += 1
39
+ @completed_count += 1
40
+ report_progress
41
+ end
42
+
43
+ def example_failed(notification)
44
+ @failed_count += 1
45
+ @completed_count += 1
46
+
47
+ output.puts notification.fully_formatted(failed_count)
48
+ output.puts
49
+ end
50
+
51
+ def report_progress
52
+ this_percent = @completed_count * 100 / total_count
53
+ if @reported_percent != this_percent || @reported_at.nil? ||
54
+ Time.now-@reported_at > self.class.heartbeat_interval
55
+ then
56
+ progress_msg = %Q`\
57
+ #{Time.now.strftime('[%Y-%m-%d %H:%M:%S %z]')} \
58
+ #{this_percent}% (#{@completed_count}/#{@total_count} examples) complete`
59
+ if @pending_count > 0
60
+ progress_msg += ", #{@pending_count} pending"
61
+ end
62
+ if @failed_count > 0
63
+ progress_msg += ", #{@failed_count} failed"
64
+ end
65
+ output.puts progress_msg
66
+ @reported_percent = this_percent
67
+ @reported_at = Time.now
68
+ end
69
+ end
70
+
71
+ def dump_failures(notification)
72
+ end
73
+ end
74
+ end
data/lib/rfc/riff.rb CHANGED
@@ -1,74 +1,3 @@
1
- require 'rspec/core'
2
- RSpec::Support.require_rspec_core "formatters/base_text_formatter"
3
-
4
1
  module Rfc
5
- class Riff < RSpec::Core::Formatters::BaseTextFormatter
6
- RSpec::Core::Formatters.register self,
7
- :message, :dump_summary, :dump_failures, :dump_pending, :seed,
8
- :example_passed, :example_pending, :example_failed
9
-
10
- attr_reader :total_count, :passed_count, :failed_count, :completed_count
11
-
12
- class << self
13
- attr_accessor :heartbeat_interval
14
- end
15
- self.heartbeat_interval = 10
16
-
17
- def start(notification)
18
- @total_count = notification.count
19
- @passed_count = 0
20
- @pending_count = 0
21
- @failed_count = 0
22
- @completed_count = 0
23
- @this_percent = 0
24
- @started_at = Time.now
25
-
26
- # There is no progress at this point but report the total number of
27
- # examples prior to running any of them
28
- report_progress
29
- end
30
-
31
- def example_passed(_notification)
32
- @passed_count += 1
33
- @completed_count += 1
34
- report_progress
35
- end
36
-
37
- def example_pending(notification)
38
- @pending_count += 1
39
- @completed_count += 1
40
- report_progress
41
- end
42
-
43
- def example_failed(notification)
44
- @failed_count += 1
45
- @completed_count += 1
46
-
47
- output.puts notification.fully_formatted(failed_count)
48
- output.puts
49
- end
50
-
51
- def report_progress
52
- this_percent = @completed_count * 100 / total_count
53
- if @reported_percent != this_percent || @reported_at.nil? ||
54
- Time.now-@reported_at > self.class.heartbeat_interval
55
- then
56
- progress_msg = %Q`\
57
- #{Time.now.strftime('[%Y-%m-%d %H:%M:%S %z]')} \
58
- #{this_percent}% (#{@completed_count}/#{@total_count} examples) complete`
59
- if @pending_count > 0
60
- progress_msg += ", #{@pending_count} pending"
61
- end
62
- if @failed_count > 0
63
- progress_msg += ", #{@failed_count} failed"
64
- end
65
- output.puts progress_msg
66
- @reported_percent = this_percent
67
- @reported_at = Time.now
68
- end
69
- end
70
-
71
- def dump_failures(notification)
72
- end
73
- end
2
+ Riff = Rif
74
3
  end
data/lib/rfc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rfc
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-14 00:00:00.000000000 Z
11
+ date: 2019-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -35,6 +35,7 @@ files:
35
35
  - lib/rfc.rb
36
36
  - lib/rfc/aif.rb
37
37
  - lib/rfc/announce.rb
38
+ - lib/rfc/rif.rb
38
39
  - lib/rfc/riff.rb
39
40
  - lib/rfc/version.rb
40
41
  homepage: https://github.com/p-mongo/rfc
@@ -60,5 +61,5 @@ requirements: []
60
61
  rubygems_version: 3.0.1
61
62
  signing_key:
62
63
  specification_version: 4
63
- summary: rfc-0.0.2
64
+ summary: rfc-0.0.3
64
65
  test_files: []