Sha256: 00303a503054fd5ae5265ad5bfb0062a995d3f0ae14056db7d4cf58d04d09aba

Contents?: true

Size: 692 Bytes

Versions: 7

Compression:

Stored size: 692 Bytes

Contents

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

describe CLIUtils::DatetimeValidator do
  it 'confirms that its input is a datetime' do
    v = CLIUtils::DatetimeValidator.new
    v.validate('2014-02-01 12:34 PM')
    expect(v.is_valid).to be_true
    expect(v.message).to eq('Response is not a datetime: 2014-02-01 12:34 PM')
  end

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

Version data entries

7 entries across 7 versions & 1 rubygems

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