fivemat 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -0
- data/fivemat.gemspec +1 -1
- data/lib/fivemat.rb +2 -0
- data/lib/fivemat/cucumber.rb +6 -1
- data/lib/fivemat/rspec.rb +13 -0
- data/lib/fivemat/spec.rb +53 -0
- metadata +4 -3
data/README.md
CHANGED
@@ -45,6 +45,9 @@ Start by adding `gem 'fivemat'` to your `Gemfile`.
|
|
45
45
|
### MiniTest
|
46
46
|
|
47
47
|
Change `require 'minitest/autorun'` to `require 'fivemat/minitest/autorun'`.
|
48
|
+
Or with Rails, add `require 'fivemat/minitest'` to
|
49
|
+
`test/test_helper.rb`. If it doesn't work, you may need a newer version of
|
50
|
+
MiniTest. (Add `gem 'minitest'` to your Gemfile if it's not there already.)
|
48
51
|
|
49
52
|
### RSpec
|
50
53
|
|
data/fivemat.gemspec
CHANGED
data/lib/fivemat.rb
CHANGED
@@ -2,11 +2,13 @@ module Fivemat
|
|
2
2
|
autoload :Cucumber, 'fivemat/cucumber'
|
3
3
|
autoload :MiniTest, 'fivemat/minitest/unit'
|
4
4
|
autoload :RSpec, 'fivemat/rspec'
|
5
|
+
autoload :Spec, 'fivemat/spec'
|
5
6
|
|
6
7
|
def self.new(*args)
|
7
8
|
case args.size
|
8
9
|
when 0 then MiniTest::Unit
|
9
10
|
when 1 then RSpec
|
11
|
+
when 2 then Spec
|
10
12
|
when 3 then Cucumber
|
11
13
|
else
|
12
14
|
raise ArgumentError
|
data/lib/fivemat/cucumber.rb
CHANGED
@@ -2,8 +2,12 @@ require 'cucumber/formatter/progress'
|
|
2
2
|
|
3
3
|
module Fivemat
|
4
4
|
class Cucumber < ::Cucumber::Formatter::Progress
|
5
|
+
def label(feature)
|
6
|
+
feature.short_name
|
7
|
+
end
|
8
|
+
|
5
9
|
def before_feature(feature)
|
6
|
-
@io.print "#{feature
|
10
|
+
@io.print "#{label(feature)} "
|
7
11
|
@io.flush
|
8
12
|
@exceptions = []
|
9
13
|
end
|
@@ -23,6 +27,7 @@ module Fivemat
|
|
23
27
|
def after_features(features)
|
24
28
|
@io.puts
|
25
29
|
print_stats(features, @options)
|
30
|
+
print_snippets(@options)
|
26
31
|
print_passing_wip(@options)
|
27
32
|
end
|
28
33
|
end
|
data/lib/fivemat/rspec.rb
CHANGED
@@ -33,6 +33,19 @@ module Fivemat
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
def pending_fixed?(example)
|
37
|
+
if example.execution_result[:exception].respond_to?(:pending_fixed?)
|
38
|
+
example.execution_result[:exception].pending_fixed?
|
39
|
+
else
|
40
|
+
::RSpec::Core::PendingExampleFixedError === example.execution_result[:exception]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def dump_pending_fixed(example, index)
|
45
|
+
output.puts "#{short_padding}#{index.next}) #{example.full_description} FIXED"
|
46
|
+
output.puts blue("#{long_padding}Expected pending '#{example.metadata[:execution_result][:pending_message]}' to fail. No Error was raised.")
|
47
|
+
end
|
48
|
+
|
36
49
|
def start_dump
|
37
50
|
# Skip the call to output.puts in the messiest way possible.
|
38
51
|
self.class.superclass.superclass.instance_method(:start_dump).bind(self).call
|
data/lib/fivemat/spec.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec/runner/formatter/progress_bar_formatter'
|
2
|
+
|
3
|
+
module Fivemat
|
4
|
+
class Spec < ::Spec::Runner::Formatter::ProgressBarFormatter
|
5
|
+
def initialize(*)
|
6
|
+
super
|
7
|
+
@dumping = false
|
8
|
+
@example_group_number = 0
|
9
|
+
@failed_examples = []
|
10
|
+
@failure_index_offset = 1
|
11
|
+
@last_nested_descriptions = []
|
12
|
+
@last_root_example_group = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def example_group_started(example_group_proxy)
|
16
|
+
super
|
17
|
+
@example_group_number += 1
|
18
|
+
|
19
|
+
unless example_group_proxy.nested_descriptions.first == @last_nested_descriptions.first
|
20
|
+
@last_root_example_group = example_group_proxy
|
21
|
+
example_group_finished(example_group_proxy) unless @example_group_number == 1
|
22
|
+
output.print "#{example_group_proxy.nested_descriptions.first} "
|
23
|
+
end
|
24
|
+
|
25
|
+
@last_nested_descriptions = example_group_proxy.nested_descriptions
|
26
|
+
end
|
27
|
+
|
28
|
+
def example_group_finished(example_group_proxy)
|
29
|
+
puts
|
30
|
+
|
31
|
+
@failed_examples.each_with_index do |example, index|
|
32
|
+
dump_failure(@failure_index_offset + index, example)
|
33
|
+
end
|
34
|
+
|
35
|
+
@failure_index_offset += @failed_examples.size
|
36
|
+
@failed_examples.clear
|
37
|
+
end
|
38
|
+
|
39
|
+
def example_failed(example, counter, failure)
|
40
|
+
super
|
41
|
+
@failed_examples << failure
|
42
|
+
end
|
43
|
+
|
44
|
+
def start_dump
|
45
|
+
example_group_finished(@last_root_example_group)
|
46
|
+
@dumping = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def dump_failure(*)
|
50
|
+
super unless @dumping
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fivemat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: MiniTest/RSpec/Cucumber formatter that gives each test file its own line
|
15
15
|
of dots
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- lib/fivemat/minitest/autorun.rb
|
33
33
|
- lib/fivemat/minitest/unit.rb
|
34
34
|
- lib/fivemat/rspec.rb
|
35
|
+
- lib/fivemat/spec.rb
|
35
36
|
homepage: https://github.com/tpope/fivemat
|
36
37
|
licenses: []
|
37
38
|
post_install_message:
|
@@ -52,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
53
|
version: '0'
|
53
54
|
requirements: []
|
54
55
|
rubyforge_project:
|
55
|
-
rubygems_version: 1.8.
|
56
|
+
rubygems_version: 1.8.11
|
56
57
|
signing_key:
|
57
58
|
specification_version: 3
|
58
59
|
summary: Why settle for a test output format when you could have a test output fivemat?
|