aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/services_controller_spec.rb
diff options
context:
space:
mode:
authorRobin Houston <robin@lenny.robin>2011-09-08 00:56:59 +0100
committerRobin Houston <robin@lenny.robin>2011-09-08 00:56:59 +0100
commit6e0e5e5bed89ff2093e1cca3fa50310f678565fd (patch)
treeae9a198a8134e90ab2a140d699ed6f3248f467cc /spec/controllers/services_controller_spec.rb
parente286a5a91e449ef01b5ce5f23654d1316bffaf53 (diff)
parenta9002cc8e749df6f5961acab8e3e61fd21987fc1 (diff)
Merge branch 'develop' of git@github.com:sebbacon/alaveteli into develop
Conflicts: app/models/request_mailer.rb
Diffstat (limited to 'spec/controllers/services_controller_spec.rb')
-rw-r--r--spec/controllers/services_controller_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb
new file mode 100644
index 000000000..1bafd0c8f
--- /dev/null
+++ b/spec/controllers/services_controller_spec.rb
@@ -0,0 +1,31 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe ServicesController, "when using web services" do
+ integrate_views
+
+ it "should show no alaveteli message when in the deployed country" do
+ config = MySociety::Config.load_default()
+ config['ISO_COUNTRY_CODE'] = "DE"
+ controller.stub!(:country_from_ip).and_return('DE')
+ get :other_country_message
+ response.body.should == ""
+ end
+
+ it "should show an alaveteli message when not in the deployed country and in a country with no FOI website" do
+ config = MySociety::Config.load_default()
+ config['ISO_COUNTRY_CODE'] = "DE"
+ controller.stub!(:country_from_ip).and_return('ZZ')
+ get :other_country_message
+ response.body.should match(/outside Germany/)
+ end
+
+ it "should show link to other FOI website when not in the deployed country" do
+ config = MySociety::Config.load_default()
+ config['ISO_COUNTRY_CODE'] = "ZZ"
+ controller.stub!(:country_from_ip).and_return('DE')
+ get :other_country_message
+ response.body.should match(/within Germany/)
+ end
+
+
+end