Class: RuboCop::Cop::OpenProject::NoSleepInFeatureSpecs
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::OpenProject::NoSleepInFeatureSpecs
- Defined in:
- lib/rubocop/cop/open_project/no_sleep_in_feature_specs.rb
Overview
Checks that feature specs do not use ‘sleep` greater than 1 second.
Relying on ‘sleep` for synchronization reduces overall performance of the test suite. Consider using Capybara `have_*` matchers or rspec-wait `wait_for` method instead.
Constant Summary collapse
- MSG =
"Avoid using `sleep` greater than 1 second in feature specs. " \ "It will reduce overall performance of the test suite. " \ "Consider using Capybara `have_*` matchers or rspec-wait " \ "`wait_for` method instead."
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/rubocop/cop/open_project/no_sleep_in_feature_specs.rb', line 43 def on_send(node) return unless feature_spec?(processed_source) on_sleep_call(node) do |args| add_offense(node, message: MSG) if sleeping_too_much?(args[0]) end end |