spec/bankgiro_spec.rb in banktools-se-0.3.0 vs spec/bankgiro_spec.rb in banktools-se-0.4.0
- old
+ new
@@ -1,16 +1,14 @@
require "spec_helper"
require "banktools-se"
describe BankTools::SE::Bankgiro do
-
it "should initialize" do
BankTools::SE::Bankgiro.new("foo").should be_a(BankTools::SE::Bankgiro)
end
describe "#valid?" do
-
it "should be true with no errors" do
account = BankTools::SE::Bankgiro.new("foo")
account.stub(:errors).and_return([])
account.should be_valid
end
@@ -18,11 +16,10 @@
it "should be false with errors" do
account = BankTools::SE::Bankgiro.new("foo")
account.stub(:errors).and_return([:error])
account.should_not be_valid
end
-
end
describe "#errors" do
# From http://www.carnegie.se/sv/Carnegie-fonder/Kopa-fonder/Bankgironummer/
[
@@ -52,15 +49,13 @@
end
it "should include :bad_checksum if the Luhn/mod 10 checksum is incorrect" do
BankTools::SE::Bankgiro.new("5402-9682").errors.should include(BankTools::SE::Errors::BAD_CHECKSUM)
end
-
end
describe "#normalize" do
-
it "should normalize 7-digit numbers to NNN-NNNN" do
account = BankTools::SE::Bankgiro.new(" 6-40 - 5070")
account.normalize.should == "640-5070"
end
@@ -71,15 +66,13 @@
it "should not attempt to normalize invalid numbers" do
account = BankTools::SE::Bankgiro.new(" 1-2-3 ")
account.normalize.should == " 1-2-3 "
end
-
end
describe "#fundraising? (90-konto)" do
-
it "should be true for the number series 900-nnnn to 904-nnnn" do
BankTools::SE::Bankgiro.new("902-0033").should be_fundraising
end
it "should be false for invalid numbers in the right series" do
@@ -87,9 +80,7 @@
end
it "should be false for numbers outside the right series" do
BankTools::SE::Bankgiro.new("5402-9681").should_not be_fundraising
end
-
end
-
end