aboutsummaryrefslogtreecommitdiffstats
path: root/spec/controllers/services_controller_spec.rb
diff options
context:
space:
mode:
authorseb <seb@seb-U36JC>2011-11-24 09:21:36 +0000
committerseb <seb@seb-U36JC>2011-11-24 09:21:36 +0000
commita4e533f1588a5d34dca4ab462b58ddd83eed37c5 (patch)
tree58bb3b57ec5664e094ae151c18b6c1915256e364 /spec/controllers/services_controller_spec.rb
parentd473fce1d0451c913d3ef697d3b45bd58c6fff54 (diff)
parente649c2a7f19d0a75206149d886ff47b3ccda4e91 (diff)
Merge branch 'develop' into xapian-dcabo
Conflicts: spec/models/xapian_spec.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