Sha256: 68aa07a46b21bd2be05f0c5c4e74c73e8edc0df9aa56a999821b056fe4f068ee
Contents?: true
Size: 878 Bytes
Versions: 1
Compression:
Stored size: 878 Bytes
Contents
require 'remarkable/active_record' module Remarkable module ActiveRecord module Matchers class ValidateAsTelephoneMatcher < Remarkable::ActiveRecord::Base arguments :telephone collection_assertions :telephone_valid?, :allow_nil?, :formatted_number? protected def telephone_valid? @subject.telephone = '123456' @subject.valid?.errors[:telephone].should == ['is invalid'] end def allow_nil? @subject.telephone = nil @subject.valid?.errors[:telephone].should == [] end def formatted_number? @subject.telephone = '1122223333' @subject.valid?.telephone.should == '(11)2222-3333' end end def validate_as_telephone(*args, &block) ValidateAsTelephoneMatcher.new(*args, &block).spec(self) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_telephone-0.1.0 | lib/validates_telephone/remarkable/validate_as_telephone_matcher.rb |