fivemat 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e986598270a34ee0c78a6e4920f2e3841f9df12a
4
+ data.tar.gz: 9d6e3b90e7281efc7996e6cbf6c7068c3a58b7b3
5
+ SHA512:
6
+ metadata.gz: ca7acf55440342459edd45cbdb24fc7f248b78cdd5174ea5a1932fbea6765c6582c131c66249723463576fbfd1e01ea2ead556129d385842590f0d233f79c3e4
7
+ data.tar.gz: c00e350caa74ceef739a24b4c160dbac76804827c11a04c078edee87976216c18dfc8041e78681e4d44ba4fb0f274afd654292854de531fd8266b51f89c183ac
@@ -38,6 +38,12 @@ Cucumber output:
38
38
  features/sign_out.feature .......
39
39
  features/sign_up.feature ...............................................
40
40
 
41
+ Enable profiling by setting the `FIVEMAT_PROFILE` variable in the environment:
42
+
43
+ > FIVEMAT_PROFILE=1 rspec --format Fivemat
44
+ DoohickeyTest .... (0.27s)
45
+ KajiggerTest ..................................... (1.87s)
46
+
41
47
  ## Usage
42
48
 
43
49
  Start by adding `gem 'fivemat'` to your `Gemfile`.
data/fivemat.gemspec CHANGED
@@ -12,5 +12,5 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "fivemat"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = '1.1.0'
15
+ gem.version = '1.2.0'
16
16
  end
data/lib/fivemat.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'fivemat/elapsed_time'
2
+
1
3
  module Fivemat
2
4
  autoload :Cucumber, 'fivemat/cucumber'
3
5
  autoload :MiniTest, 'fivemat/minitest/unit'
@@ -2,6 +2,8 @@ require 'cucumber/formatter/progress'
2
2
 
3
3
  module Fivemat
4
4
  class Cucumber < ::Cucumber::Formatter::Progress
5
+ include ElapsedTime
6
+
5
7
  def label(feature)
6
8
  feature.short_name
7
9
  end
@@ -10,10 +12,13 @@ module Fivemat
10
12
  @io.print "#{label(feature)} "
11
13
  @io.flush
12
14
  @exceptions = []
15
+ @start_time = Time.now
13
16
  end
14
17
 
15
18
  def after_feature(feature)
19
+ print_elapsed_time @io, @start_time
16
20
  @io.puts
21
+
17
22
  @exceptions.each do |(exception, status)|
18
23
  print_exception(exception, status, 2)
19
24
  end
@@ -0,0 +1,9 @@
1
+ module ElapsedTime
2
+ def print_elapsed_time(io, start_time)
3
+ if ENV['FIVEMAT_PROFILE']
4
+ elapsed_time = (((Time.now - start_time) * 100).to_i / 100.0)
5
+ io.print " (#{elapsed_time}s)"
6
+ end
7
+ end
8
+ end
9
+
@@ -1,8 +1,11 @@
1
1
  require 'minitest/unit'
2
+ require 'fivemat/elapsed_time'
2
3
 
3
4
  module Fivemat
4
5
  module MiniTest
5
6
  class Unit < ::MiniTest::Unit
7
+ include ElapsedTime
8
+
6
9
  def _run_suites(suites, type)
7
10
  offset = 0
8
11
  suites.reject do |suite|
@@ -11,7 +14,9 @@ module Fivemat
11
14
  suite.send("#{type}_methods").grep(filter).empty?
12
15
  end.map do |suite|
13
16
  print "#{suite} "
17
+ start_time = Time.now
14
18
  result = _run_suite suite, type
19
+ print_elapsed_time $stdout, start_time
15
20
  puts
16
21
  report.each_with_index do |msg, i|
17
22
  puts "%3d) %s" % [offset + i + 1, msg.gsub(/\n/, "\n ")]
data/lib/fivemat/rspec.rb CHANGED
@@ -2,6 +2,8 @@ require 'rspec/core/formatters/progress_formatter'
2
2
 
3
3
  module Fivemat
4
4
  class RSpec < ::RSpec::Core::Formatters::ProgressFormatter
5
+ include ElapsedTime
6
+
5
7
  def initialize(*)
6
8
  super
7
9
  @group_level = 0
@@ -12,6 +14,7 @@ module Fivemat
12
14
  if @group_level.zero?
13
15
  output.print "#{group.description} "
14
16
  @failure_output = []
17
+ @start_time = Time.now
15
18
  end
16
19
  @group_level += 1
17
20
  end
@@ -19,7 +22,9 @@ module Fivemat
19
22
  def example_group_finished(group)
20
23
  @group_level -= 1
21
24
  if @group_level.zero?
25
+ print_elapsed_time output, @start_time
22
26
  output.puts
27
+
23
28
  failed_examples.each_with_index do |example, index|
24
29
  if pending_fixed?(example)
25
30
  dump_pending_fixed(example, @index_offset + index)
data/lib/fivemat/spec.rb CHANGED
@@ -2,6 +2,8 @@ require 'spec/runner/formatter/progress_bar_formatter'
2
2
 
3
3
  module Fivemat
4
4
  class Spec < ::Spec::Runner::Formatter::ProgressBarFormatter
5
+ include ElapsedTime
6
+
5
7
  def initialize(*)
6
8
  super
7
9
  @dumping = false
@@ -20,12 +22,14 @@ module Fivemat
20
22
  @last_root_example_group = example_group_proxy
21
23
  example_group_finished(example_group_proxy) unless @example_group_number == 1
22
24
  output.print "#{example_group_proxy.nested_descriptions.first} "
25
+ @start_time = Time.now
23
26
  end
24
27
 
25
28
  @last_nested_descriptions = example_group_proxy.nested_descriptions
26
29
  end
27
30
 
28
31
  def example_group_finished(example_group_proxy)
32
+ print_elapsed_time output, @start_time
29
33
  puts
30
34
 
31
35
  @failed_examples.each_with_index do |example, index|
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fivemat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tim Pope
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-07-07 00:00:00.000000000 Z
11
+ date: 2013-03-02 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: MiniTest/RSpec/Cucumber formatter that gives each test file its own line
15
14
  of dots
@@ -23,11 +22,12 @@ files:
23
22
  - Gemfile
24
23
  - LICENSE
25
24
  - MIT-LICENSE
26
- - README.md
25
+ - README.markdown
27
26
  - Rakefile
28
27
  - fivemat.gemspec
29
28
  - lib/fivemat.rb
30
29
  - lib/fivemat/cucumber.rb
30
+ - lib/fivemat/elapsed_time.rb
31
31
  - lib/fivemat/minitest.rb
32
32
  - lib/fivemat/minitest/autorun.rb
33
33
  - lib/fivemat/minitest/unit.rb
@@ -35,26 +35,26 @@ files:
35
35
  - lib/fivemat/spec.rb
36
36
  homepage: https://github.com/tpope/fivemat
37
37
  licenses: []
38
+ metadata: {}
38
39
  post_install_message:
39
40
  rdoc_options: []
40
41
  require_paths:
41
42
  - lib
42
43
  required_ruby_version: !ruby/object:Gem::Requirement
43
- none: false
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  required_rubygems_version: !ruby/object:Gem::Requirement
49
- none: false
50
49
  requirements:
51
- - - ! '>='
50
+ - - '>='
52
51
  - !ruby/object:Gem::Version
53
52
  version: '0'
54
53
  requirements: []
55
54
  rubyforge_project:
56
- rubygems_version: 1.8.11
55
+ rubygems_version: 2.0.0
57
56
  signing_key:
58
- specification_version: 3
57
+ specification_version: 4
59
58
  summary: Why settle for a test output format when you could have a test output fivemat?
60
59
  test_files: []
60
+ has_rdoc: