abn 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f49ac5ef0ea62f6204adcbfa6945b30ce4f4ebb4
4
+ data.tar.gz: f45c0205b87086ad67988d24adbc896be1739738
5
+ SHA512:
6
+ metadata.gz: 77b47c166cc6da204236485d738f4bdd0b0d113d4acae26c483142fe8121a2da6112a01c76c75d3dee4c41bee0c94bf1727422db0aafb450b8d74167fa59b53b
7
+ data.tar.gz: ba230921117bde94908a418f7fbf022e18f54cc32e8dfbcbe0812763c87de2dee9b1148f42e01661d9be5d0e560df89dc26d5654285d5552936c505b9b04469f
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v2.1.0
2
+ - Updated packaging to work well with ruby 1.9.3 to 2.4
3
+
1
4
  v2.0.0
2
5
  - remove ActiveRecord validation macro, it gets messy to maintain
3
6
  support for AR 2.x and 3.x so I opted to keep things simple and
@@ -1,27 +1,27 @@
1
1
  A small library for validating Australian Business Numbers (ABN)
2
2
 
3
- = Installation
3
+ # Installation
4
4
 
5
- gem install abn
5
+ gem install abn
6
6
 
7
- = Usage
7
+ # Usage
8
8
 
9
- require 'abn'
9
+ require 'abn'
10
10
 
11
- ABN.new("12042168743").valid?
12
- => true
11
+ ABN.new("12042168743").valid?
12
+ => true
13
13
 
14
- ABN.valid?("12042168743")
15
- => true
14
+ ABN.valid?("12042168743")
15
+ => true
16
16
 
17
- ABN.valid?("12042168744")
18
- => false
17
+ ABN.valid?("12042168744")
18
+ => false
19
19
 
20
- == With ActiveRecord
20
+ ## With ActiveRecord
21
21
 
22
22
  Version 1.3 of this gem had an active record mixin for validating ABN fields in
23
23
  models. I removed it in version 2.0 to avoid complications of supporting active
24
- record 2.x and 3.x.
24
+ record 2.x and 3.x (and Datamapper, Mongoid, etc).
25
25
 
26
26
  To validate an ABN field in your model add the ABN gem to your Gemfile and
27
27
  use the following pattern:
@@ -40,6 +40,7 @@ use the following pattern:
40
40
  end
41
41
  end
42
42
 
43
- = Further Reading
43
+ # Further Reading
44
44
 
45
- - http://www.clearwater.com.au/?action=code
45
+ - http://www.clearwater.com.au/code
46
+ - https://en.wikipedia.org/wiki/Australian_Business_Number
data/lib/abn.rb CHANGED
@@ -2,7 +2,7 @@ class ABN
2
2
 
3
3
  module Version #:nodoc:
4
4
  Major = 2
5
- Minor = 0
5
+ Minor = 1
6
6
  Tiny = 0
7
7
 
8
8
  String = [Major, Minor, Tiny].join('.')
@@ -1,68 +1,64 @@
1
- require "rubygems"
2
- require "bundler"
3
- Bundler.setup
4
-
5
1
  require "abn"
6
2
 
7
3
  describe ABN, "valid? class method" do
8
4
  it "should identify a valid ABN" do
9
- ABN.valid?("12042168743").should be_true
10
- ABN.valid?(12042168743).should be_true
5
+ expect(ABN.valid?("12042168743")).to be_truthy
6
+ expect(ABN.valid?(12042168743)).to be_truthy
11
7
  end
12
8
 
13
9
  it "should identify a preformatted valid ABN" do
14
- ABN.valid?("12 042 168 743").should be_true
10
+ expect(ABN.valid?("12 042 168 743")).to be_truthy
15
11
  end
16
12
 
17
13
  it "should have a problem with a pre-formatted invalid ABN" do
18
- ABN.valid?("12 042 168 744").should be_false
14
+ expect(ABN.valid?("12 042 168 744")).to be_falsey
19
15
  end
20
16
 
21
17
  it "should have a problem with an invalid ABN" do
22
- ABN.valid?("12042168744").should be_false
23
- ABN.valid?("902865").should be_false
18
+ expect(ABN.valid?("12042168744")).to be_falsey
19
+ expect(ABN.valid?("902865")).to be_falsey
24
20
  end
25
21
 
26
22
  it "should have a problem with invalid parameters" do
27
- ABN.valid?(nil).should be_false
28
- ABN.valid?(Array).should be_false
29
- ABN.valid?(Array.new).should be_false
23
+ expect(ABN.valid?(nil)).to be_falsey
24
+ expect(ABN.valid?(Array)).to be_falsey
25
+ expect(ABN.valid?(Array.new)).to be_falsey
30
26
  end
31
27
 
32
28
  it "should have a problem with invalid parameter type that has a #length of 11" do
33
29
  bad_parameter = (1..11).to_a
34
- bad_parameter.length.should eql(11)
35
- ABN.valid?(bad_parameter).should be_false
30
+ expect(bad_parameter.length).to eql(11)
31
+ expect(ABN.valid?(bad_parameter)).to be_falsey
36
32
  end
37
33
  end
38
34
 
39
35
  describe ABN, "to_s instance method" do
40
36
  it "should be able to format a valid ABN" do
41
- ABN.new("12042168743").to_s.should eql("12 042 168 743")
37
+ expect(ABN.new("12042168743").to_s).to eql("12 042 168 743")
42
38
  end
43
39
 
44
40
  it "should be able to return a pre-formatted ABN" do
45
- ABN.new("12 042 168 743").to_s.should eql("12 042 168 743")
41
+ expect(ABN.new("12 042 168 743").to_s).to eql("12 042 168 743")
46
42
  end
47
43
 
48
44
  it "should not format invalid parameter" do
49
- ABN.new(nil).to_s.should eql("")
50
- ABN.new(Array).to_s.should eql("")
51
- ABN.new(Array.new).to_s.should eql("")
45
+ expect(ABN.new(nil).to_s).to eql("")
46
+ expect(ABN.new(Array).to_s).to eql("")
47
+ expect(ABN.new(Array.new).to_s).to eql("")
52
48
  end
53
49
 
54
50
  it "should not format an invalid parameter type that has a #length of 11" do
55
51
  bad_parameter = (1..11).to_a
56
- bad_parameter.length.should eql(11)
57
- ABN.new(bad_parameter).to_s.should eql("")
52
+ expect(bad_parameter.length).to eql(11)
53
+ expect(ABN.new(bad_parameter).to_s).to eql("")
58
54
  end
59
55
 
60
56
  it "should not format an invalid ABN" do
61
- ABN.new("12042168744").to_s.should eql("")
62
- ABN.new("902865").to_s.should eql("")
57
+ expect(ABN.new("12042168744").to_s).to eql("")
58
+ expect(ABN.new("902865").to_s).to eql("")
63
59
  end
64
60
 
65
61
  it "should not format an pre-formatted invalid ABN" do
66
- ABN.new("12 042 168 744").to_s.should eql("")
62
+ expect(ABN.new("12 042 168 744").to_s).to eql("")
67
63
  end
68
64
  end
metadata CHANGED
@@ -1,130 +1,81 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: abn
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
6
- segments:
7
- - 2
8
- - 0
9
- - 0
10
- version: 2.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - James Healy
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2010-12-04 00:00:00 +11:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2017-07-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: rake
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
33
- type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rcov
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
41
17
  - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
47
20
  type: :development
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: roodi
51
21
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
55
24
  - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
61
- type: :development
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
64
28
  name: rspec
65
- prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
67
- none: false
68
- requirements:
69
- - - ~>
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 2
74
- - 0
75
- version: "2.0"
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
76
34
  type: :development
77
- version_requirements: *id004
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
78
41
  description: a (very) small library for working with Australian Business Numbers.
79
- email:
42
+ email:
80
43
  - jimmy@deefa.com
81
44
  executables: []
82
-
83
45
  extensions: []
84
-
85
46
  extra_rdoc_files: []
86
-
87
- files:
88
- - lib/abn.rb
47
+ files:
89
48
  - CHANGELOG
90
49
  - MIT-LICENSE
91
- - README.rdoc
50
+ - README.markdown
51
+ - lib/abn.rb
92
52
  - spec/abn_spec.rb
93
- has_rdoc: true
94
53
  homepage: http://github.com/yob/abn
95
- licenses: []
96
-
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
97
57
  post_install_message:
98
- rdoc_options:
99
- - --title
58
+ rdoc_options:
59
+ - "--title"
100
60
  - ABN
101
- - --line-numbers
102
- require_paths:
61
+ - "--line-numbers"
62
+ require_paths:
103
63
  - lib
104
- required_ruby_version: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
107
66
  - - ">="
108
- - !ruby/object:Gem::Version
109
- hash: 3
110
- segments:
111
- - 0
112
- version: "0"
113
- required_rubygems_version: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
67
+ - !ruby/object:Gem::Version
68
+ version: 1.9.3
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
116
71
  - - ">="
117
- - !ruby/object:Gem::Version
118
- hash: 3
119
- segments:
120
- - 0
121
- version: "0"
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
122
74
  requirements: []
123
-
124
75
  rubyforge_project: yob-projects
125
- rubygems_version: 1.3.7
76
+ rubygems_version: 2.6.11
126
77
  signing_key:
127
- specification_version: 3
78
+ specification_version: 4
128
79
  summary: a (very) small library for working with Australian Business Numbers.
129
- test_files:
80
+ test_files:
130
81
  - spec/abn_spec.rb