Module: RspecTimeGuard
- Defined in:
- lib/rspec_time_guard.rb,
lib/rspec_time_guard/railtie.rb,
lib/rspec_time_guard/version.rb,
lib/rspec_time_guard/configuration.rb
Defined Under Namespace
Classes: Configuration, Railtie, TimeLimitExceededError, TimeoutMonitor
Constant Summary collapse
- VERSION =
'0.2.0'
Class Method Summary collapse
- .configuration ⇒ Object
- .configure {|configuration| ... } ⇒ Object
- .monitor ⇒ Object
-
.setup ⇒ Object
TODO: check warnings on test suite TODO: run test suite with new implementation and compare perfs TODO: speed up test suite => implement the ‘single monitor thread’ alternative TODO: CHeck how it works with other Ruby interpreters? (check which implem was tested) TODO: Handle RSpec summary manually? TODO: Run profiling on the whole test suite to check for performance issues.
Class Method Details
.configuration ⇒ Object
103 104 105 |
# File 'lib/rspec_time_guard.rb', line 103 def configuration @_configuration ||= RspecTimeGuard::Configuration.new end |
.configure {|configuration| ... } ⇒ Object
99 100 101 |
# File 'lib/rspec_time_guard.rb', line 99 def configure yield(configuration) end |
.monitor ⇒ Object
107 108 109 |
# File 'lib/rspec_time_guard.rb', line 107 def monitor @_monitor ||= TimeoutMonitor.new end |
.setup ⇒ Object
TODO: check warnings on test suite TODO: run test suite with new implementation and compare perfs TODO: speed up test suite
=> implement the 'single monitor thread' alternative
TODO: CHeck how it works with other Ruby interpreters? (check which implem was tested) TODO: Handle RSpec summary manually? TODO: Run profiling on the whole test suite to check for performance issues
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/rspec_time_guard.rb', line 118 def setup RSpec.configure do |config| config.around(:each) do |example| time_limit_seconds = example.[:time_limit_seconds] || RspecTimeGuard.configuration.global_time_limit_seconds next example.run unless time_limit_seconds RspecTimeGuard.monitor.register_test(example, time_limit_seconds, Thread.current) begin example.run rescue RspecTimeGuard::TimeLimitExceededError => e # NOTE: This changes the example's status to failed and records our error example.exception = e ensure RspecTimeGuard.monitor.unregister_test(example) end end end end |