Module: RSpecTimeout
- Defined in:
- lib/rspec_timeout.rb,
lib/rspec_timeout/version.rb
Constant Summary collapse
- TIMEOUT_OPTS_DEFAULTS =
{ :timeout => 120 }.freeze
- SIGNAL_LEVEL =
"HUP"- VERSION =
"0.1.0"
Class Method Summary collapse
- .setup(rspec_config, timeout_opts = TIMEOUT_OPTS_DEFAULTS) ⇒ Object
- .setup_after_suite_hook(rspec_config) ⇒ Object
- .setup_before_suite_hook(rspec_config, timeout, timeout_string) ⇒ Object
Class Method Details
.setup(rspec_config, timeout_opts = TIMEOUT_OPTS_DEFAULTS) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/rspec_timeout.rb', line 8 def self.setup(rspec_config, timeout_opts=TIMEOUT_OPTS_DEFAULTS) timeout = timeout_opts.fetch(:timeout) timeout_string = "RSpec timeout killed your test suite because it took longer than #{timeout} seconds to run" setup_after_suite_hook(rspec_config) setup_before_suite_hook(rspec_config, timeout, timeout_string) end |
.setup_after_suite_hook(rspec_config) ⇒ Object
20 21 22 23 24 |
# File 'lib/rspec_timeout.rb', line 20 def self.setup_after_suite_hook(rspec_config) rspec_config.after(:suite) do Process.kill(SIGNAL_LEVEL, $rspec_timeout_fork) end end |
.setup_before_suite_hook(rspec_config, timeout, timeout_string) ⇒ Object
15 16 17 18 |
# File 'lib/rspec_timeout.rb', line 15 def self.setup_before_suite_hook(rspec_config, timeout, timeout_string) setup_timeout_process(timeout) setup_exit_signal_handler(timeout, timeout_string) end |