Sha256: 8eb25a02fef939c35b17acb6b2993e991c5a58208213b654e1f59b488fc52b8a

Contents?: true

Size: 660 Bytes

Versions: 7

Compression:

Stored size: 660 Bytes

Contents

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

describe CLIUtils::NumberValidator do
  it 'confirms that its input is a number' do
    v = CLIUtils::NumberValidator.new
    v.validate('12345.678')
    expect(v.is_valid).to be_true
    expect(v.message).to eq('Response is not a number: 12345.678')
  end

  it 'confirms that its input is not a number' do
    v = CLIUtils::NumberValidator.new
    v.validate('bachya')
    expect(v.is_valid).to_not be_true
    expect(v.message).to eq('Response is not a number: bachya')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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