fivemat 1.3.6 → 1.3.7

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: b1b9e080743835fe3e1f4641af24ed0461d77ccdd9a2d47fd5c59598e51efb7c
4
- data.tar.gz: b706519ef0b6fb0c6d2006527a3c94f8f40d1c379e7917a6a7819735a9cd66dc
3
+ metadata.gz: f4c54445cd194ccb6f577ba740a2bfc4ebfd17ea461193a33bfd6b3211621dff
4
+ data.tar.gz: 3f7b54e8fedc5774b6bcddef92c07a104ded401b29fb905a74ff74aa0e823331
5
5
  SHA512:
6
- metadata.gz: b371808701af35663b24aea863684761b7bcd6ad22c362dcfe21ef10c6ae134dcf01fe3e40d3a67ef01b5cbb0868d05505a56ee6164517740e3966666b9fb9fa
7
- data.tar.gz: 71fa25c4b722c3b17442ebf3f2c0cd7065dc581ffefea502af65b39153348607642c2ea699d20adaefb031e28466f0fe3f38b8639d515a9bd2d9b4c585178f11
6
+ metadata.gz: 8450a52250bb32a7a79fe7453d4beaa5dbcf6418799ab14d58be45fa6526d261796caa1fac743aaa2751c7a8363328138ef5cf95b2784639d7715249901cd496
7
+ data.tar.gz: a7f829c8dbeaa4ad5ba3c3b7d0b8a346b231f5d66b925a17fc815e4bf0e3f37d5445fdd8e35ee2dd84ddb23a193fa1ff5bbf050773dac52becbeb8f1aadb7c86
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |gem|
4
4
  gem.name = "fivemat"
5
- gem.version = "1.3.6"
5
+ gem.version = "1.3.7"
6
6
  gem.authors = ["Tim Pope"]
7
7
  gem.email = ["code@tp" + 'ope.net']
8
8
  gem.description = %q{MiniTest/RSpec/Cucumber formatter that gives each test file its own line of dots}
@@ -2,13 +2,24 @@ require 'fivemat/elapsed_time'
2
2
 
3
3
  module Fivemat
4
4
  autoload :Cucumber, 'fivemat/cucumber'
5
+ autoload :Cucumber3, 'fivemat/cucumber3'
5
6
  autoload :MiniTest, 'fivemat/minitest/unit'
6
7
  autoload :RSpec, 'fivemat/rspec'
7
8
  autoload :RSpec3, 'fivemat/rspec3'
8
9
  autoload :Spec, 'fivemat/spec'
9
10
 
10
- # Cucumber 2 detects the formatter API based on initialize arity
11
- def initialize(runtime, path_or_io, options)
11
+ def cucumber3?
12
+ defined?(::Cucumber) && ::Cucumber::VERSION >= '3'
13
+ end
14
+ module_function :cucumber3?
15
+
16
+ # Cucumber detects the formatter API based on initialize arity
17
+ if cucumber3?
18
+ def initialize(config)
19
+ end
20
+ else
21
+ def initialize(runtime, path_or_io, options)
22
+ end
12
23
  end
13
24
 
14
25
  def rspec3?
@@ -34,16 +45,15 @@ module Fivemat
34
45
  case args.size
35
46
  when 0 then MiniTest::Unit
36
47
  when 1 then
37
- if rspec3?
48
+ if args.first.class.to_s == "Cucumber::Configuration"
49
+ Cucumber3
50
+ elsif rspec3?
38
51
  RSpec3
39
52
  else
40
53
  RSpec
41
54
  end
42
55
  when 2 then Spec
43
56
  when 3
44
- if ::Cucumber::VERSION >= '3'
45
- abort "Fivemat does not yet support Cucumber 3"
46
- end
47
57
  Cucumber
48
58
  else
49
59
  raise ArgumentError
@@ -0,0 +1,52 @@
1
+ require 'cucumber/formatter/progress'
2
+
3
+ module Fivemat
4
+ class Cucumber3 < ::Cucumber::Formatter::Progress
5
+ include ElapsedTime
6
+
7
+ def on_test_case_started(event)
8
+ super
9
+ feature = event.test_case.feature
10
+
11
+ unless same_feature_as_previous_test_case?(feature)
12
+ after_feature unless @current_feature.nil?
13
+ before_feature(feature)
14
+ end
15
+ end
16
+
17
+ def on_test_run_finished(_event)
18
+ after_feature
19
+ after_suite
20
+ end
21
+
22
+ private
23
+
24
+ def before_feature(feature)
25
+ @io.print "#{feature} "
26
+ @io.flush
27
+ @current_feature = feature
28
+ @start_time = Time.now
29
+ end
30
+
31
+ def after_feature
32
+ print_elapsed_time @io, @start_time
33
+ @io.puts
34
+ @io.flush
35
+
36
+ print_elements(@pending_step_matches, :pending, 'steps')
37
+ print_elements(@failed_results, :failed, 'steps')
38
+
39
+ @pending_step_matches = []
40
+ @failed_results = []
41
+ end
42
+
43
+ def after_suite
44
+ @io.puts
45
+ print_summary
46
+ end
47
+
48
+ def same_feature_as_previous_test_case?(feature)
49
+ @current_feature && @current_feature.location == feature.location
50
+ end
51
+ end
52
+ end
@@ -4,13 +4,18 @@ module Minitest
4
4
  class FivematReporter < Reporter
5
5
  include ElapsedTime
6
6
 
7
+ def initialize(*args)
8
+ super
9
+ @class = nil
10
+ end
11
+
7
12
  def record(result)
8
- if defined?(@class) && @class != result.class
13
+ if @class != result.klass
9
14
  if @class
10
15
  print_elapsed_time(io, @class_start_time)
11
16
  io.print "\n"
12
17
  end
13
- @class = result.class
18
+ @class = result.klass
14
19
  @class_start_time = Time.now
15
20
  io.print "#@class "
16
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fivemat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pope
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -41,6 +41,7 @@ files:
41
41
  - fivemat.gemspec
42
42
  - lib/fivemat.rb
43
43
  - lib/fivemat/cucumber.rb
44
+ - lib/fivemat/cucumber3.rb
44
45
  - lib/fivemat/elapsed_time.rb
45
46
  - lib/fivemat/minitest.rb
46
47
  - lib/fivemat/minitest/autorun.rb
@@ -69,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
70
  version: '0'
70
71
  requirements: []
71
72
  rubyforge_project:
72
- rubygems_version: 2.7.4
73
+ rubygems_version: 2.7.3
73
74
  signing_key:
74
75
  specification_version: 4
75
76
  summary: Why settle for a test output format when you could have a test output fivemat?