Permalink
Browse files

Add total run time after each run. Fixes #129

  • Loading branch information...
1 parent 2983484 commit 903f4bee5d7f1cb5809df5eceb788653410d4ba5 @txus txus committed Sep 19, 2013
Showing with 18 additions and 2 deletions.
  1. +4 −0 CHANGELOG.md
  2. +2 −0 lib/spinach/reporter.rb
  3. +6 −1 lib/spinach/reporter/reporting.rb
  4. +1 −1 lib/spinach/version.rb
  5. +5 −0 test/spinach/reporter_test.rb
View
@@ -1,3 +1,7 @@
+== 0.8.6
+* add total run time after each run
+* fixed #145: Issue with step autoloading
+
== 0.8.4
* fixed #138: The pending steps should abort the remaining scenario, but continue running other scenarios
* added the feature #140: Allow blockless step definitions
View
@@ -27,6 +27,7 @@ def initialize(options = {})
# Hooks the reporter to the runner endpoints
def bind
Spinach.hooks.tap do |hooks|
+ hooks.before_run { |*args| before_run(*args) }
hooks.after_run { |*args| after_run(*args) }
hooks.before_feature { |*args| before_feature_run(*args) }
hooks.after_feature { |*args| after_feature_run(*args) }
@@ -48,6 +49,7 @@ def bind
end
end
+ def before_run(*args); end;
def after_run(*args); end;
def before_feature_run(*args); end
def after_feature_run(*args); end
@@ -41,7 +41,7 @@ def report_undefined_steps
def report_pending_steps
if pending_steps.any?
error.puts "\nPending steps summary:\n"
- report_errors('Pending steps', pending_steps, :yellow)
+ report_errors('Pending steps', pending_steps, :yellow)
end
end
@@ -195,6 +195,10 @@ def format_summary(color, steps, message)
buffer.join
end
+ def before_run(*)
+ @start_time = Time.now
+ end
+
# It prints the error summary if the run has failed
# It always print feature success summary
#
@@ -217,6 +221,7 @@ def run_summary
error_summary = format_summary(:red, error_steps, 'Error')
out.puts "Steps Summary: #{successful_summary}, #{undefined_summary}, #{pending_summary}, #{failed_summary}, #{error_summary}\n\n"
+ out.puts "Finished in #{Time.now - @start_time} seconds" if @start_time
end
end
end
View
@@ -1,4 +1,4 @@
module Spinach
# Spinach version.
- VERSION = "0.8.5"
+ VERSION = "0.8.6"
end
@@ -57,6 +57,11 @@ module Spinach
Spinach.hooks.reset
end
+ it "binds a callback before running" do
+ @reporter.expects(:before_run)
+ Spinach.hooks.run_before_run
+ end
+
it "binds a callback after running" do
@reporter.expects(:after_run)
Spinach.hooks.run_after_run

0 comments on commit 903f4be

Please sign in to comment.