Sha256: 19b991d028880eabcd18edb8f9d348a9daf16337999610721c70ca217472fe98

Contents?: true

Size: 702 Bytes

Versions: 7

Compression:

Stored size: 702 Bytes

Contents

require_relative '../spec_helper'
require 'cliutils/messaging'
require 'cliutils/prefs/pref_validators/pref_validator'
require 'cliutils/prefs/pref_validators/alphanumeric_validator'

describe CLIUtils::AlphanumericValidator do
  it 'confirms that its input is alphanumeric' do
    v = CLIUtils::AlphanumericValidator.new
    v.validate('bachya91238 ')
    expect(v.is_valid).to be_true
    expect(v.message).to eq('Response is not alphanumeric: bachya91238 ')
  end

  it 'confirms that its input is not alphanumeric' do
    v = CLIUtils::AlphanumericValidator.new
    v.validate('!@&^')
    expect(v.is_valid).to_not be_true
    expect(v.message).to eq('Response is not alphanumeric: !@&^')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cliutils-2.2.6 spec/validator/alphanumeric_validator_spec.rb
cliutils-2.2.5 spec/validator/alphanumeric_validator_spec.rb
cliutils-2.2.4 spec/validator/alphanumeric_validator_spec.rb
cliutils-2.2.3 spec/validator/alphanumeric_validator_spec.rb
cliutils-2.2.2 spec/validator/alphanumeric_validator_spec.rb
cliutils-2.2.1 spec/validator/alphanumeric_validator_spec.rb
cliutils-2.2.0 spec/validator/alphanumeric_validator_spec.rb