Commit 1bf1736d authored by Mark Lapierre's avatar Mark Lapierre

Check for the important part of the error message

This avoids false negatives if the unimportant text changes again
but the core message stays the same
parent 4cb17656
...@@ -25,7 +25,7 @@ module QA ...@@ -25,7 +25,7 @@ module QA
push = push_new_file(branch_name) push = push_new_file(branch_name)
expect(push.output).to match(/remote: To create a merge request for protected-branch, visit/) expect(push.output).to match(/To create a merge request for protected-branch, visit/)
end end
end end
...@@ -35,7 +35,7 @@ module QA ...@@ -35,7 +35,7 @@ module QA
roles: Resource::ProtectedBranch::Roles::NO_ONE roles: Resource::ProtectedBranch::Roles::NO_ONE
}) })
expect { push_new_file(branch_name) }.to raise_error(QA::Support::Run::CommandError, /remote: GitLab: You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/) expect { push_new_file(branch_name) }.to raise_error(QA::Support::Run::CommandError, /You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/)
end end
end end
......
...@@ -12,13 +12,13 @@ module QA ...@@ -12,13 +12,13 @@ module QA
it 'unselected maintainer user fails to push' do it 'unselected maintainer user fails to push' do
expect { push_new_file(branch_name, as_user: user_maintainer) }.to raise_error( expect { push_new_file(branch_name, as_user: user_maintainer) }.to raise_error(
QA::Support::Run::CommandError, QA::Support::Run::CommandError,
/remote: GitLab: You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/) /You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/)
end end
it 'selected developer user pushes and merges' do it 'selected developer user pushes and merges' do
push = push_new_file(branch_name, as_user: user_developer) push = push_new_file(branch_name, as_user: user_developer)
expect(push.output).to match(/remote: To create a merge request for protected-branch, visit/) expect(push.output).to match(/To create a merge request for protected-branch, visit/)
Resource::MergeRequest.fabricate_via_api! do |merge_request| Resource::MergeRequest.fabricate_via_api! do |merge_request|
merge_request.project = project merge_request.project = project
......
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