1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
# frozen_string_literal: true
require 'spec_helper'
describe 'EcmaRe' do
it 'should fail if input is not a string or regexp' do
re = 92
expect(EcmaReValidator.valid?(re)).to eql(false)
end
it 'should fail if string is not resolvable' do
re = '(\w'
expect(EcmaReValidator.valid?(re)).to eql(false)
end
it 'passes for a valid regexp string' do
re = '[Ss]mith\\\\b'
expect(EcmaReValidator.valid?(re)).to eql(true)
end
it 'passes for a valid regexp' do
re = /[Ss]mith\\\\b/
expect(EcmaReValidator.valid?(re)).to eql(true)
end
end
|