Sha256: d8edbeae92644eb6733512e7f1691bcdf2ffdf0c19fbb89fb6d0072b400c9db1
Contents?: true
Size: 885 Bytes
Versions: 2
Compression:
Stored size: 885 Bytes
Contents
require 'remarkable/active_record' module Remarkable module ActiveRecord module Matchers class ValidateAsBrTelephoneMatcher < 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_br_telephone(*args, &block) ValidateAsBrTelephoneMatcher.new(*args, &block).spec(self) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems