Commit e4392000 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'frozen-string-enable-spec-validators' into 'master'

Enable frozen string for spec/validators

See merge request gitlab-org/gitlab!18367
parents a7e32334 6b29cebb
# frozen_string_literal: true
require 'spec_helper'
describe BranchFilterValidator do
......@@ -6,25 +8,25 @@ describe BranchFilterValidator do
describe '#validates_each' do
it 'allows valid branch names' do
validator.validate_each(hook, :push_events_branch_filter, "good_branch_name")
validator.validate_each(hook, :push_events_branch_filter, "another/good_branch_name")
validator.validate_each(hook, :push_events_branch_filter, +"good_branch_name")
validator.validate_each(hook, :push_events_branch_filter, +"another/good_branch_name")
expect(hook.errors.empty?).to be true
end
it 'disallows bad branch names' do
validator.validate_each(hook, :push_events_branch_filter, "bad branch~name")
validator.validate_each(hook, :push_events_branch_filter, +"bad branch~name")
expect(hook.errors[:push_events_branch_filter].empty?).to be false
end
it 'allows wildcards' do
validator.validate_each(hook, :push_events_branch_filter, "features/*")
validator.validate_each(hook, :push_events_branch_filter, "features/*/bla")
validator.validate_each(hook, :push_events_branch_filter, "*-stable")
validator.validate_each(hook, :push_events_branch_filter, +"features/*")
validator.validate_each(hook, :push_events_branch_filter, +"features/*/bla")
validator.validate_each(hook, :push_events_branch_filter, +"*-stable")
expect(hook.errors.empty?).to be true
end
it 'gets rid of whitespace' do
filter = ' master '
filter = +' master '
validator.validate_each(hook, :push_events_branch_filter, filter)
expect(filter).to eq 'master'
......
# frozen_string_literal: true
require 'spec_helper'
describe JsRegexValidator do
......
# frozen_string_literal: true
require 'spec_helper'
describe NamespacePathValidator do
......@@ -5,7 +7,7 @@ describe NamespacePathValidator do
describe '.valid_path?' do
it 'handles invalid utf8' do
expect(described_class.valid_path?("a\0weird\255path")).to be_falsey
expect(described_class.valid_path?(+"a\0weird\255path")).to be_falsey
end
end
......
# frozen_string_literal: true
require 'spec_helper'
describe ProjectPathValidator do
......@@ -5,7 +7,7 @@ describe ProjectPathValidator do
describe '.valid_path?' do
it 'handles invalid utf8' do
expect(described_class.valid_path?("a\0weird\255path")).to be_falsey
expect(described_class.valid_path?(+"a\0weird\255path")).to be_falsey
end
end
......
# frozen_string_literal: true
require 'spec_helper'
describe PublicUrlValidator do
......
# frozen_string_literal: true
require 'spec_helper'
describe VariableDuplicatesValidator do
......
# frozen_string_literal: true
require 'spec_helper'
describe X509CertificateCredentialsValidator do
......
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