Sha256: 64c1c30faa8a5691fd9ef76e2a5fd966651fa2e35c6ec1a3b348467b387be12b

Contents?: true

Size: 853 Bytes

Versions: 3

Compression:

Stored size: 853 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Develon::ValidatesAsVatNumber do
  it "is included" do
    class A < ActiveRecord::Base
      validates_as_vat_number :vat
    end
  end
  
  it "should validate Develon Company" do
    develon = Company.new(:name => 'Develon', :vat => 'IT03018900245')
    develon.valid?.should == true
  end
  
  it "should invalidate a fake company" do
    fake_company = Company.new(:name => 'Fake Company', :vat => 'IT000003018')
    fake_company.valid?.should == false
    fake_company.errors.on('vat').should == 'is an invalid VAT number'
  end
  
  it "should invalidate locally if country is not valid" do
    develon = Company.new(:name => 'Develon', :vat => 'KO03018900245')
    develon.valid?.should == false
    develon.errors.on('vat').should == 'has an invalid country'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
validates_as_vat_number-1.0.2 spec/validates_as_vat_number_spec.rb
validates_as_vat_number-1.0.1 spec/validates_as_vat_number_spec.rb
validates_as_vat_number-1.0.0 spec/validates_as_vat_number_spec.rb