Sha256: 21ed570a90db581ee0df5947d637c238c63c5cdc41684f7e6d69c3a7f5e8715c
Contents?: true
Size: 726 Bytes
Versions: 2
Compression:
Stored size: 726 Bytes
Contents
# frozen_string_literal: true require 'shoulda-matchers' module Shoulda module Matchers module ActiveModel def require_a_valid_host_name(attribute = :host_name) RequireAValidHostNameMatcher.new(attribute) end class RequireAValidHostNameMatcher < ValidationMatcher def description "require #{@attribute} to be a valid host name" end def matches?(subject) super(subject) disallows_invalid_value && allows_valid_value end private def disallows_invalid_value disallows_value_of('1bd') end def allows_valid_value allows_value_of('bd01') end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_host-1.3.0 | lib/validates_host/require_a_valid_host_name_matcher.rb |
validates_host-1.2.0 | lib/validates_host/require_a_valid_host_name_matcher.rb |