Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb')
-rw-r--r--spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb40
1 files changed, 1 insertions, 39 deletions
diff --git a/spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb b/spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb
index b021abc9f25..43f155091ad 100644
--- a/spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb
+++ b/spec/lib/gitlab/untrusted_regexp/ruby_syntax_spec.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'spec_helper'
+require 'fast_spec_helper'
RSpec.describe Gitlab::UntrustedRegexp::RubySyntax do
describe '.matches_syntax?' do
@@ -71,44 +71,6 @@ RSpec.describe Gitlab::UntrustedRegexp::RubySyntax do
end
end
- context 'when unsafe regexp is used' do
- include StubFeatureFlags
-
- before do
- # When removed we could use `require 'fast_spec_helper'` again.
- stub_feature_flags(allow_unsafe_ruby_regexp: true)
-
- allow(Gitlab::UntrustedRegexp).to receive(:new).and_raise(RegexpError)
- end
-
- context 'when no fallback is enabled' do
- it 'raises an exception' do
- expect { described_class.fabricate!('/something/') }
- .to raise_error(RegexpError)
- end
- end
-
- context 'when fallback is used' do
- it 'fabricates regexp with a single flag' do
- regexp = described_class.fabricate!('/something/i', fallback: true)
-
- expect(regexp).to eq Regexp.new('something', Regexp::IGNORECASE)
- end
-
- it 'fabricates regexp with multiple flags' do
- regexp = described_class.fabricate!('/something/im', fallback: true)
-
- expect(regexp).to eq Regexp.new('something', Regexp::IGNORECASE | Regexp::MULTILINE)
- end
-
- it 'fabricates regexp without flags' do
- regexp = described_class.fabricate!('/something/', fallback: true)
-
- expect(regexp).to eq Regexp.new('something')
- end
- end
- end
-
context 'when regexp is a raw pattern' do
it 'raises an error' do
expect { described_class.fabricate!('some .* thing') }