debian-mirror-gitlab/qa/spec/scenario/test/sanity/selectors_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.2 KiB
Ruby
Raw Normal View History

2019-07-31 22:56:46 +05:30
# frozen_string_literal: true
2021-01-03 14:25:43 +05:30
RSpec.describe QA::Scenario::Test::Sanity::Selectors do
2018-03-17 18:26:18 +05:30
let(:validator) { spy('validator') }
before do
stub_const('QA::Page::Validator', validator)
2022-08-27 11:52:29 +05:30
allow(QA::Runtime::Logger).to receive(:warn)
allow(QA::Runtime::Logger).to receive(:info)
2018-03-17 18:26:18 +05:30
end
context 'when there are errors detected' do
2022-08-27 11:52:29 +05:30
let(:error) { 'some error' }
2018-03-17 18:26:18 +05:30
before do
2022-08-27 11:52:29 +05:30
allow(validator).to receive(:errors).and_return([error])
2018-03-17 18:26:18 +05:30
end
2022-08-27 11:52:29 +05:30
it 'outputs information about errors', :aggregate_failures do
described_class.perform
expect(QA::Runtime::Logger).to have_received(:warn)
.with(/GitLab QA sanity selectors validation test detected problems/)
2018-03-17 18:26:18 +05:30
2022-08-27 11:52:29 +05:30
expect(QA::Runtime::Logger).to have_received(:warn)
.with(/#{error}/)
2018-03-17 18:26:18 +05:30
end
end
context 'when there are no errors detected' do
before do
allow(validator).to receive(:errors).and_return([])
end
it 'processes pages module' do
described_class.perform
expect(validator).to have_received(:new).with(QA::Page)
end
it 'triggers validation' do
described_class.perform
expect(validator).to have_received(:validate!).at_least(:once)
end
end
end