addressable_record 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.0.3 2010-03-21
2
+
3
+ * Fixed a bug where a 5 digit zip code fails to load in the initializer correctly.
4
+
5
+
1
6
  == 1.0.2 2010-03-21
2
7
 
3
8
  * Added ability for the composed_of attribute to parse a Hash of address elements.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{addressable_record}
8
- s.version = "1.0.2"
8
+ s.version = "1.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["C. Jason Harrelson (midas)"]
@@ -4,7 +4,7 @@ require 'addressable_record/address'
4
4
  require 'addressable_record/active_record_extesions'
5
5
 
6
6
  module AddressableRecord
7
- VERSION = '1.0.2'
7
+ VERSION = '1.0.3'
8
8
  end
9
9
 
10
10
  ActiveRecord::Base.send( :include, AddressableRecord::ActiveRecordExtensions ) if defined?( ActiveRecord::Base )
@@ -17,7 +17,10 @@ module AddressableRecord
17
17
 
18
18
  @streets = AddressableRecord::Address.parse_street( attrs[:raw_street] || '' )
19
19
  raw_zip = (attrs[:raw_zip_code] || '')
20
- @zip_code = raw_zip.size == 5 ? @raw_zip_code : raw_zip.gsub( /(\d{5})(\d{4})/, "\\1#{@@zip_code_delimiter}\\2" )
20
+ puts raw_zip
21
+ puts raw_zip.size
22
+ @zip_code = raw_zip.size == 5 ? raw_zip : raw_zip.gsub( /(\d{5})(\d{4})/, "\\1#{@@zip_code_delimiter}\\2" )
23
+ puts @zip_code
21
24
 
22
25
  @pattern_map = {
23
26
  '%s' => @streets.join( ', ' ) || "",
@@ -87,6 +87,12 @@ describe "AddressableRecord" do
87
87
  it "should agree that the country is United States" do
88
88
  @user.address.country.should eql( 'United States' )
89
89
  end
90
+
91
+ it "should handle a 5 digit zip code" do
92
+ @user = User.new( :name => 'John Smith', :address => @address_attributes.merge( :raw_zip_code => '31234' ) )
93
+ @user.save!
94
+ @user.address.zip_code.should eql( '31234' )
95
+ end
90
96
  end
91
97
  end
92
98
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: addressable_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - C. Jason Harrelson (midas)