it_behaves_like'check ignored when push rule unlicensed'
it_behaves_like'check ignored when push rule unlicensed'
it'returns an error if the rule fails'do
it'returns an error if the rule fails'do
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Commit message does not follow the pattern '#{push_rule.commit_message_regex}'")
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Commit message does not follow the pattern '#{push_rule.commit_message_regex}'")
end
end
it'returns an error if the regex is invalid'do
push_rule.commit_message_regex='+'
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,/\ARegular expression '\+' is invalid/)
@@ -282,10 +288,16 @@ describe Gitlab::Checks::ChangeAccess do
...
@@ -282,10 +288,16 @@ describe Gitlab::Checks::ChangeAccess do
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Author's email 'joan@invalid.com' does not follow the pattern '.*@valid.com'")
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Author's email 'joan@invalid.com' does not follow the pattern '.*@valid.com'")
end
end
it'returns an error if the regex is invalid'do
push_rule.author_email_regex='+'
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,/\ARegular expression '\+' is invalid/)