Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove block format from reporter

  • Loading branch information...
commit e759b75b0eb63c0a44f973bff9d22658380a1a9f 1 parent 1f3b175
@dchelimsky dchelimsky authored
View
17 lib/rspec/core/command_line.rb
@@ -18,15 +18,18 @@ def run(err, out)
configuration.output_stream = out
world.announce_inclusion_filter
- configuration.reporter.report(example_count) do |reporter|
- begin
- configuration.run_hook(:before, :suite)
- example_groups.run_examples(reporter)
- ensure
- configuration.run_hook(:after, :suite)
- end
+ reporter = configuration.reporter
+ reporter.start(example_count)
+
+ begin
+ configuration.run_hook(:before, :suite)
+ example_groups.run_examples(reporter)
+ ensure
+ configuration.run_hook(:after, :suite)
end
+ reporter.stop
+
example_groups.success?
end
View
2  lib/rspec/core/configuration.rb
@@ -193,7 +193,7 @@ def formatter=(formatter_to_use)
def string_const?(str)
str.is_a?(String) && /\A[A-Z][a-zA-Z0-9_:]*\z/ =~ str
end
-
+
def formatter
@formatter ||= formatter_class.new(output)
end
View
30 lib/rspec/core/formatters/base_formatter.rb
@@ -22,17 +22,12 @@ def failed_examples
@failed_examples ||= ::RSpec.world.find(examples, :execution_result => { :status => 'failed' })
end
- def report(count)
- sync_output do
- start(count)
- begin
- yield self
- ensure
- stop
- dump(@duration)
- close
- end
- end
+ def start_sync_output
+ @old_sync, output.sync = output.sync, true if output_supports_sync
+ end
+
+ def restore_sync_status
+ output.sync = @old_sync if output_supports_sync
end
# This method is invoked before any examples are run, right after
@@ -42,12 +37,16 @@ def report(count)
# This method will only be invoked once, and the next one to be invoked
# is #add_example_group
def start(example_count)
+ start_sync_output
@start = Time.now
@example_count = example_count
end
def stop
@duration = Time.now - @start
+ dump(@duration)
+ close
+ restore_sync_status
end
def example_finished(example)
@@ -129,15 +128,6 @@ def read_failed_line(exception, example)
end
end
- def sync_output
- begin
- old_sync, output.sync = output.sync, true if output_supports_sync
- yield
- ensure
- output.sync = old_sync if output_supports_sync
- end
- end
-
def output_supports_sync
output.respond_to?(:sync=)
end
Please sign in to comment.
Something went wrong with that request. Please try again.