Revert unnecesarry changes
This commit is contained in:
parent
46076f1599
commit
dbd0111390
|
@ -176,9 +176,12 @@ module Ci
|
||||||
# * Lowercased
|
# * Lowercased
|
||||||
# * Anything not matching [a-z0-9-] is replaced with a -
|
# * Anything not matching [a-z0-9-] is replaced with a -
|
||||||
# * Maximum length is 63 bytes
|
# * Maximum length is 63 bytes
|
||||||
|
# * First/Last Character is not a hyphen
|
||||||
def ref_slug
|
def ref_slug
|
||||||
slugified = ref.to_s.downcase
|
ref.to_s
|
||||||
slugified.gsub(/[^a-z0-9]/, '-')[0..62]
|
.downcase
|
||||||
|
.gsub(/[^a-z0-9]/, '-')[0..62]
|
||||||
|
.gsub(/(\A-+|-+\z)/, '')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Variables whose value does not depend on environment
|
# Variables whose value does not depend on environment
|
||||||
|
|
|
@ -998,13 +998,17 @@ describe Ci::Build, :models do
|
||||||
|
|
||||||
describe '#ref_slug' do
|
describe '#ref_slug' do
|
||||||
{
|
{
|
||||||
'master' => 'master',
|
'master' => 'master',
|
||||||
'1-foo' => '1-foo',
|
'1-foo' => '1-foo',
|
||||||
'fix/1-foo' => 'fix-1-foo',
|
'fix/1-foo' => 'fix-1-foo',
|
||||||
'fix-1-foo' => 'fix-1-foo',
|
'fix-1-foo' => 'fix-1-foo',
|
||||||
'a' * 63 => 'a' * 63,
|
'a' * 63 => 'a' * 63,
|
||||||
'a' * 64 => 'a' * 63,
|
'a' * 64 => 'a' * 63,
|
||||||
'FOO' => 'foo'
|
'FOO' => 'foo',
|
||||||
|
'-' + 'a' * 61 + '-' => 'a' * 61,
|
||||||
|
'-' + 'a' * 62 + '-' => 'a' * 62,
|
||||||
|
'-' + 'a' * 63 + '-' => 'a' * 62,
|
||||||
|
'a' * 62 + ' ' => 'a' * 62
|
||||||
}.each do |ref, slug|
|
}.each do |ref, slug|
|
||||||
it "transforms #{ref} to #{slug}" do
|
it "transforms #{ref} to #{slug}" do
|
||||||
build.ref = ref
|
build.ref = ref
|
||||||
|
|
|
@ -65,7 +65,7 @@ module AccessMatchersForController
|
||||||
end
|
end
|
||||||
|
|
||||||
matcher :be_allowed_for do |role|
|
matcher :be_allowed_for do |role|
|
||||||
match do |action, &block|
|
match do |action|
|
||||||
user = emulate_user(role, @membership)
|
user = emulate_user(role, @membership)
|
||||||
update_owner(@objects, user)
|
update_owner(@objects, user)
|
||||||
action.call
|
action.call
|
||||||
|
|
Loading…
Reference in New Issue