Commit ffd109af authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add tests for QA test selectors sanity scenario

parent 7725a707
...@@ -15,7 +15,7 @@ module QA ...@@ -15,7 +15,7 @@ module QA
validators.map(&:errors).flatten.tap do |errors| validators.map(&:errors).flatten.tap do |errors|
break if errors.none? break if errors.none?
STDERR.puts <<~EOS $stderr.puts <<~EOS
GitLab QA sanity selectors validation test detected problems GitLab QA sanity selectors validation test detected problems
with your merge request! with your merge request!
...@@ -40,7 +40,7 @@ module QA ...@@ -40,7 +40,7 @@ module QA
EOS EOS
STDERR.puts errors $stderr.puts errors
end end
validators.each(&:validate!) validators.each(&:validate!)
......
describe QA::Scenario::Test::Sanity::Selectors do
let(:validator) { spy('validator') }
before do
stub_const('QA::Page::Validator', validator)
end
context 'when there are errors detected' do
before do
allow(validator).to receive(:errors).and_return(['some error'])
end
it 'outputs information about errors' do
expect { described_class.perform }
.to output(/some error/).to_stderr
expect { described_class.perform }
.to output(/electors validation test detected problems/)
.to_stderr
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!)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment