test/validations/barcode_test.rb in activevalidators-3.1.2 vs test/validations/barcode_test.rb in activevalidators-3.2.0
- old
+ new
@@ -2,10 +2,18 @@
ActiveValidators.activate(:barcode)
describe "Barcode Validation" do
describe "EAN13 Validation" do
it "accepts valid EAN13s" do
- subject = build_barcode_record :ean13, :barcode => "9782940199617"
+ ["9782940199617", "9782940199600"].each do |barcode|
+ subject = build_barcode_record :ean13, :barcode => barcode
+ subject.valid?.must_equal true
+ subject.errors.size.must_equal 0
+ end
+ end
+
+ it "accepts EAN13s as integers" do
+ subject = build_barcode_record :ean13, :barcode => 9782940199617
subject.valid?.must_equal true
subject.errors.size.must_equal 0
end
describe "for invalid EAN13s" do