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

malicious_regexp_shared_examples.rb « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: db69b75c0c852f195f5e33c4e20443576fbb716d (plain)
1
2
3
4
5
6
7
8
9
10
require 'timeout'

shared_examples 'malicious regexp' do
  let(:malicious_text) { 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!' }
  let(:malicious_regexp) { '(?i)^(([a-z])+.)+[A-Z]([a-z])+$' }

  it 'takes under a second' do
    expect { Timeout.timeout(1) { subject } }.not_to raise_error
  end
end