Sha256: 867adf64a1f8ad40a4b3f91b23c7eb955309ac2381ab0c1022d59421152cdb9f
Contents?: true
Size: 796 Bytes
Versions: 1
Compression:
Stored size: 796 Bytes
Contents
require "shoulda-matchers" module Shoulda module Matchers module ActiveModel def require_a_valid_domain_name(attribute = :domain_name) RequireAValidDomainNameMatcher.new(attribute) end class RequireAValidDomainNameMatcher < ValidationMatcher def initialize(attribute) @attribute = attribute end def description "require #{@attribute} to be a valid domain name" end def matches?(subject) super(subject) disallows_invalid_value and allows_valid_value end private def disallows_invalid_value disallows_value_of("example") end def allows_valid_value allows_value_of("example.com") 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_domain_name_matcher.rb |