Skip to content

Commit

Permalink
reporter figures out load time and sends to formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Mar 23, 2013
1 parent 1bd432b commit bb80523
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/rspec/core/reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ def report(expected_example_count, seed=nil)
end
end

def start(expected_example_count)
@start = RSpec::Core::Time.now
notify :start, expected_example_count
def start(expected_example_count,time = RSpec::Core::Time.now)
@start = time
load_time = (@start - RSpec.configuration.start_time).to_f
notify :start, expected_example_count, load_time
end

def message(message)
Expand Down
12 changes: 12 additions & 0 deletions spec/rspec/core/reporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ module RSpec::Core
end
end

describe 'start' do
it 'notifies the formatter of start with example count and load time' do
formatter = double("formatter")
example = double("example")
reporter = Reporter.new(formatter)

formatter.should_receive(:start).with(0,5)
RSpec.configuration.start_time = 5
reporter.start 0, 10
end
end

context "given one formatter" do
it "passes messages to that formatter" do
formatter = double("formatter")
Expand Down

0 comments on commit bb80523

Please sign in to comment.