Sha256: b2bb6da90552033c7ea4af767f2819b079026d6d4abeb82b39d257a5218dbc1e

Contents?: true

Size: 734 Bytes

Versions: 7

Compression:

Stored size: 734 Bytes

Contents

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

describe CLIUtils::NonNilValidator do
  it 'confirms that its input is non-nil' do
    v = CLIUtils::NonNilValidator.new
    v.validate('bachya')
    expect(v.is_valid).to be_true
    expect(v.message).to eq('Nil text not allowed')
  end

  it 'confirms that its input is not non-nil' do
    v = CLIUtils::NonNilValidator.new
    v.validate('')
    expect(v.is_valid).to_not be_true
    expect(v.message).to eq('Nil text not allowed')

    v.validate(nil)
    expect(v.is_valid).to_not be_true
    expect(v.message).to eq('Nil text not allowed')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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