Sha256: 32e673b00074eed1c068f0e3c52910133059cad422e7562540b13451f7d60d59
Contents?: true
Size: 841 Bytes
Versions: 2
Compression:
Stored size: 841 Bytes
Contents
require 'spec_helper' describe TelephoneValidator do context "when telephone is invalid" do before :each do @user = User.new(:telephone => "12345") end it "should set object as invalid" do @user.valid?.should be_false end it "should set an error on attribute" do @user.valid? @user.errors[:telephone].should == ['is invalid'] end end context "when telephone is valid" do before :each do @user = User.new(:telephone => "(11)1111-1111") end it "should set object as valid" do @user.valid?.should be_true end it "should not set an error on attribute" do @user.valid? @user.errors[:telephone].should be_blank end end it "should accept a nil value" do @user = User.new(:telephone => nil) @user.valid?.should be_true end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_telephone-0.1.0 | spec/validates_telephone_spec.rb |
validates_telephone-0.0.1 | spec/validates_telephone_spec.rb |