expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to force push code to a protected branch on this project.')
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to force push code to a protected branch on this project.')
end
it'raises an error if the user is not allowed to merge to protected branches'do
...
...
@@ -123,13 +122,13 @@ describe Gitlab::Checks::ChangeAccess do
expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to push code to protected branches on this project.')
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to push code to protected branches on this project.')
end
context'branch deletion'do
...
...
@@ -138,7 +137,7 @@ describe Gitlab::Checks::ChangeAccess do
context'if the user is not allowed to delete protected branches'do
it'raises an error'do
expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to delete protected branches from this project. Only a project master or owner can delete a protected branch.')
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You are not allowed to delete protected branches from this project. Only a project master or owner can delete a protected branch.')
end
end
...
...
@@ -151,13 +150,13 @@ describe Gitlab::Checks::ChangeAccess do
let(:protocol){'web'}
it'allows branch deletion'do
expect{subject}.not_toraise_error
expect{subject.exec}.not_toraise_error
end
end
context'over SSH or HTTP'do
it'raises an error'do
expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You can only delete protected branches using the web interface.')
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You can only delete protected branches using the web interface.')
end
end
end
...
...
@@ -178,7 +177,7 @@ describe Gitlab::Checks::ChangeAccess do
@@ -240,14 +239,14 @@ describe Gitlab::Checks::ChangeAccess do
it_behaves_like'check ignored when push rule unlicensed'
it'returns an error if the rule denies tag deletion'do
expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You cannot delete a tag')
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,'You cannot delete a tag')
end
context'when tag is deleted in web UI'do
let(:protocol){'web'}
it'ignores the push rule'do
expect(subject).tobe_truthy
expect(subject.exec).tobe_truthy
end
end
end
...
...
@@ -258,7 +257,7 @@ describe Gitlab::Checks::ChangeAccess do
it_behaves_like'check ignored when push rule unlicensed'
it'returns an error if the rule fails'do
expect{subject}.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
...
...
@@ -275,13 +274,13 @@ describe Gitlab::Checks::ChangeAccess do
it'returns an error if the rule fails for the committer'do
expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Committer's email 'ana@invalid.com' does not follow the pattern '.*@valid.com'")
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Committer's email 'ana@invalid.com' does not follow the pattern '.*@valid.com'")
end
it'returns an error if the rule fails for the author'do
expect{subject}.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
...
...
@@ -292,14 +291,14 @@ describe Gitlab::Checks::ChangeAccess do
it_behaves_like'check ignored when push rule unlicensed'
it'rejects the branch that is not allowed'do
expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Branch name does not follow the pattern '^(w*)$'")
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Branch name does not follow the pattern '^(w*)$'")
end
context'when the ref is not a branch ref'do
let(:ref){'a/ref/thats/not/abranch'}
it'allows the creation'do
expect{subject}.not_toraise_error
expect{subject.exec}.not_toraise_error
end
end
...
...
@@ -309,7 +308,7 @@ describe Gitlab::Checks::ChangeAccess do
end
it'rejects the branch that is not allowed'do
expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Branch name does not follow the pattern '^(w*)$'")
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Branch name does not follow the pattern '^(w*)$'")
end
end
...
...
@@ -318,7 +317,7 @@ describe Gitlab::Checks::ChangeAccess do
let(:ref){"refs/heads/#{project.default_branch}"}
it'allows the default branch even if it does not match push rule'do
expect{subject}.not_toraise_error
expect{subject.exec}.not_toraise_error
end
end
end
...
...
@@ -334,7 +333,7 @@ describe Gitlab::Checks::ChangeAccess do
it_behaves_like'check ignored when push rule unlicensed'
it'returns an error if the commit author is not a GitLab member'do
expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Author 'some@mail.com' is not a member of team")
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"Author 'some@mail.com' is not a member of team")
end
end
...
...
@@ -346,7 +345,7 @@ describe Gitlab::Checks::ChangeAccess do
it_behaves_like'check ignored when push rule unlicensed'
it"returns an error if a new or renamed filed doesn't match the file name regex"do
expect{subject}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"File name README was blacklisted by the pattern READ*.")
expect{subject.exec}.toraise_error(Gitlab::GitAccess::UnauthorizedError,"File name README was blacklisted by the pattern READ*.")
end
end
...
...
@@ -373,7 +372,7 @@ describe Gitlab::Checks::ChangeAccess do