diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-01-17 13:09:00 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-01-17 13:09:00 +0000 |
commit | 80e56fde3b4bdb9d2483a7c858960a6d2bd964e0 (patch) | |
tree | 09742b72b053f6623954baefd13a0a9e32bfeb5f /spec/controllers/application_controller_spec.rb | |
parent | bae21e38242aac2c5843bae5ea5fe3b09408a4f9 (diff) | |
parent | ba7310b580b2b03068568497c02eae7cbcd2d901 (diff) |
Merge branch 'release/0.5' into wdtk
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r-- | spec/controllers/application_controller_spec.rb | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 875d7d224..1d6802940 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -1,10 +1,25 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'fakeweb' -describe ApplicationController, "when authenticating user" do - integrate_views - fixtures :users - -# it "blah" do -# end +describe ApplicationController, "when accessing third party services" do + it "should fail silently if the country_from_ip domain doesn't exist" do + config = MySociety::Config.load_default() + config['GAZE_URL'] = 'http://12123sdf14qsd.com' + country = self.controller.send :country_from_ip + country.should == config['ISO_COUNTRY_CODE'] + end + it "should fail silently if the country_from_ip service doesn't exist" do + config = MySociety::Config.load_default() + config['GAZE_URL'] = 'http://www.google.com' + country = self.controller.send :country_from_ip + country.should == config['ISO_COUNTRY_CODE'] + end + it "should fail silently if the country_from_ip service returns an error" do + FakeWeb.register_uri(:get, %r|.*|, :body => "Error", :status => ["500", "Error"]) + config = MySociety::Config.load_default() + config['GAZE_URL'] = 'http://500.com' + country = self.controller.send :country_from_ip + country.should == config['ISO_COUNTRY_CODE'] + end end |