spec/bankgiro_spec.rb in banktools-se-0.8.0 vs spec/bankgiro_spec.rb in banktools-se-0.10.0
- old
+ new
@@ -103,10 +103,14 @@
end
it "raises if resulting number is > 25 digits" do
expect { BankTools::SE::Bankgiro.number_to_ocr("1234567890123456789012345") }.to raise_error(BankTools::SE::Bankgiro::OverlongOCR)
end
+
+ it "raises if input is non-numeric" do
+ expect { BankTools::SE::Bankgiro.number_to_ocr("garbage") }.to raise_error(BankTools::SE::Bankgiro::MustBeNumeric)
+ end
end
describe ".number_from_ocr" do
it "strips the mod-10 check digit" do
BankTools::SE::Bankgiro.number_from_ocr("1230").should eq "123"
@@ -124,8 +128,12 @@
BankTools::SE::Bankgiro.number_from_ocr("1234567890037", length_digit: true, pad: "0").should eq "1234567890"
end
it "raises if checksum is wrong" do
expect { BankTools::SE::Bankgiro.number_from_ocr("1231") }.to raise_error(BankTools::SE::Bankgiro::BadChecksum)
+ end
+
+ it "raises if input is non-numeric" do
+ expect { BankTools::SE::Bankgiro.number_from_ocr("garbage") }.to raise_error(BankTools::SE::Bankgiro::MustBeNumeric)
end
end
end