From a3e8eeddfa991e7bb8e4d70f57c66fcc6af3f2ce Mon Sep 17 00:00:00 2001
From: Alex Reisner <alex@alexreisner.com>
Date: Mon, 24 Feb 2014 12:35:19 -0500
Subject: [PATCH] Adjust load paths so test files can be run solo.

---
 test/integration/http_client_test.rb     | 3 ++-
 test/unit/active_record_test.rb          | 1 +
 test/unit/cache_test.rb                  | 1 +
 test/unit/calculations_test.rb           | 1 +
 test/unit/configuration_test.rb          | 1 +
 test/unit/error_handling_test.rb         | 1 +
 test/unit/geocoder_test.rb               | 1 +
 test/unit/https_test.rb                  | 1 +
 test/unit/ip_address_test.rb             | 1 +
 test/unit/lookup_test.rb                 | 1 +
 test/unit/lookups/bing_test.rb           | 1 +
 test/unit/lookups/dstk_test.rb           | 1 +
 test/unit/lookups/esri_test.rb           | 1 +
 test/unit/lookups/freegeoip_test.rb      | 1 +
 test/unit/lookups/geocoder_ca_test.rb    | 1 +
 test/unit/lookups/geocodio_test.rb       | 1 +
 test/unit/lookups/google_premier_test.rb | 1 +
 test/unit/lookups/google_test.rb         | 1 +
 test/unit/lookups/mapquest_test.rb       | 1 +
 test/unit/lookups/maxmind_local_test.rb  | 1 +
 test/unit/lookups/maxmind_test.rb        | 1 +
 test/unit/lookups/nominatim_test.rb      | 1 +
 test/unit/lookups/yahoo_test.rb          | 1 +
 test/unit/method_aliases_test.rb         | 1 +
 test/unit/model_test.rb                  | 1 +
 test/unit/mongoid_test.rb                | 1 +
 test/unit/near_test.rb                   | 2 ++
 test/unit/oauth_util_test.rb             | 1 +
 test/unit/proxy_test.rb                  | 1 +
 test/unit/query_test.rb                  | 1 +
 test/unit/request_test.rb                | 1 +
 test/unit/result_test.rb                 | 1 +
 test/unit/test_mode_test.rb              | 2 ++
 33 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/test/integration/http_client_test.rb b/test/integration/http_client_test.rb
index c024d59a..20a9cf8d 100644
--- a/test/integration/http_client_test.rb
+++ b/test/integration/http_client_test.rb
@@ -1,4 +1,5 @@
-$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[ .. .. lib]))
+# encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..", "lib")
 require 'pathname'
 require 'rubygems'
 require 'test/unit'
diff --git a/test/unit/active_record_test.rb b/test/unit/active_record_test.rb
index 33927653..60e6e4d0 100644
--- a/test/unit/active_record_test.rb
+++ b/test/unit/active_record_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class ActiveRecordTest < GeocoderTestCase
diff --git a/test/unit/cache_test.rb b/test/unit/cache_test.rb
index d4730964..7777fdb2 100644
--- a/test/unit/cache_test.rb
+++ b/test/unit/cache_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class CacheTest < GeocoderTestCase
diff --git a/test/unit/calculations_test.rb b/test/unit/calculations_test.rb
index 98fdfbcd..83b0faf3 100644
--- a/test/unit/calculations_test.rb
+++ b/test/unit/calculations_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class CalculationsTest < GeocoderTestCase
diff --git a/test/unit/configuration_test.rb b/test/unit/configuration_test.rb
index 527a57e7..e28f831d 100644
--- a/test/unit/configuration_test.rb
+++ b/test/unit/configuration_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class ConfigurationTest < GeocoderTestCase
diff --git a/test/unit/error_handling_test.rb b/test/unit/error_handling_test.rb
index faf53192..58dc37f8 100644
--- a/test/unit/error_handling_test.rb
+++ b/test/unit/error_handling_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class ErrorHandlingTest < GeocoderTestCase
diff --git a/test/unit/geocoder_test.rb b/test/unit/geocoder_test.rb
index 7dc4e0f5..754c88dd 100644
--- a/test/unit/geocoder_test.rb
+++ b/test/unit/geocoder_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class GeocoderTest < GeocoderTestCase
diff --git a/test/unit/https_test.rb b/test/unit/https_test.rb
index 14420dfc..b8dc52ab 100644
--- a/test/unit/https_test.rb
+++ b/test/unit/https_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class HttpsTest < GeocoderTestCase
diff --git a/test/unit/ip_address_test.rb b/test/unit/ip_address_test.rb
index 2e36f8bb..4de712b9 100644
--- a/test/unit/ip_address_test.rb
+++ b/test/unit/ip_address_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class IpAddressTest < GeocoderTestCase
diff --git a/test/unit/lookup_test.rb b/test/unit/lookup_test.rb
index 0f8dae4b..6512c8e1 100644
--- a/test/unit/lookup_test.rb
+++ b/test/unit/lookup_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class LookupTest < GeocoderTestCase
diff --git a/test/unit/lookups/bing_test.rb b/test/unit/lookups/bing_test.rb
index f55e2ef9..864bc8ac 100644
--- a/test/unit/lookups/bing_test.rb
+++ b/test/unit/lookups/bing_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class BingTest < GeocoderTestCase
diff --git a/test/unit/lookups/dstk_test.rb b/test/unit/lookups/dstk_test.rb
index 2e73e447..840174e9 100644
--- a/test/unit/lookups/dstk_test.rb
+++ b/test/unit/lookups/dstk_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class DstkTest < GeocoderTestCase
diff --git a/test/unit/lookups/esri_test.rb b/test/unit/lookups/esri_test.rb
index 8d6bcbe1..625fff7d 100644
--- a/test/unit/lookups/esri_test.rb
+++ b/test/unit/lookups/esri_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class EsriTest < GeocoderTestCase
diff --git a/test/unit/lookups/freegeoip_test.rb b/test/unit/lookups/freegeoip_test.rb
index 565efb6b..5d6da52a 100644
--- a/test/unit/lookups/freegeoip_test.rb
+++ b/test/unit/lookups/freegeoip_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class FreegeoipTest < GeocoderTestCase
diff --git a/test/unit/lookups/geocoder_ca_test.rb b/test/unit/lookups/geocoder_ca_test.rb
index 927faaf0..45b88e73 100644
--- a/test/unit/lookups/geocoder_ca_test.rb
+++ b/test/unit/lookups/geocoder_ca_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class GeocoderCaTest < GeocoderTestCase
diff --git a/test/unit/lookups/geocodio_test.rb b/test/unit/lookups/geocodio_test.rb
index bbf370a9..68280c08 100644
--- a/test/unit/lookups/geocodio_test.rb
+++ b/test/unit/lookups/geocodio_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class GeocodioTest < GeocoderTestCase
diff --git a/test/unit/lookups/google_premier_test.rb b/test/unit/lookups/google_premier_test.rb
index c96c4a1f..517e78cf 100644
--- a/test/unit/lookups/google_premier_test.rb
+++ b/test/unit/lookups/google_premier_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class GooglePremierTest < GeocoderTestCase
diff --git a/test/unit/lookups/google_test.rb b/test/unit/lookups/google_test.rb
index fec7acb3..35960a51 100644
--- a/test/unit/lookups/google_test.rb
+++ b/test/unit/lookups/google_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class GoogleTest < GeocoderTestCase
diff --git a/test/unit/lookups/mapquest_test.rb b/test/unit/lookups/mapquest_test.rb
index 07e4bbb6..1f6b22b1 100644
--- a/test/unit/lookups/mapquest_test.rb
+++ b/test/unit/lookups/mapquest_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class MapquestTest < GeocoderTestCase
diff --git a/test/unit/lookups/maxmind_local_test.rb b/test/unit/lookups/maxmind_local_test.rb
index 28ca4020..c71b880e 100644
--- a/test/unit/lookups/maxmind_local_test.rb
+++ b/test/unit/lookups/maxmind_local_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class MaxmindLocalTest < GeocoderTestCase
diff --git a/test/unit/lookups/maxmind_test.rb b/test/unit/lookups/maxmind_test.rb
index 6fc6cb02..46e560bb 100644
--- a/test/unit/lookups/maxmind_test.rb
+++ b/test/unit/lookups/maxmind_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class MaxmindTest < GeocoderTestCase
diff --git a/test/unit/lookups/nominatim_test.rb b/test/unit/lookups/nominatim_test.rb
index 310fa381..067a46e3 100644
--- a/test/unit/lookups/nominatim_test.rb
+++ b/test/unit/lookups/nominatim_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class NominatimTest < GeocoderTestCase
diff --git a/test/unit/lookups/yahoo_test.rb b/test/unit/lookups/yahoo_test.rb
index f299b7b7..3bdef12d 100644
--- a/test/unit/lookups/yahoo_test.rb
+++ b/test/unit/lookups/yahoo_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..", "..")
 require 'test_helper'
 
 class YahooTest < GeocoderTestCase
diff --git a/test/unit/method_aliases_test.rb b/test/unit/method_aliases_test.rb
index d33afc48..242978d1 100644
--- a/test/unit/method_aliases_test.rb
+++ b/test/unit/method_aliases_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class MethodAliasesTest < GeocoderTestCase
diff --git a/test/unit/model_test.rb b/test/unit/model_test.rb
index a4f5d9f7..126461c2 100644
--- a/test/unit/model_test.rb
+++ b/test/unit/model_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class ModelTest < GeocoderTestCase
diff --git a/test/unit/mongoid_test.rb b/test/unit/mongoid_test.rb
index 78fd4a04..f5a03148 100644
--- a/test/unit/mongoid_test.rb
+++ b/test/unit/mongoid_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'mongoid_test_helper'
 
 class MongoidTest < GeocoderTestCase
diff --git a/test/unit/near_test.rb b/test/unit/near_test.rb
index 09083869..354ba350 100644
--- a/test/unit/near_test.rb
+++ b/test/unit/near_test.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class NearTest < GeocoderTestCase
diff --git a/test/unit/oauth_util_test.rb b/test/unit/oauth_util_test.rb
index d70e333f..2fa2dc6d 100644
--- a/test/unit/oauth_util_test.rb
+++ b/test/unit/oauth_util_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 require 'cgi'
 require 'uri'
diff --git a/test/unit/proxy_test.rb b/test/unit/proxy_test.rb
index 23d8789a..bb9f8815 100644
--- a/test/unit/proxy_test.rb
+++ b/test/unit/proxy_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class ProxyTest < GeocoderTestCase
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 77c9839e..0b389038 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class QueryTest < GeocoderTestCase
diff --git a/test/unit/request_test.rb b/test/unit/request_test.rb
index 6ffe6b7d..1fc363f7 100644
--- a/test/unit/request_test.rb
+++ b/test/unit/request_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class RequestTest < GeocoderTestCase
diff --git a/test/unit/result_test.rb b/test/unit/result_test.rb
index 631f3e7b..82764d81 100644
--- a/test/unit/result_test.rb
+++ b/test/unit/result_test.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class ResultTest < GeocoderTestCase
diff --git a/test/unit/test_mode_test.rb b/test/unit/test_mode_test.rb
index df0c5480..38b054c0 100644
--- a/test/unit/test_mode_test.rb
+++ b/test/unit/test_mode_test.rb
@@ -1,3 +1,5 @@
+# encoding: utf-8
+$: << File.join(File.dirname(__FILE__), "..")
 require 'test_helper'
 
 class TestModeTest < GeocoderTestCase
-- 
GitLab