summaryrefslogtreecommitdiff
path: root/spec/support/shared_examples/malicious_regexp_shared_examples.rb
blob: ac5d22298bbf7e3230c559a63faf18cfeb39d772 (plain)
1
2
3
4
5
6
7
8
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