Sha256: 545b71f16df1d7ece6224a42196cd15a75cc4a28235844fd60d1bb7559d0c087
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
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 a non-supported iso3661 country code" do fake_company = Company.new(:name => 'Fake Company', :vat => 'BO123456789') fake_company.valid?.should == false fake_company.errors.on('vat').should == 'has an invalid country' 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_as_vat_number-1.0.4 | spec/validates_as_vat_number_spec.rb |
validates_as_vat_number-1.0.3 | spec/validates_as_vat_number_spec.rb |