Sha256: f603a2c28e2a0418d1683aceeba7dddac91480cfe74f15803f2d4eea3e92bb5d
Contents?: true
Size: 1.15 KB
Versions: 10
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' describe HashValidator::Validator::Base do let(:name) { 'my_validator' } it 'allows a validator to be created with a valid name' do expect { HashValidator::Validator::Base.new(name) }.to_not raise_error end it 'does not allow a validator to be created with an invalid name' do expect { HashValidator::Validator::Base.new(nil) }.to raise_error(StandardError, 'Validator must be initialized with a valid name (string with length greater than zero)') expect { HashValidator::Validator::Base.new(123) }.to raise_error(StandardError, 'Validator must be initialized with a valid name (string with length greater than zero)') expect { HashValidator::Validator::Base.new('') }.to raise_error(StandardError, 'Validator must be initialized with a valid name (string with length greater than zero)') end describe '#validate' do let(:validator) { HashValidator::Validator::Base.new('test') } it 'throws an exception as base validators cant actually validate' do expect { validator.validate('key', 'value', {}, {}) }.to raise_error(StandardError, 'validate should not be called directly on BaseValidator') end end end
Version data entries
10 entries across 10 versions & 1 rubygems