Sha256: 6c1ef54a4738cf1cc218bffdc026c4bd6ce90f7efb0207c7e861d3f3a8d26393

Contents?: true

Size: 650 Bytes

Versions: 2

Compression:

Stored size: 650 Bytes

Contents

require 'spec_helper'

describe Shoulda::Matchers::ActiveModel::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 accept a nil CPF" 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

2 entries across 2 versions & 1 rubygems

Version Path
validates_cpf-0.1.1 spec/shoulda-matchers/validate_as_cpf_matcher_spec.rb
validates_cpf-0.1.0 spec/shoulda-matchers/validate_as_cpf_matcher_spec.rb