Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:informal no longer used #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ Gemfile.lock
*~
*.old
*.tar.gz

# Ignore vi stuff
*~
*.swp
*.swo


3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ or from Gemfile
# same results as above
```

## Differences From Pre Version 2
The method "parse" now defaults to parsing informal addresses. The parameter :informal has gone away replaced by the method "parse_informal_address". To get stricter parsing as in version 1's "parse" call you should now use the method "parse_address".

## License
The [MIT Licencse](http://opensource.org/licenses/MIT)

Expand Down
18 changes: 3 additions & 15 deletions test/street_address_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def test_address_parsing

def test_informal_address_parsing
INFORMAL_ADDRESSES.each_pair do |address, expected|
addr = StreetAddress::US.parse(address, informal: true)
addr = StreetAddress::US.parse_informal_address(address)
compare_expected_to_actual_hash(expected, addr.to_h, address)
end
end
Expand Down Expand Up @@ -550,28 +550,16 @@ def test_zip_plus_4_without_dash
assert_equal "4444", addr.postal_code_ext
end

def test_informal_parse_normal_address
a = StreetAddress::US.parse("2730 S Veitch St, Arlington, VA 222064444", informal: true)
assert_equal "2730", a.number
assert_equal "S", a.prefix
assert_equal "Veitch", a.street
assert_equal "St", a.street_type
assert_equal "Arlington", a.city
assert_equal "VA", a.state
assert_equal "22206", a.postal_code
assert_equal "4444", a.postal_code_ext
end

def test_informal_parse_informal_address
a = StreetAddress::US.parse("2730 S Veitch St", informal: true)
a = StreetAddress::US.parse_informal_address("2730 S Veitch St")
assert_equal "2730", a.number
assert_equal "S", a.prefix
assert_equal "Veitch", a.street
assert_equal "St", a.street_type
end

def test_informal_parse_informal_address_trailing_words
a = StreetAddress::US.parse("2730 S Veitch St in the south of arlington", informal: true)
a = StreetAddress::US.parse_informal_address("2730 S Veitch St in the south of arlington")
assert_equal "2730", a.number
assert_equal "S", a.prefix
assert_equal "Veitch", a.street
Expand Down