open-companies-house 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,7 @@ module CompaniesHouse
30
30
  number = "0" + number if number.length == 7 # 0-pad for luck
31
31
 
32
32
  msg = "#{number} is not a valid UK company registration number"
33
- raise InvalidRegistration.new(msg) unless number =~ /\A[0-9]{8}\z/
33
+ raise InvalidRegistration.new(msg) unless number =~ /\A[A-Z0-9]{8}\z/
34
34
 
35
35
  number
36
36
  end
@@ -1,3 +1,3 @@
1
1
  module CompaniesHouse
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
@@ -18,15 +18,21 @@ describe CompaniesHouse::Request do
18
18
  }.to raise_exception CompaniesHouse::InvalidRegistration
19
19
  end
20
20
 
21
- it "that's not numeric" do
21
+ it "that's nil" do
22
22
  expect {
23
- subject.new "abcdefgh"
23
+ subject.new nil
24
24
  }.to raise_exception CompaniesHouse::InvalidRegistration
25
25
  end
26
26
 
27
- it "that's nil" do
27
+ it "that contains spaces" do
28
28
  expect {
29
- subject.new nil
29
+ subject.new "1234 ABC"
30
+ }.to raise_exception CompaniesHouse::InvalidRegistration
31
+ end
32
+
33
+ it "that contains non alphanumeric chars" do
34
+ expect {
35
+ subject.new "1234?456"
30
36
  }.to raise_exception CompaniesHouse::InvalidRegistration
31
37
  end
32
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open-companies-house
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: