diff --git a/Rakefile b/Rakefile
index 9ba3daf6d8758923ecbebe646932e527fd1de703..70cea9efde1bb2471a68c1abf5a73be8fc8b4188 100644
--- a/Rakefile
+++ b/Rakefile
@@ -4,11 +4,17 @@ Bundler::GemHelper.install_tasks
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
- test.pattern = 'test/**/*_test.rb'
+ test.pattern = 'test/*_test.rb'
test.verbose = true
end
-task :default => :test
+Rake::TestTask.new(:integration) do |test|
+ test.libs << 'lib' << 'test'
+ test.pattern = 'test/integration/*_test.rb'
+ test.verbose = true
+end
+
+task :default => [:test, :integration]
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
diff --git a/lib/geocoder/lookups/base.rb b/lib/geocoder/lookups/base.rb
index 8a443fee520c281735b18d2e3f2c34e2a4904d3e..e8905707bc1a31ca6043183f2b8ebb9734eafe59 100644
--- a/lib/geocoder/lookups/base.rb
+++ b/lib/geocoder/lookups/base.rb
@@ -141,8 +141,11 @@ module Geocoder
def fetch_raw_data(query, reverse = false)
timeout(Geocoder::Configuration.timeout) do
url = query_url(query, reverse)
+ uri = URI.parse(url)
unless cache and response = cache[url]
- response = http_client.get_response(URI.parse(url)).body
+ client = http_client.new(uri.host, uri.port)
+ client.use_ssl = true if Geocoder::Configuration.use_https
+ response = client.get(uri.request_uri).body
if cache
cache[url] = response
end
diff --git a/test/integration/smoke_test.rb b/test/integration/smoke_test.rb
new file mode 100644
index 0000000000000000000000000000000000000000..8d80e1e14730cd9ad53072ef2ff9c07c5f4cf373
--- /dev/null
+++ b/test/integration/smoke_test.rb
@@ -0,0 +1,24 @@
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[ .. .. lib]))
+require 'pathname'
+require 'rubygems'
+require 'test/unit'
+require 'geocoder'
+
+class SmokeTest < Test::Unit::TestCase
+
+ def test_simple_zip_code_search
+ result = Geocoder.search "27701"
+ assert_equal "Durham", result.first.city
+ assert_equal "North Carolina", result.first.state
+ end
+
+ def test_simple_zip_code_search_with_ssl
+ Geocoder::Configuration.use_https = true
+ result = Geocoder.search "27701"
+ assert_equal "Durham", result.first.city
+ assert_equal "North Carolina", result.first.state
+ ensure
+ Geocoder::Configuration.use_https = false
+ end
+
+end