2018-05-18 08:14:10 +00:00
|
|
|
require 'timeout'
|
|
|
|
|
2017-06-22 15:33:17 +00:00
|
|
|
shared_examples 'malicious regexp' do
|
2019-01-16 12:09:29 +00:00
|
|
|
let(:malicious_text) { 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!' }
|
2019-02-25 14:41:52 +00:00
|
|
|
let(:malicious_regexp_re2) { '(?i)^(([a-z])+.)+[A-Z]([a-z])+$' }
|
|
|
|
let(:malicious_regexp_ruby) { '/^(([a-z])+.)+[A-Z]([a-z])+$/i' }
|
2017-06-22 15:33:17 +00:00
|
|
|
|
|
|
|
it 'takes under a second' do
|
|
|
|
expect { Timeout.timeout(1) { subject } }.not_to raise_error
|
|
|
|
end
|
|
|
|
end
|