Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/bic_validation/bic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ def of_valid_length?
end

def of_valid_format?
@code =~ format
!!(@code =~ format)
end

def has_valid_country_code?
country_codes.include? country
country_codes.include?(country)
end

def has_valid_location_code?
# WTF? http://de.wikipedia.org/wiki/ISO_9362
location[0] =~ /[^01]/ && location[1] =~ /[^O]/
!!(location[0] =~ /[^01]/ && location[1] =~ /[^O]/)
end

def known?
Expand Down
4 changes: 2 additions & 2 deletions spec/bic_validation/bic_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module BicValidation
subject { @bic }

describe '#valid?' do
it { should be_valid }
it { expect([true, false]).to include(subject.valid?) }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about splitting this in two tests: asserting that valid? returns true when the Bic is valid and false otherwise?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but I think the shorter form does the same job, as it "expects that the return value of that function is either true or false". Any other value will not pass.

Is it about readability?

end

describe '#known?' do
Expand Down Expand Up @@ -55,7 +55,7 @@ module BicValidation
subject { @bic }

describe '#valid?' do
it { should be_valid }
it { expect([true, false]).to include(subject.valid?) }
end

describe '#known?' do
Expand Down