Sha256: d7a5c619cf3b31b8c1894947a8ed9b2c6c28dd17c51822edb010b198f98b8fb6

Contents?: true

Size: 552 Bytes

Versions: 6

Compression:

Stored size: 552 Bytes

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ecma-re-validator-0.3.0 spec/validator_spec.rb
ecma-re-validator-0.2.1 spec/validator_spec.rb
ecma-re-validator-0.2.0 spec/validator_spec.rb
ecma-re-validator-0.1.2 spec/validator_spec.rb
ecma-re-validator-0.1.1 spec/validator_spec.rb
ecma-re-validator-0.1.0 spec/validator_spec.rb