diff options
Diffstat (limited to 'qa/spec/support/wait_for_requests_spec.rb')
-rw-r--r-- | qa/spec/support/wait_for_requests_spec.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/qa/spec/support/wait_for_requests_spec.rb b/qa/spec/support/wait_for_requests_spec.rb index 2492820b67f..221d61ea2b4 100644 --- a/qa/spec/support/wait_for_requests_spec.rb +++ b/qa/spec/support/wait_for_requests_spec.rb @@ -5,37 +5,38 @@ RSpec.describe QA::Support::WaitForRequests do before do allow(subject).to receive(:finished_all_ajax_requests?).and_return(true) allow(subject).to receive(:finished_loading?).and_return(true) + allow(QA::Support::PageErrorChecker).to receive(:check_page_for_error_code) end context 'when skip_finished_loading_check is defaulted to false' do it 'calls finished_loading?' do - expect(subject).to receive(:finished_loading?).with(hash_including(wait: 1)) - subject.wait_for_requests + + expect(subject).to have_received(:finished_loading?).with(hash_including(wait: 1)) end end context 'when skip_finished_loading_check is true' do it 'does not call finished_loading?' do - expect(subject).not_to receive(:finished_loading?) - subject.wait_for_requests(skip_finished_loading_check: true) + + expect(subject).not_to have_received(:finished_loading?) end end context 'when skip_resp_code_check is defaulted to false' do it 'call report' do - allow(QA::Support::PageErrorChecker).to receive(:check_page_for_error_code).with(Capybara.page) - subject.wait_for_requests + + expect(QA::Support::PageErrorChecker).to have_received(:check_page_for_error_code).with(Capybara.page) end end context 'when skip_resp_code_check is true' do it 'does not parse for an error code' do - expect(QA::Support::PageErrorChecker).not_to receive(:check_page_for_error_code) - subject.wait_for_requests(skip_resp_code_check: true) + + expect(QA::Support::PageErrorChecker).not_to have_received(:check_page_for_error_code) end end end |