Permalink
Browse files

configure load time

  • Loading branch information...
JonRowe committed Mar 23, 2013
1 parent cf60482 commit b45f8817d94e71458f9504177db5127d5648157f
Showing with 15 additions and 0 deletions.
  1. +4 −0 lib/rspec/core/configuration.rb
  2. +11 −0 spec/rspec/core/configuration_spec.rb
@@ -172,6 +172,9 @@ def self.add_setting(name, opts={})
# end
add_setting :treat_symbols_as_metadata_keys_with_true_values
+ # Record the start time of the spec suite to measure load time
+ add_setting :start_time
+
# @private
add_setting :tty
# @private
@@ -193,6 +196,7 @@ def self.add_setting(name, opts={})
]
def initialize
+ @start_time = Time.now
@expectation_frameworks = []
@include_or_extend_modules = []
@mock_framework = nil
@@ -1403,5 +1403,16 @@ def metadata_hash(*args)
expect(groups.ordered).to eq([4, 3, 2, 1])
end
end
+
+ describe 'recording spec start time (for measuring load)' do
+ it 'returns a time' do
+ expect(config.start_time).to be_a Time
+ end
+ it 'is configuratble' do
+ time = Time.new - 5
+ config.start_time = time
+ expect(config.start_time).to eq time
+ end
+ end
end
end

0 comments on commit b45f881

Please sign in to comment.