post_code 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +11 -0
- data/Rakefile +30 -0
- data/VERSION +1 -0
- data/lib/post_code.rb +2 -0
- data/lib/post_code/uk.rb +35 -0
- data/spec/fixtures/database.uk.txt +8338 -0
- data/spec/postcode_spec.rb +31 -0
- data/spec/spec.opts +2 -0
- metadata +71 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + "/../lib/post_code"
|
4
|
+
|
5
|
+
describe "UK post code lookup" do
|
6
|
+
before do
|
7
|
+
PostCode::UK.database = File.dirname(__FILE__) + "/fixtures/database.uk.txt"
|
8
|
+
end
|
9
|
+
|
10
|
+
context "looking up lat/long from postcode" do
|
11
|
+
before do
|
12
|
+
|
13
|
+
@postcode = PostCode::UK.lookup("ME2 3AU")
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should match lat/long" do
|
17
|
+
@postcode.latitude.should == "51.401778"
|
18
|
+
@postcode.longitude.should == "0.493526"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "The post code gem" do
|
24
|
+
before do
|
25
|
+
PostCode::UK.instance_variable_set("@database", nil)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should use the supplied database by default" do
|
29
|
+
PostCode::UK.database.should_not be_nil
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec.opts
ADDED
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: post_code
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Bartholomew
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-26 00:00:00 +00:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: fastercsv
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
description: ""
|
26
|
+
email: Stephen Bartholomew
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README
|
33
|
+
files:
|
34
|
+
- README
|
35
|
+
- Rakefile
|
36
|
+
- VERSION
|
37
|
+
- lib/post_code.rb
|
38
|
+
- lib/post_code/uk.rb
|
39
|
+
- spec/fixtures/database.uk.txt
|
40
|
+
- spec/postcode_spec.rb
|
41
|
+
- spec/spec.opts
|
42
|
+
has_rdoc: true
|
43
|
+
homepage: http://github.com/curve21/post_code
|
44
|
+
licenses: []
|
45
|
+
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options:
|
48
|
+
- --charset=UTF-8
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.3.5
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Library for mapping postcodes to lat/long
|
70
|
+
test_files:
|
71
|
+
- spec/postcode_spec.rb
|