Sha256: e9128dd4cd88f5fa2b4de40ac86dbe0856f8e0a202472588568caf582c02ba96
Contents?: true
Size: 681 Bytes
Versions: 2
Compression:
Stored size: 681 Bytes
Contents
require 'remarkable/active_model' module Remarkable module ActiveModel module Matchers class IpMatcher < Remarkable::ActiveModel::Base arguments :ip collection_assertions :accept_valid_value?, :reject_valid_value? protected def accept_valid_value? @subject.domain_name = '10.10.10.1' @subject.valid?.errors[:ip].should == [] end def reject_valid_value? @subject.domain_name = '01' @subject.valid?.errors[:ip].should == ['is invalid'] end end def require_a_valid_ip(*args, &block) IpMatcher.new(*args, &block).spec(self) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_host-0.3.1 | lib/validates_host/remarkable/ip_matcher.rb |
validates_host-0.3.0 | lib/validates_host/remarkable/ip_matcher.rb |