Sha256: 9d0f0fe128abf9b38ecf8bdfae16c7a17927c9262a214237a7e816ace456bca5
Contents?: true
Size: 791 Bytes
Versions: 5
Compression:
Stored size: 791 Bytes
Contents
require 'spec_helper' describe CpfValidator do context "when cpf is invalid" do before :each do @user = User.new(:cpf => "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[:cpf].should == ['is invalid'] end end context "when cpf is valid" do before :each do @user = User.new(:cpf => "11144477735") 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[:cpf].should be_blank end end it "should accept a nil value" do @user = User.new(:cpf => nil) @user.valid?.should be_true end end
Version data entries
5 entries across 5 versions & 1 rubygems