summaryrefslogtreecommitdiff
path: root/qa/spec
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-12-22 16:09:00 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-12-22 16:09:00 +0100
commitd2c2f93fe6ed557ecfbc53afedef899dd49b244d (patch)
tree15a691d41caed4bb917354b7d6f8b492f8d30ce5 /qa/spec
parentd69e4541a4874208590a7387186f8929143fd2af (diff)
downloadgitlab-ce-d2c2f93fe6ed557ecfbc53afedef899dd49b244d.tar.gz
Append page validation error if view partial is missing
Diffstat (limited to 'qa/spec')
-rw-r--r--qa/spec/page/view_spec.rb51
1 files changed, 31 insertions, 20 deletions
diff --git a/qa/spec/page/view_spec.rb b/qa/spec/page/view_spec.rb
index 6a78e32db68..dd38b171ad5 100644
--- a/qa/spec/page/view_spec.rb
+++ b/qa/spec/page/view_spec.rb
@@ -30,36 +30,47 @@ describe QA::Page::View do
allow(File).to receive(:new).and_return(file)
end
- context 'when pattern is found' do
+ context 'when view partial is present' do
before do
- allow(file).to receive(:foreach)
- .and_yield('some element').once
- allow(element).to receive(:matches?)
- .with('some element').and_return(true)
+ allow(subject.pathname).to receive(:readable?)
+ .and_return(true)
end
- it 'walks through the view and asserts on elements existence' do
- expect(subject.errors).to be_empty
- end
- end
+ context 'when pattern is found' do
+ before do
+ allow(file).to receive(:foreach)
+ .and_yield('some element').once
+ allow(element).to receive(:matches?)
+ .with('some element').and_return(true)
+ end
- context 'when pattern has not been found' do
- before do
- allow(file).to receive(:foreach)
- .and_yield('some element').once
- allow(element).to receive(:matches?)
- .with('some element').and_return(false)
+ it 'walks through the view and asserts on elements existence' do
+ expect(subject.errors).to be_empty
+ end
end
- it 'returns an array of errors related to missing elements' do
- expect(subject.errors).not_to be_empty
- expect(subject.errors.first)
- .to match %r(Missing element `.*` in `.*/some/file.html` view)
+ context 'when pattern has not been found' do
+ before do
+ allow(file).to receive(:foreach)
+ .and_yield('some element').once
+ allow(element).to receive(:matches?)
+ .with('some element').and_return(false)
+ end
+
+ it 'returns an array of errors related to missing elements' do
+ expect(subject.errors).not_to be_empty
+ expect(subject.errors.first)
+ .to match %r(Missing element `.*` in `.*/some/file.html` view)
+ end
end
end
context 'when view partial has not been found' do
- pending
+ it 'returns an error when it is not able to find the partial' do
+ expect(subject.errors).to be_one
+ expect(subject.errors.first)
+ .to match %r(Missing view partial `.*/some/file.html`!)
+ end
end
end
end