Sha256: a41cbf9ef4faaf14a29adddfcf2941a7cdc60773da47899326c9193e968248a5

Contents?: true

Size: 638 Bytes

Versions: 7

Compression:

Stored size: 638 Bytes

Contents

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

describe CLIUtils::TimeValidator do
  it 'confirms that its input is a time' do
    v = CLIUtils::TimeValidator.new
    v.validate('12:43 AM')
    expect(v.is_valid).to be_true
    expect(v.message).to eq('Response is not a time: 12:43 AM')
  end

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

Version data entries

7 entries across 7 versions & 1 rubygems

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