aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/application_controller_spec.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-17 21:44:41 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-17 21:44:41 +0000
commit2c97a42455edb338a4ffeb529c9dd08bdf2864e0 (patch)
tree0735d4a36215df79a4c8ec854df3793b5f9cb310 /spec/controllers/application_controller_spec.rb
parente60d21cb129d1de487ebedd6b5e9efb22913130d (diff)
parente190eebf7c4bd6a742706e60f2bf941f70d1a1e4 (diff)
Merge branch 'release/0.5' into develop
Conflicts: lib/alaveteli_external_command.rb
Diffstat (limited to 'spec/controllers/application_controller_spec.rb')
-rw-r--r--spec/controllers/application_controller_spec.rb27
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