fivemat 1.2.1 → 1.3.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 +4 -4
- data/README.markdown +8 -6
- data/fivemat.gemspec +1 -1
- data/lib/fivemat.rb +25 -1
- data/lib/fivemat/minitest.rb +6 -3
- data/lib/fivemat/rspec3.rb +74 -0
- data/lib/minitest/fivemat_plugin.rb +30 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dff3961f1d0a9f6b0d5ff9b998f4a28f03212f3
|
4
|
+
data.tar.gz: 09b8a15c7e4a0f01fa2dc9b53f29e902d006f38c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc2ed4bcf2da8622e037d07172a446163012e10117ccbf1416a335f1a35b6001fa983ec6899a2a23adf2365a301f268c5357c13cd48316acec73553fe9823c33
|
7
|
+
data.tar.gz: b8071efedf092f4a96539edbb63d7f83fe3aeb81910ecb8ad344edf8e5fc859c703054a6d29cfda1d0768c9c3df14428e1b1cb9ae92fe91494a3bb24c7f89bf4
|
data/README.markdown
CHANGED
@@ -41,8 +41,8 @@ Cucumber output:
|
|
41
41
|
Enable profiling by setting the `FIVEMAT_PROFILE` variable in the environment:
|
42
42
|
|
43
43
|
> FIVEMAT_PROFILE=1 rspec --format Fivemat
|
44
|
-
|
45
|
-
|
44
|
+
Doohickey .... (0.27s)
|
45
|
+
Kajigger ..................................... (1.87s)
|
46
46
|
|
47
47
|
## Usage
|
48
48
|
|
@@ -50,10 +50,12 @@ Start by adding `gem 'fivemat'` to your `Gemfile`.
|
|
50
50
|
|
51
51
|
### MiniTest
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
`
|
56
|
-
|
53
|
+
On MiniTest 5, it's loaded automatically as a plugin, and there's nothing else
|
54
|
+
to do. Otherwise, change `require 'minitest/autorun'` to
|
55
|
+
`require 'fivemat/minitest/autorun'`. Or with Rails, add
|
56
|
+
`require 'fivemat/minitest'` to `test/test_helper.rb`. If it doesn't work, you
|
57
|
+
may need a newer version of MiniTest. (Add `gem 'minitest'` to your Gemfile if
|
58
|
+
it's not there already.)
|
57
59
|
|
58
60
|
### RSpec
|
59
61
|
|
data/fivemat.gemspec
CHANGED
data/lib/fivemat.rb
CHANGED
@@ -4,12 +4,36 @@ module Fivemat
|
|
4
4
|
autoload :Cucumber, 'fivemat/cucumber'
|
5
5
|
autoload :MiniTest, 'fivemat/minitest/unit'
|
6
6
|
autoload :RSpec, 'fivemat/rspec'
|
7
|
+
autoload :RSpec3, 'fivemat/rspec3'
|
7
8
|
autoload :Spec, 'fivemat/spec'
|
8
9
|
|
10
|
+
def rspec3?
|
11
|
+
defined?(::RSpec) && ::RSpec::Core::Version::STRING >= '3.0.0'
|
12
|
+
end
|
13
|
+
module_function :rspec3?
|
14
|
+
|
15
|
+
if rspec3?
|
16
|
+
# This needs to be run before `.new` is called, so putting it inside the
|
17
|
+
# autoloaded rspec3 file will not work.
|
18
|
+
::RSpec::Core::Formatters.register self,
|
19
|
+
:example_passed,
|
20
|
+
:example_pending,
|
21
|
+
:example_failed,
|
22
|
+
:example_group_started,
|
23
|
+
:example_group_finished,
|
24
|
+
:dump_pending_fixed,
|
25
|
+
:dump_summary
|
26
|
+
end
|
27
|
+
|
9
28
|
def self.new(*args)
|
10
29
|
case args.size
|
11
30
|
when 0 then MiniTest::Unit
|
12
|
-
when 1 then
|
31
|
+
when 1 then
|
32
|
+
if rspec3?
|
33
|
+
RSpec3
|
34
|
+
else
|
35
|
+
RSpec
|
36
|
+
end
|
13
37
|
when 2 then Spec
|
14
38
|
when 3 then Cucumber
|
15
39
|
else
|
data/lib/fivemat/minitest.rb
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'rspec/core/formatters/base_text_formatter'
|
2
|
+
|
3
|
+
module Fivemat
|
4
|
+
class RSpec3 < ::RSpec::Core::Formatters::BaseTextFormatter
|
5
|
+
include ElapsedTime
|
6
|
+
|
7
|
+
# See fivemat.rb for formatter registration.
|
8
|
+
|
9
|
+
def initialize(output)
|
10
|
+
super(output)
|
11
|
+
@group_level = 0
|
12
|
+
@index_offset = 0
|
13
|
+
@cumulative_failed_examples = []
|
14
|
+
@failed_examples = []
|
15
|
+
end
|
16
|
+
|
17
|
+
def example_passed(notification)
|
18
|
+
output.print success_color('.')
|
19
|
+
end
|
20
|
+
|
21
|
+
def example_pending(notification)
|
22
|
+
super
|
23
|
+
output.print pending_color('*')
|
24
|
+
end
|
25
|
+
|
26
|
+
def example_failed(event)
|
27
|
+
super
|
28
|
+
output.print failure_color('F')
|
29
|
+
end
|
30
|
+
|
31
|
+
def example_group_started(event)
|
32
|
+
if @group_level.zero?
|
33
|
+
output.print "#{event.group.description} "
|
34
|
+
@failure_output = []
|
35
|
+
@start_time = Time.now
|
36
|
+
end
|
37
|
+
@group_level += 1
|
38
|
+
end
|
39
|
+
|
40
|
+
def example_group_finished(event)
|
41
|
+
@group_level -= 1
|
42
|
+
if @group_level.zero?
|
43
|
+
print_elapsed_time output, @start_time
|
44
|
+
output.puts
|
45
|
+
|
46
|
+
failed_examples.each_with_index do |example, index|
|
47
|
+
if pending_fixed?(example)
|
48
|
+
dump_pending_fixed(example, @index_offset + index)
|
49
|
+
else
|
50
|
+
dump_failure(example, @index_offset + index)
|
51
|
+
end
|
52
|
+
dump_backtrace(example)
|
53
|
+
end
|
54
|
+
@index_offset += failed_examples.size
|
55
|
+
@cumulative_failed_examples += failed_examples
|
56
|
+
failed_examples.clear
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def pending_fixed?(example)
|
61
|
+
example.execution_result.pending_fixed?
|
62
|
+
end
|
63
|
+
|
64
|
+
def dump_pending_fixed(example, index)
|
65
|
+
output.puts "#{short_padding}#{index.next}) #{example.full_description} FIXED"
|
66
|
+
output.puts fixed_color("#{long_padding}Expected pending '#{example.execution_result.pending_message}' to fail. No Error was raised.")
|
67
|
+
end
|
68
|
+
|
69
|
+
def dump_summary(*args)
|
70
|
+
@failed_examples = @cumulative_failed_examples
|
71
|
+
super
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'fivemat/elapsed_time'
|
2
|
+
|
3
|
+
module Minitest
|
4
|
+
class FivematReporter < Reporter
|
5
|
+
include ElapsedTime
|
6
|
+
|
7
|
+
def record(result)
|
8
|
+
if @class != result.class
|
9
|
+
if @class
|
10
|
+
print_elapsed_time(io, @class_start_time)
|
11
|
+
io.print "\n"
|
12
|
+
end
|
13
|
+
@class = result.class
|
14
|
+
@class_start_time = Time.now
|
15
|
+
io.print "#@class "
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def report
|
20
|
+
super
|
21
|
+
print_elapsed_time(io, @class_start_time) if @class_start_time
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.plugin_fivemat_init(options)
|
26
|
+
if reporter.kind_of?(CompositeReporter)
|
27
|
+
reporter.reporters.unshift(FivematReporter.new(options[:io], options))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Pope
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: MiniTest/RSpec/Cucumber formatter that gives each test file its own line
|
14
14
|
of dots
|
@@ -32,7 +32,9 @@ files:
|
|
32
32
|
- lib/fivemat/minitest/autorun.rb
|
33
33
|
- lib/fivemat/minitest/unit.rb
|
34
34
|
- lib/fivemat/rspec.rb
|
35
|
+
- lib/fivemat/rspec3.rb
|
35
36
|
- lib/fivemat/spec.rb
|
37
|
+
- lib/minitest/fivemat_plugin.rb
|
36
38
|
homepage: https://github.com/tpope/fivemat
|
37
39
|
licenses: []
|
38
40
|
metadata: {}
|
@@ -52,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
54
|
version: '0'
|
53
55
|
requirements: []
|
54
56
|
rubyforge_project:
|
55
|
-
rubygems_version: 2.0.
|
57
|
+
rubygems_version: 2.0.3
|
56
58
|
signing_key:
|
57
59
|
specification_version: 4
|
58
60
|
summary: Why settle for a test output format when you could have a test output fivemat?
|