Sha256: decebf467ba4ef158631cb7a4a1179aa5582af72f695bd4f4c7aad20b683a501
Contents?: true
Size: 775 Bytes
Versions: 1
Compression:
Stored size: 775 Bytes
Contents
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 initialize(attribute) @attribute = attribute end def description "require #{@attribute} to be a valid host name" end def matches?(subject) super(subject) disallows_invalid_value and 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_host-1.0.0 | lib/validates_host/require_a_valid_host_name_matcher.rb |