summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hanreich <stefanhani@gmail.com>2017-05-11 20:04:36 +0200
committerStefan Hanreich <stefanhani@gmail.com>2017-06-18 23:57:22 +0200
commite02ca5fdb7f9b9a7e52d0e6edfb3be65860818a5 (patch)
treec7f64b6a6591c06699fd16ce0b6c3e53af79218f
parent39b2d730847a918fd5d7cca207e687c77f1d9ceb (diff)
downloadgitlab-ce-e02ca5fdb7f9b9a7e52d0e6edfb3be65860818a5.tar.gz
Updated spec for build to include new ref_slug invariants
-rw-r--r--spec/models/ci/build_spec.rb24
1 files changed, 16 insertions, 8 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index 3816422fec6..a54261667bd 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -1033,19 +1033,27 @@ describe Ci::Build, :models do
end
describe '#ref_slug' do
+ let(:build) { build(:ci_build, ref: "'100%") }
+ subject { build.ref_slug }
+
+ it { is_expected.not_to start_with('-') }
+ it { is_expected.not_to end_with('-') }
+
{
- 'master' => 'master',
- '1-foo' => '1-foo',
- 'fix/1-foo' => 'fix-1-foo',
- 'fix-1-foo' => 'fix-1-foo',
- 'a' * 63 => 'a' * 63,
- 'a' * 64 => 'a' * 63,
- 'FOO' => 'foo'
+ 'master' => 'master',
+ '1-foo' => '1-foo',
+ 'fix/1-foo' => 'fix-1-foo',
+ 'fix-1-foo' => 'fix-1-foo',
+ 'a' * 63 => 'a' * 63,
+ 'a' * 64 => 'a' * 63,
+ 'FOO' => 'foo',
+ '-' + 'a' * 61 + '-' => 'a' * 61,
+ 'a' * 62 + ' ' => 'a' * 62,
}.each do |ref, slug|
it "transforms #{ref} to #{slug}" do
build.ref = ref
- expect(build.ref_slug).to eq(slug)
+ is_expected.to eq(slug)
end
end
end