Sha256: beea9ef82b63a312c0068d5ad37ac396262a6f847ab4c9c702f0174020ae0c03

Contents?: true

Size: 660 Bytes

Versions: 3

Compression:

Stored size: 660 Bytes

Contents

require 'spec_helper'
require 'remarkable/active_record'

describe Remarkable::ActiveRecord::Matchers::ValidateAsCpfMatcher do
  context "on a attribute which validates cpf" do
    it "should require a valid CPF" do
      @user = User.new(:cpf => '123456')
      @user.should validate_as_cpf(:cpf)
    end

    it "should allow a nil value" do
      @user = User.new(:cpf => nil)
      @user.should validate_as_cpf(:cpf)
    end
  end

  context "on a attribute which not validates cpf" do
    before do
      @user = Admin.new(:cpf => '123456')
    end

    it "should not require a valid CPF" do
      @user.should_not validate_as_cpf(:cpf)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
validates_cpf-0.2.2 spec/remarkable/validate_as_cpf_matcher_spec.rb
validates_cpf-0.2.1 spec/remarkable/validate_as_cpf_matcher_spec.rb
validates_cpf-0.2.0 spec/remarkable/validate_as_cpf_matcher_spec.rb