diff options
Diffstat (limited to 'qa/spec/support/waiter_spec.rb')
-rw-r--r-- | qa/spec/support/waiter_spec.rb | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/qa/spec/support/waiter_spec.rb b/qa/spec/support/waiter_spec.rb index d0b216b5dc1..c575a27bc35 100644 --- a/qa/spec/support/waiter_spec.rb +++ b/qa/spec/support/waiter_spec.rb @@ -1,40 +1,11 @@ # frozen_string_literal: true RSpec.describe QA::Support::Waiter do - before do - logger = ::Logger.new $stdout - logger.level = ::Logger::DEBUG - QA::Runtime::Logger.logger = logger - end - describe '.wait_until' do - context 'when the condition is true' do - it 'logs the start' do - expect { subject.wait_until(max_duration: 0, raise_on_failure: false) { true } } - .to output(/with wait_until: max_duration: 0; reload_page: ; sleep_interval: 0.1/).to_stdout_from_any_process - end - - it 'logs the end' do - expect { subject.wait_until(max_duration: 0, raise_on_failure: false) { true } } - .to output(/ended wait_until$/).to_stdout_from_any_process - end - end - - context 'when the condition is false' do - it 'logs the start' do - expect { subject.wait_until(max_duration: 0, raise_on_failure: false) { false } } - .to output(/with wait_until: max_duration: 0; reload_page: ; sleep_interval: 0.1/).to_stdout_from_any_process - end - - it 'logs the end' do - expect { subject.wait_until(max_duration: 0, raise_on_failure: false) { false } } - .to output(/ended wait_until$/).to_stdout_from_any_process - end - end - it 'allows logs to be silenced' do - expect { subject.wait_until(max_duration: 0, raise_on_failure: false, log: false) { false } } - .not_to output.to_stdout_from_any_process + expect(subject).to receive(:repeat_until).with(hash_including(log: false)) + + subject.wait_until(log: false) end it 'sets max_duration to 60 by default' do |